Disable Screen Space Reflections if user is both in VR and selects SMAA#40
Disable Screen Space Reflections if user is both in VR and selects SMAA#40Comptr-user wants to merge 1 commit into
Conversation
Starting the game in desktop mode lets SMAA and SSR work together. If the user starts the game in VR, then SMAA disables SSR for the duration of the session. Tested, and fixes the "VR FrameBuffer rendering on both eyes" issue. I guess this is why Unity disabled SMAA for vr lol. Signed-off-by: Comptr-user <tf2player6@gmail.com>
|
Is there a way to make the actions run again? |
Frooxius
left a comment
There was a problem hiding this comment.
I think the check right now is too global and will disable this even for non-VR cameras when the user is in VR.
Could you try checking the actual camera of the context, rather than global VR check?
It should check if the VR is active too, because the user might be switched to desktop rendering, where the combination will work fine.
| /// <returns><c>true</c> if the effect is currently enabled and supported</returns> | ||
| public override bool IsEnabledAndSupported(PostProcessRenderContext context) | ||
| { | ||
| if (context.antialiasing == PostProcessLayer.Antialiasing.SubpixelMorphologicalAntialiasing && RuntimeUtilities.isSinglePassStereoEnabled) //disables SSR if SMAA is used in VR. |
There was a problem hiding this comment.
I think this should check if the current camera is VR camera, this might be too global.
We've had issue before, where VR check would affect non-VR cameras that render to a render texture.
|
I originally tried to do something similar to how motion blur is disabled for vr in the CameraPostprocessingManager.cs file, but I couldn't get it to work consistently enough. I'll look into it again, and see if I can get a more optimal fix working this time (either through better checks in the SSR.cs file or through getting something to work in the PostprocessingManager.cs file). |
|
Replacing |
I guess things like this is why Unity disabled SMAA for vr lol.
Motivation
SMAA and SSR work together in desktop mode, but the rendering breaks if SSR & SMAA are enabled in VR.
This patch disables SSR if the player starts the game in VR & has SMAA set. This lasts for the duration of the session.
I tried to implement something similar to how motion blur disables in vr but then re-enables if you switch to desktop, but I couldn't get it to work.
FXAA still works with SSR in VR, so it doesn't need this change.
Related GitHub issues
VR FrameBuffer rendering on both eyes
Notable Changes
The SSR .cs file now has an if statement in the
IsEnabledAndSupportedfunction. This function originally always returned that SSR was supported. Now it checks againstRuntimeUtilities.isSinglePassStereoEnabledandcontext.antialiasing == PostProcessLayer.Antialiasing.SubpixelMorphologicalAntialiasing, so that if both are true then the function returns false to disable SSR.Testing
I've ran the renderer through Monado's Simulated HMD, and SSR gets disabled if the user selects SMAA after starting the game in VR. This fixes the linked github issue.
Backwards Compatibility
Nothing should break, as the SMAA+SSR in VR is the only scenario this change effects.
The most breakage I can think of is maybe cameras lose SSR if SMAA is active after starting the game in VR.