Thursday, December 15, 2011

Optimizations and Midmorning Revelations

Something I always forget (and this might be true of most developers) is that stepping away from a problem will usually give you the insight you need to solve it.

I woke up this morning with a very clear idea on how to optimize the shadow mapping code. I say optimize but when the algorithm that previously had to do 250,000,000 calculations now only does 50,000 we are entering territory previously uncharted by Captain Optimization (not a real person).

Besides that huge fix I also stopped using glColor and glVertex to draw quads in favor of using VBOs. Due to quads now begin smoothly shaded, a lot of calls were being done to set the color per vertex and as a result a lot of interpolation calculations needed to be done which bogged down the system. Using VBOs sped everything up immensely and I can honestly say that if you're an aspiring game developer and you don't know how to use them (like me until very recently), you're missing out. Here are some screenshots of the new shading system that can run at a whopping 500fps (or whatever your screen maxes out at).




No comments:

Post a Comment