Archived

This topic is now archived and is closed to further replies.

Unreal

How I calculate teh s/t coords after I split a polygon?

Recommended Posts

hello!! i push a list of polygons(triangles or quads) in the bsp with the U and V (or s and t) be known. while building the bsp some polygons are splitting. how i can calculate the new U/V(or s/t) Cordinates of the new polygons?

Share this post


Link to post
Share on other sites
would this work:

assume the edge (ab) of your face is split at vertex c:
a--------------b becomes: a-------c------b


get the length of the edge you just split (ab)
get the length of the new vertex to a (ac)
get ratio (ac) over (ab)
get length of (a.uv) to (b.uv)
2dLen = mult this length by ratio
get normalized vector from (a.uv) to (b.uv)
mult 2dLen by normalized vector from (a.uv) to (b.uv)
add this vector to a.uv


I think this should work, i''ve never tried it but it seems simple enough.

Share this post


Link to post
Share on other sites
You should be able to just linearly interpolate the texture coordinates. If I''m not mistaken, if you have a Vector2 class with all the standard operators, you should be able to do the same math with the texture coordinates that you did with your regular vertices, and get the right results.

Share this post


Link to post
Share on other sites