Skip to content

Disable Screen Space Reflections if user is both in VR and selects SMAA#40

Open
Comptr-user wants to merge 1 commit into
Yellow-Dog-Man:mainfrom
Comptr-user:main
Open

Disable Screen Space Reflections if user is both in VR and selects SMAA#40
Comptr-user wants to merge 1 commit into
Yellow-Dog-Man:mainfrom
Comptr-user:main

Conversation

@Comptr-user

@Comptr-user Comptr-user commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

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 IsEnabledAndSupported function. This function originally always returned that SSR was supported. Now it checks against RuntimeUtilities.isSinglePassStereoEnabled and context.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.

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>
@Comptr-user Comptr-user requested a review from a team as a code owner June 13, 2026 01:52
@Comptr-user

Copy link
Copy Markdown
Contributor Author

Is there a way to make the actions run again?
The errors reported here are error 502-s, which according to what I saw on the internet was "bad gateway" errors.
Mainly asking because this really shouldn't be failing to build, considering how it built locally on my machine with no issue.

@Frooxius Frooxius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@Comptr-user

Copy link
Copy Markdown
Contributor Author

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.
Like it would work fine if you had SMAA & SSR already active, and it would disable it in vr while re-enabling in desktop, but it would also sometimes disable SSR in vr altogether even though it only breaks with SMAA.

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).

@Comptr-user

Comptr-user commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Replacing RuntimeUtilities.isSinglePassStereoEnabled with context.camera.stereoEnabled == true seems to properly disable SSR when the user is both in VR and using smaa, while also re-enabling itself if the user switches to desktop mode.
The camera item in the Resonite Essentials folder also seems to have SSR properly applied even if the user is in VR with SMAA, meaning that cameras probably don't get their SSR disabled by this change.
Sorry to ask this, but do you know of any other cameras that I should try to test before updating this pr with the new check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants