As a test, i've createad a floor, like 100x100 pixels. So i put a texture 10x10 (exemple). Running this test the texture stretches. There is a way to not to do this with the image? I like to fill the poligon repeating the texture inside. Can it be?
thanks!
Stretched textures :o(
-
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
-
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
UV coordinates are coordinates of mesh wertices. Vertex have x/y/z coordinates in model space and U/V coordinates in texture space. Top left corner of your texture have coordinates U=0, V=0 and bottom right corner have coordinate U=1, V=1 where U is horizontal and V vertical coordinate.
Lets take example:
you have square plane mesh consisting of 4 vertices with coordinates:
v1. -x0,y0,z0
v2. -x1,y0,z0
v3. -x1,y1,z0
v4. -x0,y1,z0
(this is what makePlanarTextureMapping do by default I think)
you want texture to be maped on that square ...one texture for square:
v1. -u0, v1
v2. -u1, v1
v3. -u1, v0
v4. -u0, v0
(pleas note that UV is dependles on texture pixel size if texture is 128/256 pixels big than 1U=128 pixels and 1V=256 pixels)
if you want your texture to be mapped (repeated) 4 times verticaly and 4 times horizontaly ...means 4*4=16 texture tilles:
v1. -u0, v4
v2. -u4, v4
v3. -u4, v0
v4. -u0, v0
if you want only left half of your texture to be maped on your square:
v1. -u0, v1
v2. -u0.5, v1
v3. -u0.5, v0
v4. -u0, v0
if it is not giving you sense, draw it down at a piece of paper. Just remember UV starts in upper left corner, just like your screen and unlike model space.
U and V can have negative values as well, then texture will be fliped.
Hope this helps.
Lets take example:
you have square plane mesh consisting of 4 vertices with coordinates:
v1. -x0,y0,z0
v2. -x1,y0,z0
v3. -x1,y1,z0
v4. -x0,y1,z0
(this is what makePlanarTextureMapping do by default I think)
you want texture to be maped on that square ...one texture for square:
v1. -u0, v1
v2. -u1, v1
v3. -u1, v0
v4. -u0, v0
(pleas note that UV is dependles on texture pixel size if texture is 128/256 pixels big than 1U=128 pixels and 1V=256 pixels)
if you want your texture to be mapped (repeated) 4 times verticaly and 4 times horizontaly ...means 4*4=16 texture tilles:
v1. -u0, v4
v2. -u4, v4
v3. -u4, v0
v4. -u0, v0
if you want only left half of your texture to be maped on your square:
v1. -u0, v1
v2. -u0.5, v1
v3. -u0.5, v0
v4. -u0, v0
if it is not giving you sense, draw it down at a piece of paper. Just remember UV starts in upper left corner, just like your screen and unlike model space.
U and V can have negative values as well, then texture will be fliped.
Hope this helps.
Hey knight, now u mention the exemple 8 i'd notice the textures are fine, so i made the universal copy/paste method end a got textures well fited.
Arras, thanks for the uv classes , but the best part was the last line, ...then the texture will be flipped...Thats somethig im searching about, and almost become my next topic.
Thank you guys for the patience.
Arras, thanks for the uv classes , but the best part was the last line, ...then the texture will be flipped...Thats somethig im searching about, and almost become my next topic.
Thank you guys for the patience.