4
\$\begingroup\$

I've been trying to replicate the result of this paper (linked directly to PDF paper, but you don't need to read it to give an answer) and encountered a problem with the BRDF according to the following well-known formula:

enter image description here

where F,G,D are Fresnel reflection, Shadow masking, and microfacet distribution respectively. The trouble I encounter is in the denominator, where i is the incident ray, n is the surface normal, and o is the angle of view.

Just by looking at the formula, probably you can already guess what happen when the ray comes from grazing angle: |in| approach zero, and if I look at it also at grazing angle then |on| would also approach zero. And as much as I hoped that FGD would approach zero faster than the denominator, it doesn't. (I used GGX distribution, but the same thing happen to Beckmann or Phong) The resulting BRDF I calculated is something completely different from not only the paper that I'm trying to replicate, but also from most other BRDF.

enter image description here

(strong peak at grazing angle, I did it for refraction case but it's the same for reflection)

enter image description here

(result from the paper, most brdf have this shape)

I double checked D,F and G so it can't be any of those, but then what went wrong? Has anyone tried this BRDF model and encountered a similar problem?

\$\endgroup\$
  • 1
    \$\begingroup\$ The G factor specifically is (or should be) taking care of this - the whole factor G / ((i . n)(o . n)) should go to zero at grazing angles. Can you post the G you're using? \$\endgroup\$ – Nathan Reed Jul 26 '13 at 17:13
  • \$\begingroup\$ Thanks Nathan, I also noticed that the peak values from my data is different from the paper, which means one of the coefficient is wrong, but still I couldn't find out where the problem is. The G factor I implemented in Matlab is the one derived for GGX distribution taken from the paper: G=2*Chi/(1+sqrt(1+(alphaG^2)*(tan(ThetaI))^2)); i.imgur.com/rBiDt2y.png I've plotted the function and G/((i.n)(o.n)) for fixed o at 85 degree (for m.n > 0, Chi=1). The paper could also be wrong but it's hardly the case as it's quite popular and many people used GGX distribution already. \$\endgroup\$ – Nhan Nguyen Jul 29 '13 at 9:07
  • \$\begingroup\$ Perhaps the graphs in the paper incorporate the N.L factor that multiplies the BRDF in the radiometric integral? That is not technically part of the BRDF but it's necessary to keep things from blowing up at the grazing angles. \$\endgroup\$ – Nathan Reed Oct 9 '13 at 17:10
1
\$\begingroup\$

The thing is you encounter a 0/0 problem. When the denominator goes to 0, the G goes to 0 too. 0/0 condition is what we have to avoid in program, so check G formula of GGX and you'll find the denominator (i.n)(o.n) can be factor out.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.