View Full Version : How does UV interpolation work?
stuh505 09-21-2006, 02:19 AM I'm coding a rendering system and I need to interpolate the UV coordinates of points inbetween vertices for texture mapping. I'm not trying to figure out what the pixel values should be on the screen when viewing the face, that's already covered, I'm trying to figure out what the UV coordinate would be at a particular point in (x,y,z) space that happens to be in the plane of the face. At first I thought weighted average of the other texture verts but that's not even close to being right. Does anyone know how this is supposed to be calculated?
|
|
panoramix
09-22-2006, 12:00 AM
I don't fully understand the question, if you need to lookup the texel for a given pixel what you need to do is something like texel = texture[u*texture_width][v*texture_height] (well, actually depends on how the texture is stored), if you need the actual uv's for the lookup you should be reading them from the mesh file (or generating them based on some sort of projection). Most file formats have the uv's as part of the vertex data. If you mean the uv's in between vertices linear interpolation works just fine.
CGTalk Moderation
09-22-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.