Jump to content
  • Advertisement


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


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

This topic is 5174 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!