Hi,
Im working on a procedural road system and I use bezier splines to genereate the mesh ( tri strip ) but I have a problem with calculating proper uv coordinates. The texture looks distorted on curved segments like on the attached picture
When calculating uv i first init them to ( 0.0f, 0.0f ) or ( 0.0f, 1.0f ) for each vertex, and then add the distance between current and previous point on a curve to the previous vert U coord ( V stays the same ). Something like this:
float dist = ( pos - prevPos ).Magnitude();
float lenScale = roadWidth / m_uvStretch;
dist /= lenScale;
verts[ currVertIndex ].uv.X = outVerts[ currVertIndex - 1 ].uv.X + dist;
What am I missing?
Thanks
↧