Used some time to implement a GLSL shader that handles Dynamic Cube Mapping.
I’m using a FBO to render the scene to a CubeMap texture, and then a shader maps the CubeMap as a texture on whatever comes trough the shader.
The shader combines the CubeMap, a Color Map and a Normal Map in order to create the final output.
The shader takes a reflection parameter( float ) that is used to lerp between the colormap and the reflection map.
The vertex shader:
vView =vec3( vEye – (gl_ModelViewMatrix * gl_Vertex));
The pixel shader:
vec3 norm = texture2D(NormalMap, texCoords.st);
norm = (norm * 2.0) – 1.0;
vReflection = reflect(vView, norm);
gl_FragColor = lerp(textureCube(CubeMap, vReflection), texture2D(ColorMap,texCoords.st),r);
norm = (norm * 2.0) – 1.0;
vReflection = reflect(vView, norm);
gl_FragColor = lerp(textureCube(CubeMap, vReflection), texture2D(ColorMap,texCoords.st),r);
Next im going to implement a few light algorithms so the Color Map looks more real.