3D Textures

Is there anything in jME to support 3D Textures?



I need to create an empty 3D texture of a given dimension (128x128x128 for example) and populate the texture with various noise octaves in each of the RGBA components. This texture will then be passed to a fragment shader as a sampler3D data type, primarily to ensure hardware independent results (and because my GPU doesn't support GLSL's noise() function), and to increase rendering performance.



If you're asking why it needs to be a 3D texture, its because I hope to animate the final result in the fragment shader using an application controlled uniform variable for the depth (z) of the texture. This will be based on time elapsed.



If somebody can help me get the 3D texture set up for populating with data, I can submit back to the forum a simple demonstration for creating procedural generated, and animated, clouds.



Thanks

Why do you have such a big Texture? it has 4Million values! cant you calculate the Third Dimension? or for what is this?

Sorry, I edited my last post to read 128x128x128 instead of 128x128x238.

I don't think its a particularly big texture - anyway its just an example. If I were to calculate the third dimension I may as well calculate all of them. 128x128x128 was just an example - I dont know what I need yet except that I need a 3D texture.



The 3D texture is for storing octaves of an application computed perlin noise function for usage in an GLSL shader to calculate absolute or turbulence noise.

I'm not telling you what I hope to achieve visually yet. But I confidently know this process can be used to procedurally create and animate clouds (thats not a hint by the way  ;)), if I can get a 3D texture into a shader.

1D, 3D and cubemap textures will be supported in the coming months.

Yay to more texturing options! :smiley:

renanse said:

1D, 3D and cubemap textures will be supported in the coming months.


awesome! then clouds problem might be solved easily ha~

Cheers Renanse.

Drop me a line when they're in there!



Neakor - you can currently create clouds with a 2D procedural texture but only with basic, scrolling, animation.

adamgp said:

Cheers Renanse.
Drop me a line when they're in there!

Neakor - you can currently create clouds with a 2D procedural texture but only with basic, scrolling, animation.


can i just have serveral quads made in maya all alpha blended. then use this model as the cloud?

Yea, but thats not nearly as nice.



Plus when Renanse reveals 3D textures in one months time

im kind hazy on how to do those. but i can c y it is better though.



but is it very expensive though? if the player doesnt need to go through the clouds, is 3d texutres still necessary?

The overall texture is still 2D - wrapped over a Quad for example. The 3D texture just contains perlin noise octaves for generating the cloud shapes.



The general process would be:

  • Create a 3D texture in the application.
  • Assign values to each coordinate of the texture using a repeatable perlin noise function (only needs to be calculated once).
  • Pass the 3D texture to your GLSL shader as a sampler3D uniform variable.
  • Pass and update a time/offset variable from your application to the shader to animcation timeframes.
  • Read in the texture components in the fragment shader for mixing between colours (white for clouds, blue for sky).
  • Optionally, apply the appropriate texture coordinates in the fragment shader to gl_FragColor according to the offset/time variable along the z component of the texture.
  • Optionally, apply offsets along the x & y textur components to give the appearance of moving clouds.
adamgp said:
Plus when Renanse reveals 3D textures in one months time  :P


No putting words in my mouth :)  I said in coming months.  :P

Well, it was worth a try  XD

ive talked to some plp about this, and most common feedback i got is that this is pretty expensive if i dont want the player to go through it.



what do think adamgp? expensive?

I don

It might be possible to do in fixed-function pipeline by using a matrix to shift the Z texture coordinates, then you don't need shaders for this at all.