Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. float MixFunction(float i, float j, float x)
  2. {
  3. return j * x + i * (1.0 - x);
  4. }
  5.  
  6. float SchlickFresnel(float i)
  7. {
  8. float x = clamp(1.0-i, 0.0, 1.0);
  9. float x2 = x*x;
  10. return x2*x2*x;
  11. }
  12.  
  13. //normal incidence reflection calculation
  14. float F0 (float NdotL, float NdotV, float LdotH, float roughness)
  15. {
  16. float FresnelLight = SchlickFresnel(NdotL);
  17. float FresnelView = SchlickFresnel(NdotV);
  18. float FresnelDiffuse90 = 0.5 + 2.0 * LdotH*LdotH * roughness;
  19. return MixFunction(1, FresnelDiffuse90, FresnelLight) * MixFunction(1, FresnelDiffuse90, FresnelView);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement