Skip to content

Commit

Permalink
Merge pull request #15831 from Popov72/webgpu-fix-prepass-scattering
Browse files Browse the repository at this point in the history
WebGPU: Fix crash when using sub-surface scattering
  • Loading branch information
sebavan authored Nov 15, 2024
2 parents 8dba85d + 691b289 commit 146ca78
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ var fragData: array<vec4<f32>, SCENE_MRT_COUNT>;
fragData[PREPASS_COLOR_INDEX] = vec4f(finalColor.rgb - irradiance, finalColor.a); // Split irradiance from final color
#endif
irradiance /= sqAlbedo;
fragData[PREPASS_IRRADIANCE_INDEX] = vec4f(clamp(irradiance, vec3f(0.), vec3f(1.)), writeGeometryInfo * uniforms.scatteringDiffusionProfile / 255.); // Irradiance + SS diffusion profile
#else
#ifdef PREPASS_COLOR
fragData[PREPASS_COLOR_INDEX] = finalColor; // No split lighting
#endif
var scatteringDiffusionProfile : f32 = 255.;
fragData[PREPASS_IRRADIANCE_INDEX] = vec4f(clamp(irradiance, vec3f(0.), vec3f(1.)), writeGeometryInfo); // Irradiance + SS diffusion profile
#endif

fragData[PREPASS_IRRADIANCE_INDEX] = vec4f(clamp(irradiance, vec3f(0.), vec3f(1.)), writeGeometryInfo * scatteringDiffusionProfile / 255.); // Irradiance + SS diffusion profile
#elif defined(PREPASS_COLOR)
fragData[PREPASS_COLOR_INDEX] = vec4f(finalColor.rgb, finalColor.a);
#endif
Expand Down

0 comments on commit 146ca78

Please sign in to comment.