. I.m having problems with dot(n, h) exponent, because its numeric value is to big. Right now I think there is a problem with equation or my interpretation: according to the document Nu and Nv are freely chosen constants and can be equal, so if we chose Nu=Nv, exponent is equal to Nv whose value can range 1000, with is obviously to big and returns NaN in pow() function. Maybe someone can pinpoint my mistake?
4 replies to this topic
#1 Members - Reputation: 100
Posted 02 April 2012 - 08:42 AM
Hi, I'm trying to implement an anisotropic Phong BRDF lightning model http://www.cs.utah.e...dfs/jgtbrdf.pdf. Where specular component is defined as:
. I.m having problems with dot(n, h) exponent, because its numeric value is to big. Right now I think there is a problem with equation or my interpretation: according to the document Nu and Nv are freely chosen constants and can be equal, so if we chose Nu=Nv, exponent is equal to Nv whose value can range 1000, with is obviously to big and returns NaN in pow() function. Maybe someone can pinpoint my mistake?
. I.m having problems with dot(n, h) exponent, because its numeric value is to big. Right now I think there is a problem with equation or my interpretation: according to the document Nu and Nv are freely chosen constants and can be equal, so if we chose Nu=Nv, exponent is equal to Nv whose value can range 1000, with is obviously to big and returns NaN in pow() function. Maybe someone can pinpoint my mistake?
Sponsor:
#3 Crossbones+ - Reputation: 3595
Posted 03 April 2012 - 03:40 AM
This worries me. If your n and h are normalized, then dot(n, h) is in the range [-1,+1] so what you describe shouldn't happen.I.m having problems with dot(n, h) exponent, because its numeric value is to big
Are you sure your vectors are normalized?
#4 Members - Reputation: 252
Posted 03 April 2012 - 08:06 AM
Why not isolate the different parts of the equation?
Also, the pow function does not work with values below or equal 0 because the implementation is done with the equation exp(log(value) * value). Try to put something like this: max(dot(…), 0.0001f);
Good luck!!!
Also, the pow function does not work with values below or equal 0 because the implementation is done with the equation exp(log(value) * value). Try to put something like this: max(dot(…), 0.0001f);
Good luck!!!
Project page: < XNA FINAL Engine >







