Public Group

# Understanding better the 3D texture coordinate?

This topic is 1089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

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?

##### Share on other sites

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.

Edited by vstrakh

##### Share on other sites

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

##### Share on other sites
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.

##### Share on other sites

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!

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633722
• Total Posts
3013549
×