Jump to content
  • Advertisement
Sign in to follow this  
LetsDoThis

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.

If you intended to correct an error in the post then please contact us.

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

 

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?

Share this post


Link to post
Share on other sites
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.

Edited by vstrakh

Share this post


Link to post
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 this post


Link to post
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!