• Create Account

### #Actualszecs

Posted 30 May 2012 - 12:15 AM

I'm a bit sleepy to think it through, but I think you have to recalculate the vertex normals from the triangle normals every time, you can't just append the new triangle normal to an already calculated vertex normal.

Are you try to avoid storing or recalculating all the triangle normals?

Another thing: you should weigh your triangle normals in the vertex normal calculation. Not all triangle normals affect the vertex normal in the same amount. Consider a cube. If you want to smooth shade the cube (I know it's stupid) you know that the vertex normals should point in a 1,1,1 direction for example (I didn't normalize it, but you get the idea). A vertex in a cube is shared by 3 sides, but that means four triangles in some cases. That means a side is represented by 2 triangles at some corners. Without weighing, it will distort the desired result because you add that normal twice.
That's where weighing comes in. I simply weigh by the angle between the incoming edges, I guess there are faster tricks for that.

That said, your pyramid will look distorted anyway, because you smooth sharp edges too. Take a loot at a smooth shaded triangle in any 3d modelling software. It will look something like that.

That's where "smoothing groups" come in. A smoothing group is a group of triangles that should be considered smooth, thus used to calculate the vertex normal. Um,.... this is a different lengthy topic, if you are interested, I'll try to explain more

### #1szecs

Posted 30 May 2012 - 12:13 AM

I'm a bit sleepy to think it through, but I think you have to recalculate the vertex normals from the triangle normals every time, you can't just append the new triangle normal to an already calculated vertex normal.

Are you try to avoid storing or recalculating all the triangle normals?

Another thing: you should weigh your normals in the calculation. Not all triangle normals affect the vertex normal in the same amount. Consider a cube. If you want to smooth shade the cube (I know it's stupid) you know that the vertex normals should point in a 1,1,1 direction (I didn't normalize it, but you get the idea). A vertex in a cube is shared by 3 sides, but that means four triangles in some cases. That means a side is represented by 2 triangles at some corners. Without weighing, it will distort the desired result.
That's where weighing comes in. I simply weigh by the angle between the incoming edges.

That said, your pyramid will look distorted anyway, because you smooth sharp edges too. Take a loot at a smooth shaded triangle in any 3d modelling software. It will look something like that.

That's where "smoothing groups" come in. A smoothing group is a group of triangles that should be considered smooth, thus used to calculate the vertex normal. Um,.... this is a different long topic, if you are interested, I'll try to explain more

PARTNERS