Advertisement
Guest User

beckmann

a guest
Nov 3rd, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. /* Get the half angle vector (microfacet normal) */
  2. H = normalize(exitant - incident);
  3.  
  4. /* Get all the dot products. */
  5. float NdV = abs(incident * normal);
  6. float NdL = abs(normal * exitant);
  7. float VdH = abs(incident * H);
  8. float NdH = abs(normal * H);
  9.  
  10. /* Get the half angle vector's angle with the normal. */
  11. float alpha = acos(H * normal);
  12.  
  13. /* Compute the Beckmann distribution term. */
  14. D = exp(-pow(tan(alpha) / this->roughness, 2));
  15.  
  16. /* Normalize the Beckmann distribution. */
  17. D = D / (PI * pow(this->roughness, 2) * pow(NdH, 4));
  18.  
  19. /* Compute the geometric attenuation term. */
  20. float G = min(1, min(2 * NdH * NdV / VdH, 2 * NdH * NdL / VdH));
  21.  
  22. /* ... */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement