Skip to content

Commit ba1ce02

Browse files
authored
Fixed a regression in the ray traced indirect diffuse due to the new probe system. (#31)
1 parent 6287617 commit ba1ce02

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
511511
- Fix issues in the post process system with RenderTexture being invalid in some cases, causing rendering problems.
512512
- Fixed an issue where unncessarily serialized members in StaticLightingSky component would change each time the scene is changed.
513513
- Fixed a weird behavior in the scalable settings drawing when the space becomes tiny (1212045).
514+
- Fixed a regression in the ray traced indirect diffuse due to the new probe system.
514515

515516
### Changed
516517
- Color buffer pyramid is not allocated anymore if neither refraction nor distortion are enabled

com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ void InitBuiltinData(PositionInputs posInput, float alpha, float3 normalWS, floa
3838

3939
builtinData.opacity = alpha;
4040

41+
// Use uniform directly - The float need to be cast to uint (as unity don't support to set a uint as uniform)
42+
builtinData.renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
43+
4144
// We only want to read the screen space buffer that holds the indirect diffuse signal if this is not a transparent surface
4245
#if RAYTRACING_ENABLED && (SHADERPASS == SHADERPASS_GBUFFER || SHADERPASS == SHADERPASS_FORWARD) && !defined(_SURFACE_TYPE_TRANSPARENT)
4346
if (_RaytracedIndirectDiffuse == 1)
@@ -54,12 +57,11 @@ void InitBuiltinData(PositionInputs posInput, float alpha, float3 normalWS, floa
5457
}
5558
else
5659
#endif
60+
{
61+
// Sample lightmap/probevolume/lightprobe/volume proxy
62+
builtinData.bakeDiffuseLighting = SampleBakedGI(posInput, normalWS, builtinData.renderingLayers, texCoord1.xy, texCoord2.xy);
63+
}
5764

58-
// Use uniform directly - The float need to be cast to uint (as unity don't support to set a uint as uniform)
59-
builtinData.renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
60-
61-
// Sample lightmap/probevolume/lightprobe/volume proxy
62-
builtinData.bakeDiffuseLighting = SampleBakedGI(posInput, normalWS, builtinData.renderingLayers, texCoord1.xy, texCoord2.xy);
6365
// We also sample the back lighting in case we have transmission. If not use this will be optimize out by the compiler
6466
// For now simply recall the function with inverted normal, the compiler should be able to optimize the lightmap case to not resample the directional lightmap
6567
// however it may not optimize the lightprobe case due to the proxy volume relying on dynamic if (to verify), not a problem for SH9, but a problem for proxy volume.

0 commit comments

Comments
 (0)