Skip to content

Commit 98520f1

Browse files
Fixed a performance issue with stochastic ray traced area shadows. (#300)
Co-authored-by: sebastienlagarde <[email protected]>
1 parent 5b40e3c commit 98520f1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
570570
- Made more explicit the warning about raytracing and asynchronous compute. Also fixed the condition in which it appears.
571571
- Fixed a null ref exception in static sky when the default volume profile is invalid.
572572
- Fixed issue with screen-space shadows not enabled properly when RT is disabled (case 1235821)
573+
- Fixed a performance issue with stochastic ray traced area shadows.
573574

574575
### Changed
575576
- Improve MIP selection for decals on Transparents

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/SphericalQuad.hlsl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
// I am not sure why exactly, by a lower epsilon generates ray that even if they give a valid result with ray tracing
2+
// nuke the performance. Changing the epsilon from 1e-6 to 1e-5 seems to solve the issue.
3+
#define PLANE_INTERSECTION_EPSILON 1e-5
4+
15
bool IntersectPlane(float3 ray_origin, float3 ray_dir, float3 pos, float3 normal, out float t)
26
{
3-
float denom = dot(normal, ray_dir);
4-
if (abs(denom) > 1e-6)
7+
float denom = dot(normal, ray_dir);
8+
if (abs(denom) > PLANE_INTERSECTION_EPSILON)
59
{
610
float3 d = pos - ray_origin;
711
t = dot(d, normal) / denom;

0 commit comments

Comments
 (0)