PDA

View Full Version : Normalization cubemap performance..



gulgi
12-31-2004, 03:43 PM
I've finally got per-pixel-lighting working as it should, and I've got it to be quite fast as well (or so I hope ;]).
Using a texture instead of pow for specular helped and using a normalization cubemap to normalize the "light direction" vector helped alot. But when I try to normalize the half-angle vector with the cubemap, the quality drops dramatically.

Does anyone has an explanation of this, or am I doing anything wrong?

harsman
01-01-2005, 08:40 AM
Exactly what does it look like when the quality drops, banding in the specular highlights? It's hard to tell without seeing a screenshot, but if your cube map is too small, you'll get banding since you'll start seeing the finite number of normalised vectors available in your map. Of course, it might just be some other precision issue that is accentuated by the longer unit lenght normals causing brighter high lights.

gulgi
01-01-2005, 08:57 AM
Originally posted by harsman:
Exactly what does it look like when the quality drops, banding in the specular highlights? It's hard to tell without seeing a screenshot, but if your cube map is too small, you'll get banding since you'll start seeing the finite number of normalised vectors available in your map. Of course, it might just be some other precision issue that is accentuated by the longer unit lenght normals causing brighter high lights.This is how it looks.
with normalize (http://gulgi.doesntexist.com/tmp/normalize.jpg)
with a 128 cubemap (http://gulgi.doesntexist.com/tmp/cubemap.jpg)
with a 512 cubemap (http://gulgi.doesntexist.com/tmp/cubemap512.jpg)

In both cases the same cubemap is used to normalize the light-direction-vector. Using normalize for the light-dir doesn't change quality at all.

I don't understand why it works for the light_dir and not for the half_angle...

OT: harsman: Var ett tag sedan vi spelade schack med ai-agenter nu.. ;] Gjort något skoj sedan dess? :)

wizzo
01-01-2005, 09:58 AM
I believe this paper might help you decide when to use normalisation cubemaps

http://developer.nvidia.com/object/normalization_heuristics.html

wizzo

gulgi
01-01-2005, 10:48 AM
Originally posted by wizzo:
I believe this paper might help you decide when to use normalisation cubemaps
http://developer.nvidia.com/object/normalization_heuristics.html
wizzoThx for the link.. I've seen that demo and played around with it a bit.
What it doesn't explain the loss of quality when normalizing the half-angle (and not when normalizing the light_dir) with a cubemap. Maby I just need to read more math or something.

In that demo, I see no bad quality from using a cubemap to normalize the half-angle, but that demo doesn't have flat shiny surfaces either..

Humus
01-01-2005, 10:53 AM
Using normalizing cubemap works fine usually for diffuse lighting, but for specular lighting I'd use math instead since the power function will make the error quite a lot more visible. It shouldn't be quite that bad though, maybe you're using a very high specular exponent?

gulgi
01-01-2005, 12:08 PM
Originally posted by Humus:
Using normalizing cubemap works fine usually for diffuse lighting, but for specular lighting I'd use math instead since the power function will make the error quite a lot more visible. It shouldn't be quite that bad though, maybe you're using a very high specular exponent?Ahh.. didn't think of the pow increasing the error. And yes, I use a quite high exponent.
Math it is. :)

Thanks for clearing that up.