# 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.

## 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 on other sites
My guess is this:

Change

Quote:
 n = (v1.n + v2.n)/2 -> bad lighting

to

n = v1.n * (1-f) + v2.n * f

where f is the fraction where the split occurs between v1 and v2

##### 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 on other sites
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 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.

##### 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 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.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628707
• Total Posts
2984313

• 23
• 11
• 9
• 13
• 14