Monday, May 23, 2011

Normal tricks

I just spent some time rewriting the model loader. Old one was originally done to a software rasterizer and did not handle per vertex normals correctly. Now that I *finally* rewrote it, I can remove quite a lot of code that just sit there because of dependency reasons with the old SW engine :) Now mesh can have 2 modes, one with face normals that make the object look a bit like a sculpted wooden statue and another mode with per vertex normals that implement Blinn-Phong 'correctly'.

Wood statue :

For wood statue each vertex in a face gets the face normal, so each vertex normal points to the same direction.

Blinn-Phong :



For Blinn-Phong each vertex normal is the normalized sum of normals of all adjacent faces to the vertex.

No comments: