diff options
| author | yum <yum.food.vr@gmail.com> | 2026-02-16 16:32:00 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-02-16 16:36:24 -0800 |
| commit | 864c2ba12dc864d9cb55cb797ba8919bee5b5913 (patch) | |
| tree | aa6cd98a71e4ef05d23f762127d3759a4a3e3e21 /brdf.cginc | |
| parent | 6504b2c4631bab477838548167b88c1052eac263 (diff) | |
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
Diffstat (limited to 'brdf.cginc')
| -rwxr-xr-x | brdf.cginc | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -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; } |
