April 6, 2012

BGE Candy status update 01

It has been a busy week with real life stuff, so I am not progressing very fast.

Last 2 days I have been working on environment reflection mapping coordinates. Blender currently have only view-space reflection coords reflect(viewvec,viewnormal);  and of course that is not nearly enough for a proper IBL (Image Based Lighting) setup.

So first I implemented world space reflection coordinates so the environment texture is world oriented.
Then I have implemented 2 most widely used mapping algorithms - "Angular" or "Sphere" mapping and "Equirectangular" or "Spherical Panorama" mapping but sometimes also called "Blinn/Newell Latitude-Longitude" mapping.
The third and most widely used one - "Cube mapping" should be already possible as a built-in function in OpenGL, but I have to figure out how to make it work in BGE.

Same mapping techniques can be applied not only on "Reflection" coordinates, but also on "Object" and "Normal" coordinates, which means that besides doing reflection and specular reflection, the environment mapping can also be used for texturing the object or doing image-based diffuse lighting.

these are the 3 environment map textures:

"sphere" or "angular" map

"equirectangular" or "spherical panorama" or "Blinn/Newell latitude-longitude" map

"cube" map

All 3 of them does the same job, but with different results. I found a nice article about all three of env-map approaches explained in detail HERE

I'm going to vacation for 2 weeks, so no BGE Candies till then..