Sunday, May 15, 2011

Progress and Learning!

Today I learned how to use tangent and binormal vectors plus a custom shader to implement normal maps.

I also began work on basic rendering of my maze data in three dimensions.  It's a bit tedious; I've taken the path of generating vertex data dynamically and that means a lot of lines of creating new vertices.  Basically, imagine that a maze is made up of four-walled cells (as visible in the video a few posts back).  If each of four walls can either be open or walled, there are sixteen total possible combinations.  That means sixteen different sets of 32 dynamically-generated vertices (give or take), for a total of 512 hard-coded vertex coordinates.

Now of course, there's a lot of duplication.  I can, for example, generate vertices for a cell with one wall, then rotate it to generate the other three one-wall cells.  Same applies for a cell with two and three neighboring walls. Then there's two parallel walls, which only has two unique forms.  So that cuts down on some of the trouble.  Nevertheless, it remains tedious.  I'll be glad when that part is done.

At any rate, I certainly came away from today's coding with a sense of accomplishment -- normal maps work, and the 3D cells I have completed look awesome on screen.  Maybe some pictures when I get all the cells defined.

No comments:

Post a Comment