Understanding better the 3D texture coordinate?

Started by
3 comments, last by Poigahn 8 years, 4 months ago

I am not a graphic artist or 3D animator. What I am doing right now is just learning Opengl. While on the topic of cube map, I came across this R texture coordinate. How can you visualize it? Say even if you visualize it as a cube. It is nothing more than a cube covered in 2D texture. Or for example you are sampling a texture on a triangle(2D or 3D) it will always just use a 2D texture. So I am just wondering, why is there an R coordinate? I think S and T would be enough in many cases( I am not sure on this since I am just beginning to learn OpenGL).

Searching in google I found this

06.3dtex.gif

Which is kind of confusing. If you map it on cube and cube is basically composed on 2D square, you are just going to use 2D texture as well(S,T) right?

ooookkkkkaaaayyy

Advertisement

So I am just wondering, why is there an R coordinate?

It is used when you're sampling 3D texture that store some volumetric data. Like fog density, etc.

And it is used to sample cube map texture, when texture coordinates is not a position, but direction vector.

and in case you sample from a texture array, the r-coordinate is the array slice.

Conceptually you can think of your normal 2d texture as a sheet of paper, you have a 'corner' like the top left where we designate cartesian coordinates from, u and v to designate a position on the texture. You might know that part already.

Taking the paper analogy further a 3d texture is like a stack of papers(you can think of them floating slightly apart if that helps you visualize it easier,) each sheet of paper is a 'plane' of the 3d texture, specified by a W coordinate, so its like specifying between slices of paper vs just horizontal and vertical.

This can be used for certain rendering techniques like vstrakh mentioned, but 3d textures are arguably pretty rare, most techniques just use 2d textures and even then a 3d texture is technically just an array of 2d textures.


for example you are sampling a texture on a triangle(2D or 3D) it will always just use a 2D texture. So I am just wondering, why is there an R coordinate? I think S and T would be enough in many cases

I believe you are only considering a single layer with a single texture on all 6 sides on a cube ( 4 sides on a triangle ) ?

If you are using a layered texture, 1 - for graphic or color, But then you want to add wording or pictures, such as Cave Man Drawings, A different one on each side of your cube, Then you need the "R" value included to place those textures on the correct location.

I hope I explained that correctly!

Your Brain contains the Best Program Ever Written : Manage Your Data Wisely !!

This topic is closed to new replies.

Advertisement