First off, I need to mention I haven’t started writing this shader yet; I’m brainstorming. I have written normalmap perpixel lighting in GLSL, and I have just finished a working non-bumpmapped environment map shader for diffuse lighting and pseudo-reflections.
So, basically, I want to be able to perturb cubemap lookup by the normal map texture lookup, and I’m hitting a wall mentally.
In my normal map lighting shaders I – and as far as I can tell this is the de-facto approach – convert the light vector and eye vector to tangent space in the vertex shader, and simply perturb those by the normal map in the fragment shader. Easy-peasy.
But my environment mapping shader acts in “world” space; computing the fragment location and eye vector in world space ( via passed in model matrix uniform ). I obviously can’t just perturb that by the normal map.
I’ve googled ( a lot! ) and haven’t had any luck. 99% of what I find is tex-combining dot3 stuff from the fixed-function days, and the rest is asm for DX, which I don’t grok. And I’ve found no “high level” algorithm descriptions to help me out. If anybody can give me an idea of how to approach this, or even some sample code, I’d be greatly in your debt.