3-D Textures (GL_TEXTURE_3D)

Started by RiverC, March 20, 2012, 03:28:14

Previous topic - Next topic

RiverC

A quick question, if you will. I'd like to use a 3-layer 3d texture (the textures are highly pixelated to begin with) to simply represent either grooves / holes in a surface, or bumps/protrusions. Getting 3d textures to work will probably be some work (I do already 'correctly' texture 2d quads) so mainly I just want to know, for anyone who has made use of them or knows their effect, whether or not it will be worth the trouble? Can I get a reasonably blocky effect from a 3d texture, that will not overly complicate lighting?

And I guess if so, (I'd imagine you can turn to GL_NEAREST for depth(R) blending as well as T and S blending) does the texture loader work well with 3d textures? I've noticed most examples show making a special 4-dimensional buffer (color,x,y,depth) and filling it with the image data. Does slick-util help with this or will I need create the buffer to load the PNG's into the buffer manually?

So many questions. Why can't I hold all the questions

Estraven

Hello

I've worked with GL_TEXTURE_3D a lot lately, I might be able to help. But ... I just don't understand what you're trying to do.
Can you try to clarify what is your goal ?

Anyway, if you already know that you only have 3 layers, input 3 Sampler2D to your shader, it's gonna be fine.
Most of the time, I use Texture_3D only for textures like 256x512x1024 pixel, that can't be passed as 256 Sampler2D. ;)


Estraven

RiverC

Est,

so I'm doing (essentially) multitexture? The examples I've seen seem to indicate that there is some extra geometry created by the differences in the layers, but it would seem that passing three 2d textures would not create this geometry... that is, unless I do that myself in the vertex shader of course! Anyway, the way to think of what I'm trying to do is to think of a pixelated brick wall like Minecraft's brick, but imagine that the bricks are raised above the mortar.

I don't necessarily need this effect, but I'm experimenting with mixing and matching old and new technologies to see what makes for good stylization while remaining simple.

Estraven

Ok, I may be wrong, but i think you misunderstood what Texture_3D are.

I have the strong impression that you are trying to achieve something like Parallax Mapping, which works using 2D textures.

Texture3D are not designed to be used that way. They do not generate geometry effects in the fragment shader.
Texture3D are 3D matrix of colors, that you may use for volumetric data rendering.
One good example is MRI data visualisation on GPU that uses texture_3d to store MRI data into GPU memory.

The "Parallax mapping" is a pixel-based ray-tracing technique that simulate bumps over a flat geometry. Unlike "normal mapping",
"parallax mapping" enables protrusions to hide some other parts of the surface. It's great, but is GPU consuming, that's why this is now done using Geometry of Tesselation Shaders.

If "old technologies" means OpenGL 1 and 2, as far as i know, you can only do this using Fragment Shaders with a "tangent-space" Vertex Shader.

Hope it helps you.

Estraven