From a6a6adc4b02d7c03c9556f0d494c4bf8649931cc Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Wed, 10 Apr 2024 14:53:52 +0100 Subject: [PATCH] Format --- Assets/Scripts/Rendering/RenderWrapper.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Rendering/RenderWrapper.cs b/Assets/Scripts/Rendering/RenderWrapper.cs index ab57c3141b..965fb62b6b 100644 --- a/Assets/Scripts/Rendering/RenderWrapper.cs +++ b/Assets/Scripts/Rendering/RenderWrapper.cs @@ -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 { @@ -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) @@ -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) { @@ -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); } } }