Jump to content

  • Log In with Google      Sign In   
  • Create Account


Ashikhmin-Shirley lightning model


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Lambo   Members   -  Reputation: 100

Like
0Likes
Like

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: Posted Image. 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:

#2 Tasty Texel   Members   -  Reputation: 1267

Like
0Likes
Like

Posted 02 April 2012 - 04:20 PM

1000 is usually not too big for an exponent, so your mistake must be somewhere else located.
Best is you post your source code to make it easier to hunt down the prob.

#3 Bacterius   Crossbones+   -  Reputation: 8667

Like
0Likes
Like

Posted 03 April 2012 - 03:40 AM

I.m having problems with dot(n, h) exponent, because its numeric value is to big

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.
Are you sure your vectors are normalized?

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#4 jischneider   Members   -  Reputation: 252

Like
1Likes
Like

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!!!

Project page: < XNA FINAL Engine >


#5 Lambo   Members   -  Reputation: 100

Like
0Likes
Like

Posted 05 April 2012 - 01:37 PM

Thanks guys! It simply was not normalized view vector, so my half vector was wrong... Paniced because if exponent would be 10000, base should not be smaller than 0.9913 or else outcome could not be expressed in sp float.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS