Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to understand the mathematical theory behind UVW mapping. Can anyone explain me how UVW mapping works? Or at least provide me a pointer?

share|improve this question
2  
possible duplicate of What exactly is UV and UVW Mapping? –  bummzack Sep 2 '11 at 13:23
    
Thanks, but still it is not clear to me the meaning of W. Is there some kind of book to follow? –  Jack Sep 2 '11 at 13:55
    
I think the W is just that textures usually have 3 channels, I don't know of any real use for it. –  Kevin van der Velden Sep 2 '11 at 14:12
1  
@Yourdoom The W doesn't have anything to do with the number of channels the texture has. It's rather used for 3d textures or perspective texturing. –  Christian Rau Sep 2 '11 at 14:41
4  
XY is to XYZ, as UV is to UVW. W is just the letter used when describing the 3rd dimension of the texture. –  Byte56 Sep 2 '11 at 15:12
show 1 more comment

1 Answer

up vote 12 down vote accepted

This is the way I understand it. Could be totally wrong, but I'm sure someone will flame correct me if I'm wrong.

The mathematical theory behind UVW texture mapping is similar to the theory behind UV texture mapping.

See Bummzack's link here: What exactly is UV and UVW Mapping? to get a better explanation of what UV mapping is. Basically, you're mapping an area of a texture to an area of a surface. Interpolating the values in-between based on those mappings.

Same thing with UVW. Except now you're mapping a volume of texture to a volume of surfaces. Interpolating the values in-between. Now with the 3rd dimension you can warp a 2d texture to better fit an object.

Lets look how this is used in 3D textures. 3D textures can be created by layers of 2D textures, and interpolating the texels in-between. Visually a 3D texture could look something like this:

3D texture example

Where the "planes" in the R axis are 2D textures. If we were to set each layer to a different solid color, and apply this to a 3D object, we'd get something like this:

3D texture applied

You can see how the solid colors have been interpolated in-between the layers. Here's the same type of thing, but with a landscape. Where from top to bottom, the textures could be: snow, rock, grass, sand.

Landscape

Now if we're only using one R "plane" (one 2D texture), but mapping to 3D object? Obviously this doesn't give as much flexibility as multiple layers of textures, but it sure is a lot less work. However, just projecting a 2D texture onto a 3D surface is going to cause some issues. Think of the situation where you're shining a laser on a wall. At a perpendicular angle the laser point is nice and round. At any other angle, the point starts to stretch and skew. Same thing will happen when projecting a 2D texture onto a 3D surface. Any face that isn't perpendicular to the projection will be distorted. How do we fix that? By distorting the projection. Take the laser example, if we had a laser that when shone on a perpendicular surface it was stretched and skewed. When we shone that laser onto a angled wall the angle could "cancel" the effects of the stretching. The 3rd dimension allows us to "shape" the projection so that it fits the surface we're aiming at. For example, some kind of wavy 3D surface might have a texture like this (but not so crummy):

Crummy 2D texture expanded to 3D

Like I said, this is just my understanding of it. I agree, there isn't much good information out there on this subject. Hopefully this (likely wrong) answer will prompt someone with more knowledge of the subject to speak up.

The images for the 3D textures came from this page: http://www.gpwiki.org/index.php/OpenGL:Tutorials:3D_Textures

share|improve this answer
    
Thanks a lot, that's what I was looking for –  Jack Sep 6 '11 at 15:17
    
Question: Why isn't it called RST instead of UVW? –  Dan the Man Oct 11 '12 at 21:07
    
Good question. I'm not sure. Though, I believe that RST is always going to be a normalized value and UVW is not constrained in that way. –  Byte56 Oct 11 '12 at 21:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.