Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix an issue with the half resolution Mode (performance)
- Fix an issue with the color intensity of emissive for performance rtgi
- Fixed issue with rendering being mostly broken when target platform disables VR.
- Fixed ray tracing with XR single-pass.

### Changed
- Improve MIP selection for decals on Transparents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4429,9 +4429,7 @@ void RenderSSRTransparent(HDCamera hdCamera, CommandBuffer cmd, ScriptableRender
bool usesRaytracedReflections = hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) && settings.rayTracing.value;
if (usesRaytracedReflections)
{
hdCamera.xr.StartSinglePass(cmd);
RenderRayTracedReflections(hdCamera, cmd, m_SsrLightingTexture, renderContext, m_FrameCount, true);
hdCamera.xr.StopSinglePass(cmd);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText
if (!pathTracingShader || !m_PathTracingSettings.enable.value)
return;

if (hdCamera.viewCount > 1)
{
Debug.LogError("Path Tracing is not supported when using XR single-pass rendering.");
return;
}

CheckDirtiness(hdCamera);

// Inject the ray-tracing sampling data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ DeferredLightingRTParameters PrepareIndirectDiffuseDeferredLightingRTParameters(
if (deferredParameters.viewCount > 1 && deferredParameters.rayBinning)
{
deferredParameters.rayBinning = false;
Debug.LogWarning("Ray binning is not supported with XR single-pass rendering!");
}

deferredParameters.globalCB = m_ShaderVariablesRayTracingCB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ DeferredLightingRTParameters PrepareReflectionDeferredLightingRTParameters(HDCam
if (deferredParameters.viewCount > 1 && deferredParameters.rayBinning)
{
deferredParameters.rayBinning = false;
Debug.LogWarning("Ray binning is not supported with XR single-pass rendering!");
}

deferredParameters.globalCB = m_ShaderVariablesRayTracingCB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[shader("closesthit")]
void ClosestSubSurface(inout RayIntersectionSubSurface rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes)
{
UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this is done

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed over Slack, the code in BuildFragInputsFromIntersection() relies on _WorldSpaceCameraPos which is different for each eye in VR and will be indexed by the view index coming from DispatchRaysIndex().z.


// Always set the new t value
rayIntersection.t = RayTCurrent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
[shader("closesthit")]
void ClosestHitForward(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes)
{
UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand Down Expand Up @@ -212,6 +214,8 @@ void ClosestHitForward(inout RayIntersection rayIntersection : SV_RayPayload, At
[shader("anyhit")]
void AnyHitMain(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes)
{
UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[shader("closesthit")]
void ClosestHitGBuffer(inout RayIntersectionGBuffer rayIntersectionGbuffer : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes)
{
UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand Down Expand Up @@ -53,6 +55,9 @@ void AnyHitGBuffer(inout RayIntersectionGBuffer rayIntersectionGbuffer : SV_RayP
#ifdef _SURFACE_TYPE_TRANSPARENT
IgnoreHit();
#else

UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[shader("closesthit")]
void ClosestHitMain(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes)
{
UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand Down Expand Up @@ -141,6 +143,9 @@ void AnyHitMain(inout RayIntersection rayIntersection : SV_RayPayload, Attribute
#ifdef _SURFACE_TYPE_TRANSPARENT
IgnoreHit();
#else

UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
[shader("closesthit")]
void ClosestHitVisibility(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes)
{
UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand All @@ -26,6 +28,8 @@ void ClosestHitVisibility(inout RayIntersection rayIntersection : SV_RayPayload,
[shader("anyhit")]
void AnyHitVisibility(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes)
{
UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z);

// The first thing that we should do is grab the intersection vertice
IntersectionVertex currentVertex;
GetCurrentIntersectionVertex(attributeData, currentVertex);
Expand Down