From 864c2ba12dc864d9cb55cb797ba8919bee5b5913 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 16 Feb 2026 16:32:00 -0800 Subject: Add instancing distance culling, scale deformation * GPU instance distance culling now takes a min/max range * Fold recovers ops from material, allowing state to persist across editor restarts * Add scale node to vertex deformation framework * Remove fold presets - dumb LLM idea, unused * Drop more "undeform" code; unused, was for ray marching, which does not work well * Fix reflection energy compensation; was using cloth math, which makes things too bright --- brdf.cginc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'brdf.cginc') diff --git a/brdf.cginc b/brdf.cginc index 682f6a0..d44ce14 100755 --- a/brdf.cginc +++ b/brdf.cginc @@ -167,12 +167,13 @@ float4 brdf(Pbr pbr, LightData data) { cc_dfg = float3(1, 1, 1); } float cc_Ess = max(cc_dfg.y, 1e-4f); - float cc_energy_comp = 1.0f + cc_f0 * (rcp(cc_Ess) - 1.0f); + //float cc_energy_comp = 1.0f + cc_f0 * (rcp(cc_Ess) - 1.0f); + float cc_energy_comp = 1; #endif float3 f0_color = lerp(f0, pbr.albedo.xyz, pbr.metallic); - float Ess = max(dfg.y, 1e-4f); - float3 energy_comp = 1.0f + f0_color * (rcp(Ess) - 1.0f); + //float3 energy_comp = 1.0f + f0_color * (rcp(dfg.yyy) - 1.0f); + float3 energy_comp = 1.0f; // Direct { @@ -247,18 +248,18 @@ float4 brdf(Pbr pbr, LightData data) { remainder -= Fcl * pbr.cl_strength; #endif - // Standard PBR IBL using split-sum approximation - // Specular lobe + // Standard split-sum IBL float3 f0_spec = lerp(f0, pbr.albedo.xyz, pbr.metallic); + //float3 ibl_specular_reflectance = f0_spec * dfg.x + dfg.y; float3 ibl_specular_reflectance = lerp(dfg.xxx, dfg.yyy, f0_spec); - float3 indirect_specular = data.indirect.specular * ibl_specular_reflectance * energy_comp; - const float3 F = F_Schlick(data.indirect.NoL, f0_spec, f90); - const float3 is_conserved = indirect_specular * F; + //float3 ibl_specular_reflectance = f0_spec * dfg.x; + float3 indirect_specular = data.indirect.specular * ibl_specular_reflectance; + + //return float4(data.indirect.specular, 1); - specular += is_conserved; - remainder = saturate(remainder - is_conserved); + specular += indirect_specular; + remainder = saturate(remainder - indirect_specular); - // 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; } -- cgit v1.2.3