Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
vec2 DFG_Cloth(float roughness, float NoV) {
const vec4 c0 = vec4(0.24, 0.93, 0.01, 0.20);
const vec4 c1 = vec4(2.00, -1.30, 0.40, 0.03);
float s = 1.0 - NoV;
float e = s - c0.y;
float g = c0.x * exp2(-(e * e) / (2.0 * c0.z)) + s * c0.w;
float n = roughness * c1.x + c1.y;
float r = max(1.0 - n * n, c1.z) * g;
return vec2(r, r * c1.w);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment