BRDF_GGX top-level property
dynamic
BRDF_GGX
getter/setter pair
Implementation
var BRDF_GGX = ShaderNode((inputs) {
var lightDirection = inputs.lightDirection;
var f0 = inputs.f0;
var f90 = inputs.f90;
var roughness = inputs.roughness;
var alpha = pow2(roughness); // UE4's roughness
var halfDir = normalize(add(lightDirection, positionViewDirection));
var dotNL = saturate(dot(transformedNormalView, lightDirection));
var dotNV = saturate(dot(transformedNormalView, positionViewDirection));
var dotNH = saturate(dot(transformedNormalView, halfDir));
var dotVH = saturate(dot(positionViewDirection, halfDir));
var F = F_Schlick({f0, f90, dotVH});
var V = V_GGX_SmithCorrelated({alpha, dotNL, dotNV});
var D = D_GGX({alpha, dotNH});
return mul(F, mul(V, D));
});