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.

Saturday, May 14, 2011

Light scattering

I got bored with the engine and decided to just play with effects for now. Here is real time light scattering, like explained in in Fabien Sanglard's blog. I plan to mix this with the earlier bloom shader and see if the thing still runs 60fps. It seems Acer laptop did not like light scattering though, both CPU and GPU temperature peaked very high and my laptop powered off itself, maybe some optimizations needed, eh :)

Tuesday, May 03, 2011

Hairy Balls!


I started to try out a bit more experimental things and implemented sort of a grass effect by abusing the normal data and drawing some GL_LINES per vertex. Looks nice, needs some more touch though ... more on that hopefully later.