Sign in to follow this  

Splitting polygons, problem with normals

This topic is 4684 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

Hi I'm building BSP tree out of level geometry which requires splitting polygons. the split poly algorithm works, but with incorrect normals when new vertices are created, I used couple of methods to calculate the new vertex normal : - n = (v1.n + v2.n)/2 -> bad lighting - n = faceNormal -> bad lighting - n = interpolation of two normals -> better lighting, but still have problems anyone knows the correct way of splitting a polygon that I can have correct normals ? thanks

Share this post


Link to post
Share on other sites
Taking it one step further, interpolation should work, as long as you normalize the result so the normal is of unit size again.

Something like this should do the trick:

n = v1.n + ( T * ( v2.n - v1.n ) );
n.Normalize();

where:
if T = 0, split is at v1
if T = 1, split is at v2
if ( T > 0 ) & ( T < 1 ) split is inbetween v1 and v2.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Wouldn't you just calculate the vertex normal from the adjacent faces like you'd normally would do? (i.e. the average of the face normals of all faces adjacent to the new vertex).

Share this post


Link to post
Share on other sites
thanks
but I've just tried all of these three methods that as you guys mentioned. but none of them get me satisfactory results. while recalculating normals out of adjucent faces, makes better results.
I have addressed the linkt to my test application that draws a bsp scene with normals and three lights, as you can see there are problems with lighting with each method.

there are 3 BSP files that is built with each method, before running the demo, rename each BSP file into World3.bsp to test it.

here is the link : http://www.geocities.com/seppehrt/bsploader.zip

Share this post


Link to post
Share on other sites
I fixed the problem, thanks to you guys for your help, the third method works perfectly. but at first I implemented it a little wrong.

in splitting polys, each time a plane hits an edge I added a vertex, so multiple vertices with the same positions were born on adjucent faces, and that raised problems with calculating normals.

so with the new fixes, it now adds fewer vertices, but takes some more time, and the normals are correct.
download the link : http://www.geocities.com/seppehrt/world3_correct.zip , and rename the bsp file to "world3.bsp" as you can see the lighting is correct.

and forget about inerpolation or average technics between two normals, they won't work.
thanks

Share this post


Link to post
Share on other sites

This topic is 4684 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this