Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vec3 HammonEarlGgxDiffuseApprox(in DisneyMaterial mat, in vec3 wm, in vec3 wo, in vec3 wi)
- {
- float NoV = CosTheta(wo);
- float NoL = CosTheta(wi);
- if (NoV <= 0.0 || NoL <= 0.0) return vec3(0);
- float NoH = CosTheta(wm);
- float VoL = dot(wo, wi);
- float alpha = mat.roughness * mat.roughness;
- float facing = 0.5 + 0.5 * VoL;
- float roughy = facing * (0.9 - 0.4 * facing) * (0.5 + NoH)/NoH;
- float smoothy = 1.05 * (1.0 - pow(1.0 - NoL, 5.0)) * (1.0 - pow(1.0 - NoV, 5.0));
- float single = INV_PI * mix(smoothy, roughy, alpha);
- float multi = alpha * 0.1159;
- return mat.albedo * (single + mat.albedo * multi);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement