View Full Version : cube maps for nomalisation
01-07-2002, 03:06 PM
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?
01-07-2002, 03:19 PM
You can have a look at the source for the RADEONCombine3SpecMap (http://www.ati.com/na/pages/resource_centre/dev_rel/sdk/RadeonSDK/Html/Samples/OpenGL/RADEONCombine3SpecMap.html) 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.
01-07-2002, 04:20 PM
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. :p
Also, check http://www.nutty.org . 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.
01-08-2002, 03:13 PM
hmm, well actually what i needed was to understand _how_ a cubemap normalises a vector.
Can anyone give me any hints?
01-08-2002, 03:29 PM
Nevermind, I have it figured now, I should have read that ext_cube_map spec before.
Thank you for your replies.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.