Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeskydev committed Apr 10, 2024
1 parent e63ea08 commit a6a6adc
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions Assets/Scripts/Rendering/RenderWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#pragma warning disable 649, 414
#endif

// TODO:Mikesky - For some reason, offscreen rendering to m_hdrTarget is losing depth on XR.
// Unity's docs say this should be fine, so it may be a Unity bug.
// Investigate if this is fixed in newer Unity versions
// The temp fix is to no longer cull primary camera, and only display the offscreen render during
// a recording session, which is very rare and not likely to be using depth.

namespace TiltBrush
{

Expand Down Expand Up @@ -200,9 +206,12 @@ void OnPreCull()
// Store the clear and culling mask to restore after rendering.
m_cameraClearFlags = srcCam.clearFlags;
m_cameraCullingMask = srcCam.cullingMask;
srcCam.cullingMask = 0;
srcCam.clearFlags = CameraClearFlags.Nothing;
srcCam.allowHDR = GetTargetFormat() != RenderTextureFormat.ARGB32;

// TODO:Mikesky - See top of file.
// srcCam.cullingMask = 0;
// srcCam.clearFlags = CameraClearFlags.Nothing;

#endif

if (ReadBackTextures != null && m_readbackTextureFrame != Time.frameCount)
Expand Down Expand Up @@ -456,7 +465,8 @@ public void OnRenderImage(RenderTexture source, RenderTexture destination)
}
else
{
Graphics.Blit(m_hdrTarget, destination);
// TODO:Mikesky - See top of file.
Graphics.Blit(source, destination);
// Generate the outline mask for later use in the post fx chain
if (m_StencilToMaskMaterial)
{
Expand All @@ -469,9 +479,10 @@ public void OnRenderImage(RenderTexture source, RenderTexture destination)
// Only need the selection mask if the selection effect is enabled
if (App.Instance.SelectionEffect.RenderHighlight())
{
Graphics.Blit(m_hdrTarget, destination);
Graphics.Blit(destination, m_hdrTarget, m_StencilToMaskMaterial);
Graphics.Blit(m_hdrTarget, m_MaskTarget);
// TODO:Mikesky - See top of file.
Graphics.Blit(source, destination);
Graphics.Blit(destination, source, m_StencilToMaskMaterial);
Graphics.Blit(source, m_MaskTarget);
}
}
}
Expand Down

0 comments on commit a6a6adc

Please sign in to comment.