| Zombie simulator: a new building |
|
| Tuesday, 12 January 2010 20:33 |
|
I spent some time creating a new building mode, of a more modern design than the first warehouse.
I had no end of trouble adding this model to the project. I found that when I tried to render the building in-game, 90% of the geometry was missing. When it first happened I assumed I'd done something to the code, so I spent an dissecting my model optimiser and the drawing routines looking for something I'd done wrong. Eventually I noticed that the b3d loader was reporting that the mesh itself was missing most of the vertices and indices, which made me think it was the exporter plugin for Blender at fault. I finally discovered that it was certain pieces of the building that were causing the problem - the straight wall parts. There's four straight wall pieces and four corners in the building, and what was happening was that any model pieces following a straight wall bit were coming out of the b3d exporter garbled. Recreating the straight wall pieces and deleting the faulty ones fixed the problem. I'm not sure whether the fault was with the b3d exporter, or Blender itself, but it's gone now and I hope it stays that way. When I first imported the final building model, the lack of even basic lighting made it look flat. I went back to the drawing board and decided to re-use my vertex colour lighting idea for something else, and instead I've opted to use actual lights to give the buildings some depth. At first I tried out spot lights, but I simply was unable to find a way of lighting even a large part of the visible scene because the spot light's area of affect was too small when close to the ground, and too faint when far up in the air. In the end I settled for using three directional lights. Two are used to represent the sun from roughly the same direction because a single directional light appeared too dim even at maximum brightness and the third is a dull blue light shining in the opposite direction to lighten the walls in shadow. I've set the ambient levels for all three lights to zero to give the shadows more definition. I don't know if I'm happy with this setup yet. Once I get more of the graphics into the engine, I'll have a better idea if this is good enough. I also re-rendered the sprites using this lighting setup and they've gone too dark, so I'll probably need a dedicated spotlight for them. blog comments powered by Disqus |

