(?Advanced) Shader variables - Lava Shader problems

Hi,



I'm working through "OpenGL Shading Language v2 2006" and I stumbled upon this shader code to implement a Lava Shader:


varying float LightIntensity;
varying vec3 MCposition;
uniform sampler3D Noise;
uniform vec3 Color1; // (0.8, 0.7, 0.0)
uniform vec3 Color2; // (0.6, 0.1, 0.0)
uniform float NoiseScale; // 1.2
void main()
{
   vec4 noisevec = texture3D(Noise, MCposition * NoiseScale);
   float intensity = abs(noisevec[0] - 0.25) +
      abs(noisevec[1] - 0.125) +
      abs(noisevec[2] - 0.0625) +
      abs(noisevec[3] - 0.03125);
   intensity = clamp(intensity * 6.0, 0.0, 1.0);
   vec3 color = mix(Color1, Color2, intensity) * LightIntensity;
   gl_FragColor = vec4(color, 1.0);
}



The problem arises at the sampler3D. How do I initialize it from within jME?
The same question arrises at different sort of variables, samplerCube and so on.

I searched the forum for an answer, but only found 2+ year old questions regarding the same subject.

Do you have a 3D noise texture to sample?

That is the whole problem.

Am I right in saying that 3D Texture are still not implemented in jME?

Last time I checked, which was about 10 months, they wern't - which also hindered my experiments.

If i'm right it is not implemented for jme1 but for jme2 http://code.google.com/p/jmonkeyengine/source/browse/#svn/trunk/src/com/jme/image .

3D textures are supported in jME2, but there's no way to load them from a file. You have to manually craft them from multiple 2D textures. If you're generating the texture during runtime though it is much better as you don't need to store lots of images for a single 3D texture.

For cubemaps, use the DDS format. jME2's DDSLoader supports cubemaps and makes sure to load the image as TetxureCubeMap object.