Skip to content

Commit 23837ac

Browse files
authored
Fix auto exposure flickering on the right eye (#5922)
* Fix autoexposure flickering on the right eye multipass mode renders with a single eye since it does it in two passes. using xrActiveEye will ping pong between 0 and 1 but here we always want to pass 0 since we have a single eye. * Storing the current eye id in the context so that we can use it in autoexposure. * Reverting old code and addressing comments. This reverts commit d0b5952. * Localize the change to autoexpose * Accidently removed some spaces. adding them back
1 parent ef9a03c commit 23837ac

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

com.unity.postprocessing/PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,13 @@ int RenderBuiltins(PostProcessRenderContext context, bool isFinalPass, int relea
12461246
m_LogHistogram.Generate(context);
12471247

12481248
// Uber effects
1249+
// 1336238: override xrActiveEye in multipass with the currently rendered eye to fix flickering issue.
1250+
int xrActiveEyeBackup = context.xrActiveEye;
1251+
if (context.stereoRenderingMode == PostProcessRenderContext.StereoRenderingMode.MultiPass)
1252+
context.xrActiveEye = eye;
12491253
RenderEffect<AutoExposure>(context);
1254+
context.xrActiveEye = xrActiveEyeBackup; // restore the eye
1255+
12501256
uberSheet.properties.SetTexture(ShaderIDs.AutoExposureTex, context.autoExposureTexture);
12511257

12521258
RenderEffect<LensDistortion>(context);

com.unity.postprocessing/PostProcessing/Runtime/PostProcessRenderContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public Camera camera
142142
/// <summary>
143143
/// The current active rendering eye (for XR).
144144
/// </summary>
145-
public int xrActiveEye { get; private set; }
145+
public int xrActiveEye { get; set; }
146146

147147
/// <summary>
148148
/// The number of eyes for XR outputs.

0 commit comments

Comments
 (0)