Trees, Model loading, Normal Mapping, Gamma Correction and Much More!

Relative big update again and beta 20. Visually I still hate how simple everything looks compared to nicer 3D engines that are out there. I still think the ultimate goal is to get ibex in a AAA engine, but till then I will keep playing with my own. Lots to learn about.

First a relatively pretty picture showing off the new features: model loading of a tree that I scatter 500 of around the terrain, gamma correction, shadow mapping, normal (bump) mapping so that the ground isn’t so smooth anymore, caustics under the water and reflection of the skybox in the water.

Ibex OpenGL 3.3+ for the Mac caustics, normal mapping, shadow mapping, gamma correction and model loading using Assimp!

What I’ve done this time is added support for the following, though much needs cleaning up and fixing:

  • Normal mapping: this is used on the terrain so that the textures are bump-mapped and not just flat. It gives the grass and stone a bit more of a 3D look as the light bounces off of it.
  • Model loading using Assimp based on the tutorial from Lighthouse3D on model loading using Assimp. This is really cool because it opens up a whole world of 3DS and Collada files for loading. For now I only load up a tree but in the future I’ll see if I can’t get more interesting things loaded up. The model leading needs much more cleaning up but once it is done I can start adding collision detection, frustum culling so that we don’t render more models than we need and Octree support both for culling, collision detection, and possibly for occlusion mapping.
  • Fixed up the directional lighting and normal generating for the terrain. Not 100% certain that it works but it looks decent for now.
  • Shadow mapping was updated to include the trees. I’ve also figured out an amusing bug in that if your light is very steep then the shadows will “bleed” through the hills to the other side. I couldn’t figure out why my shadows weren’t just hitting the first surface. I guess this makes sense and if I were shadowmapping the terrain it would probably work correctly. It should be interesting dealing with lighting once we have buildings and indoors to deal with. I also took an opportunity to ensure that ambient lighting truly is as dark as it gets, previously I was multiplying it by the shadow pass but that isn’t quite right.
  • Gamma correction: as mentioned in this article by Larry Gitz and Eugene d’Eon - The Importance of Being Linear. This basically corrects for the fact that our monitors and displays have a non-linear response to brightness and so we need to correct our results so that we don’t end up with the middle of our range looking either too dark or too bright, but rather a smooth continuum as expected. I had ro use GL_SRGB on the final framebuffer that was used for displaying to the screen to hopefully get the effect right.