Skip to content

Commit 27114fb

Browse files
committed
Fix shader compilation errors - remove unused legacy functions
Removed leftover functions that were calling non-existent ggxDirectionalAlbedo and ggxAverageAlbedo. These were legacy from the previous compensation approach and are not needed with the explicit microsurface scattering implementation. Fixes: - Removed ggxEvalWithMultiScatter() stub function - Removed ggxEnergyCompensation() which called removed functions - Shader now compiles without errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 1594856 commit 27114fb

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

src/shader/bsdf/multiscatter_functions.glsl.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -128,48 +128,5 @@ vec3 ggxMultiScatterCompensation( vec3 wo, vec3 wi, float roughness, vec3 F0 ) {
128128
return vec3( 0.0 );
129129
}
130130
131-
// Alternative: Single function that returns both single-scatter and multi-scatter
132-
// This can be more efficient as it reuses calculations
133-
void ggxEvalWithMultiScatter(
134-
vec3 wo,
135-
vec3 wi,
136-
float roughness,
137-
vec3 F0,
138-
float D,
139-
float G,
140-
vec3 F,
141-
out vec3 singleScatter,
142-
out vec3 multiScatter
143-
) {
144-
145-
// Single scatter term (standard Cook-Torrance)
146-
float denom = 4.0 * abs( wo.z * wi.z );
147-
singleScatter = F * G * D / max( denom, 0.001 );
148-
149-
// Multi scatter compensation
150-
multiScatter = ggxMultiScatterCompensation( wo, wi, roughness, F0 );
151-
152-
}
153-
154-
// Simplified version: Returns just the energy compensation factor
155-
// Can be used to scale existing single-scatter results
156-
float ggxEnergyCompensation( float mu, float roughness ) {
157-
158-
// Returns a factor >= 1.0 that compensates for energy loss
159-
// Multiply your existing BRDF by this factor
160-
161-
vec3 F0 = vec3( 0.04 ); // Assume dielectric for this calculation
162-
vec3 E = ggxDirectionalAlbedo( mu, roughness, F0 );
163-
float Eavg_scalar = ( E.r + E.g + E.b ) / 3.0;
164-
165-
float Eavg = ggxAverageAlbedo( roughness );
166-
167-
// The compensation factor accounts for missing energy
168-
// At grazing angles and high roughness, this can be significant
169-
float compensation = 1.0 / max( Eavg, 0.001 );
170-
171-
return compensation;
172-
173-
}
174131
175132
`;

0 commit comments

Comments
 (0)