diff options
| author | yum <yum.food.vr@gmail.com> | 2025-08-08 19:28:27 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-08-08 19:28:30 -0700 |
| commit | 42dbd067eb455d4b67d6ae8c57f1cbe4ec7dccfa (patch) | |
| tree | 7f1ae4fe3b2c921bf38c7f2f6689cbc05180f3f3 /brdf.cginc | |
| parent | 7cdf39f51b47553af89c3de5b86d33ded4b5cdd2 (diff) | |
Optimize sh9 implementation
Saves ~20 instructions (572 -> 552).
Diffstat (limited to 'brdf.cginc')
| -rw-r--r-- | brdf.cginc | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -55,6 +55,7 @@ float G_GGXSmith(float roughness, float NoL, float NoV) { return rcp(denom); } +#if defined(_CLOTH_SHEEN) // Estevez "Production Friendly Microfacet Sheen BRDF" // Equation 2. // The original equation is: @@ -113,6 +114,7 @@ float G_Cloth(float roughness, float LoH) { // Apply terminator softening (equation 4). return pow(lambda, 1.0f + 2.0f * pow(one_minus_LoH, 8)); } +#endif float4 brdf(Pbr pbr, LightData data) { float3 specular = 0; @@ -134,7 +136,7 @@ float4 brdf(Pbr pbr, LightData data) { #endif // Direct - if (true) { + { float remainder = 1.0f; #if defined(_CLEARCOAT) @@ -180,7 +182,7 @@ float4 brdf(Pbr pbr, LightData data) { // Indirect #if defined(FORWARD_BASE_PASS) - if (true) { + { float remainder = 1.0f; float2 dfg_uv = float2(data.common.NoV, pbr.roughness); @@ -212,7 +214,7 @@ float4 brdf(Pbr pbr, LightData data) { // For energy conservation with the diffuse term, we use the view-dependent Fresnel. float3 F = F_Schlick(data.common.NoV, f0_spec, 1.0f); remainder *= (1.0f - F); - + // Diffuse is Lambertian, which is pre-integrated into the SH diffuse probe float3 indirect_diffuse = pbr.albedo.xyz * data.indirect.diffuse * remainder * (1.0 - pbr.metallic); diffuse += indirect_diffuse; |
