Normalization cubemap performance

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?

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.

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
with a 128 cubemap
with a 512 cubemap

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? :slight_smile:

I believe this paper might help you decide when to use normalisation cubemaps

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

wizzo

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
wizzo

Thx 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…

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?

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. :slight_smile:

Thanks for clearing that up.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.