## Re: [Algorithms] Generating uv coordinates which follow a shape

 Re: [Algorithms] Generating uv coordinates which follow a shape From: Chris Green - 2004-04-30 11:52:53 ```What you are trying to do here is very similar to cloth simulation (except that you are trying to preserve length in texture space instead of world space). You could try the technique from this url: http://www.ioi.dk/Homepages/thomasj/publications/gdc2001.htm. The ease of implementation definitely makes it worth a try. Joris Mans wrote: >Hi > >I ve been fiddling with this for some days, but don't seem to come up >with a "general" solution. >The problem is the following: >Assume a planar mesh. I want to define uvs over that mesh in the >following way. I have 4 corner vertices on the mesh which will contain >mapping coords 0,0 1,0 1,1 0,1. The uvs on the border of the mesh are >calculated by iterating over the border and using the piecewise distance >of each line segment to define the interpolated values: > >Mapping[ k ] > = Mapping[ corner_index ] > + ( Mapping[ next_corner_index ] - Mapping[ corner_index >] ) > * ( distance(corner_index,k) / >distance(corner_index,next_corner_index) > >Whereby distance just sums up all the edge lengths from one vertex upto >another, following the border of the mesh. > >Now this was the easy part, the hard part is assigning the uvs to the >non-border vertices. And this is where I am getting stuck. The problem >is that the internal uvs should follow as good as possible, to minimize >distortion issues. I ve been trying by using a mass-spring system on the >mapping coordinates, and fixing the border verts so they cant move, but >getting a good configuration to start the simulation is already a >problem, coz you need to choose start positions for the internal >vertices, spring rest lengths and so on. >I tried several "project internal vertices on borders and interpolate" >approaches, but for all of those its quite easy to find a case where it >breaks down. > >Here you see an example of what I want to achieve: > >http://users.pandora.be/ir_fuel/face_mapping_problem.jpg > > >Oh, and I tried asking the artist to use Nurbs, which would give me a >nice parametrization to define the mapping, but that doesn't seem to be >the solution he is looking for ;) ;) > > >Joris > > > >------------------------------------------------------- >This SF.Net email is sponsored by: Oracle 10g >Get certified on the hottest thing ever to hit the market... Oracle 10g. >Take an Oracle 10g class now, and we'll give you the exam FREE. >http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click >_______________________________________________ >GDAlgorithms-list mailing list >GDAlgorithms-list@... >https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >Archives: >http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > > > ```