Skip to content

Instantly share code, notes, and snippets.

@wuyakuma
Created January 5, 2018 03:18
Show Gist options
  • Save wuyakuma/e5d50d7a1a10ae545286eec4c4ab6adf to your computer and use it in GitHub Desktop.
Save wuyakuma/e5d50d7a1a10ae545286eec4c4ab6adf to your computer and use it in GitHub Desktop.
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