Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Spline based road geometry UV mapping

$
0
0
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

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>