cube maps for nomalisation

Trying to figure out how to do some per-pixel stuff, I am now stuck at the cube maps for normalisation.

It is clear to me what the purpose is, but:

  • how does it work? I really hate not understanding it… some hints would be nice
  • how do i generate it?
  • will one be enough, or will i need more?

You can have a look at the source for the RADEONCombine3SpecMap sample for code to generate and use a normalizing cube map. Look for the function generateCubemap(). You should only need one of these in your application, though you may reference it multiple times in a given fragment shader.


You can also find it in one of the NVIDIA glh headers. I think it is in glh_cubemap.h. Thats the one i use, but what i did was copy and paste just the normalcubemap part in my own code and modified it for me. The main thing i had to do was make my own function to convert a normal vector from [-1,1] to an RGB value of [0,255]. For some reason i couldnt find that function in that glh header so thats why i made my own. :stuck_out_tongue:

Also, check . He has a per pixel lighting demo (for geforce cards) that uses one of these cubemaps. Its a great demo to get started on this kind of thing.


hmm, well actually what i needed was to understand how a cubemap normalises a vector.

Can anyone give me any hints?

Nevermind, I have it figured now, I should have read that ext_cube_map spec before.

Thank you for your replies.