Since last time, I believe I have the level errors ironed out. One of them was funny to me, what I thought were missing polygons were just rendering black – turning on some ambient light fixed that one.
I found out that the .obj exporter source that comes with Maya isn’t really the same as the binary that does. Changed the level importer to work on .obj files (from the binary exporter) and also process my custom export, to grab lights and entities, anything else besides geometry. In doing so, ported it back to C++ and made it a standalone utility, when inside the XNA game, it took much longer to process. This also seems to make a difference with legitimate geometry by using “real” .obj files – at least, it handles grouping/parenting better than the .obj export sample code. Have been adding stuff to a new level regularly, and have yet to cause any splitter or portal exceptions.
The level rendering now groups polygons by texture, to minimize state changes. It also uses deferred rendering, following http://www.catalinzima.com/tutorials/deferred-rendering-in-xna/. I took the path of eliminating garbage generation following http://blogs.msdn.com/b/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx. Getting within 16.67ms per frame on the Xbox.
Just this week, managed to figure out a drop shadow for the player and other non-level objects, using Matrix.CreateShadow. This was a great deal, since I had to finally correctly figure out where the ground was (helps to prevent jumping from in-air, and I’m sure other applications will arise) and found a couple good algorithms – testing for a ray/plane intersection being inside or outside a polygon on the plane (http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm) and finding a best-fit plane from a polygon in normal-distance form (http://cs.haifa.ac.il/~gordon/plane.pdf).
Until next time, top three todo items are
- look into background/environmental content & rendering techniques
- fix up collision detection – when caught in an acute angle, still slipping through
- get loading/saving working on Xbox