graphics - texture mapping (u,v) values -


here excerpt peter shirley's fundamentals of computer graphics:

11.1.2 texture arrays

we assume 2 dimensions mapped called u , v. assume have nx , ny image use texture. somehow need every (u,v) have associated color found image. standard way make texturing work (u,v) first remove integer portion of (u,v) lies in unit square. has effect of "tiling" entire uv plane copies of now-square texture. use 1 of 3 interpolation strategies compute image color coordinates.

my question is: integer portion of (u,v)? thought u,v 0 <= u,v <= 1.0. if there integer portion, shouldn't dividing u,v texture image width , height normalized u,v values?

uv values can less 0 or greater 1. reason dropping integer portion uv values use fractional part when indexing textures, (0,0), (0,1), (1,0) , (1,1) correspond texture's corners. allowing uv values go beyond 0 , 1 enables "tiling" effect work.

for example, if have rectangle corners indexed uv points (0,0), (0,2), (2,0), (2,2), , assuming texture set tile rectangle, 4 copies of texture drawn on rectangle.

the meaning of uv value's integer part depends on wrapping mode. in opengl, example, there @ least 3 wrapping modes:

  • gl_repeat - integer part ignored , has no meaning. allows textures tile when uv values go beyond 0 , 1.
  • gl_mirrored_repeat - fractional part mirrored if integer part odd.
  • gl_clamp_to_edge - values greater 1 clamped 1, , values less 0 clamped 0.

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -