Best VR Anti-Aliasing solution(s)

Hi All,

Been trying around FSAA, MSAA x2, x4 …etc and not happy with any of the results, tried the below free asset and it did not improve my AA at all in VR,

https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/fxaa-fast-approximate-anti-aliasing-3590

The MSAA 4X looks the best and does a pretty good job on jaggies but my frame rate went down by about a 1/3.

So for now I am running with no AA but the jaggies are making my eyes bleed.

What are you all running and are there any good assets that work well in VR (decent AA and FPS)?

I’m working on an indoor environment game on the Quest 2, on Unity V. 2021.1.16f1

Thanks,

Vanz

ps. google this many times but most solutions are quite old, also wondering what is newer that works well

MSAA 4X. Nothing else and that's a fact. This is something you have to work with on that hardware, and I suspect you're measuring the cost of it incorrectly, or blaming it when really it's a tiny cost that is the straw that breaks the camels back.

There also isn't anything faster than it on Quest.

[quote]
but my frame rate went down by about a 1/3.
[/quote] What is that in millisecs?

2 Likes

Which rendering pipeline? Show us your settings.

If you are using Universal Render Pipeline, you could try to decrease the Render Scale value under the URP Settings > Quality > Render Scale. It will have an impact on performance but perhaps in your situation it will not be detrimental.

Thanks a lot, really appreciate the feedback, see pics below with profiler.

Pipeline = URP

Pic1 and 2 are with running game through Laptop with link cable viewed through headset.

Pic3 and 4 are (after many trials) getting unity to run the game through my headset without the editor (remote profiling).
Link Cable connected, game running on Quest 2, Game not running on Unity, game sync'd with Profiler.

So to clarify, when I just run the APK in my headset with no AA I get 70'ish FPS, when I enable MSAA 4X I get 35'ish FPS.

Thanks again for any feedback and recommendations...

Vanz

Settings,

[quote=“Vanz”, post:4, topic: 872975]
So to clarify, when I just run the APK in my headset with no AA I get 70’ish FPS, when I enable MSAA 4X I get 35’ish FPS.
[/quote]
That’s what I expected. I in this case, MSAA is only the straw that breaks the camel’s back. Let me explain: it doesn’t cost half your framerate.

When you have vsync and don’t meet the framerate target, it will wait for the next frame, effectively halving your framerate. This isn’t because of MSAA, it’s because you’ve broken your budget long before then.

The actual cost of MSAA is very little, but just enough to push you over the edge and let vsync halve your framerate. To fix this, optimise it elsewhere.

TLDR: it is probably your shaders/other choices that leave you right near the edge before AA. You just can’t develop like that on VR. You can also look into FFR and other techniques to buy back performance or use cheaper shaders / no HDR etc.

Put your profiler in hierarchy view and sort the columns by millisecs for another view.

2 Likes

Thanks hippocoder, it's tough, I try hard to make all my scripts efficient and have went through so many optimization tutorials but designing in VR and as a hobby I just don't have the knowledge or experience yet... but I'm trying and I'll keep struggling... thanks for taking the time to help us newbs out...

I don't necessarily think its the proverbially, straw that breaks the camels back though, because if I remove about 1/4 of my geometry (just disable it) the problem remains, I think I have a more deep rooted problem. Your comments sparked many thoughts and ideas, one being shader choices, when I buy an asset from the store and everything comes out pink, I don't do a good job of finding an efficient shader or even know which are the more efficient shaders. I tend to grab the first one that works that gives me a decent image, I'm going to dig deeper into this.

Also, light baking, I thought if I did this, it would help, but if I turn off ALL of my lights the problem remains.

What makes this problem extra frustrating, is that I only see the issue when I export to apk and run my game in my head set, if I run via laptop and link cable the FPS's are similar with and without MSAA 4X. Which I guess makes sense as I have a decent GPU on my laptop.

Thanks again,

V
ps. FFR is another great suggestion, thanks...

[quote=“hippocoder”, post:5, topic: 872975]
That’s what I expected. I in this case, MSAA is only the straw that breaks the camel’s back. Let me explain: it doesn’t cost half your framerate.

When you have vsync and don’t meet the framerate target, it will wait for the next frame, effectively halving your framerate. This isn’t because of MSAA, it’s because you’ve broken your budget long before then.

The actual cost of MSAA is very little, but just enough to push you over the edge and let vsync halve your framerate. To fix this, optimise it elsewhere.

TLDR: it is probably your shaders/other choices that leave you right near the edge before AA. You just can’t develop like that on VR. You can also look into FFR and other techniques to buy back performance or use cheaper shaders / no HDR etc.

Put your profiler in hierarchy view and sort the columns by millisecs for another view.
[/quote]

It’s not all that little actually, especially on tiled rendering hardware. Whereas on that hardware the MSAA resolve happens before reading out the data and thus GMEM bandwidth isn’t increased, the larger memory footprint of the buffer yields a higher number of tiles and since there is a per-tile overhead, you can definitely get much better performance without MSAA.

For me what worked best for high-performance mobile VR is to not use MSAA but instead rely on shader based tricks (not post processing, but directly during ofrward rendering) and texture filtering to do anti-aliasing.

1 Like

[quote=“mabulous”, post:7, topic: 872975]
It’s not all that little actually, especially on tiled rendering hardware. Whereas on that hardware the MSAA resolve happens before reading out the data and thus GMEM bandwidth isn’t increased, the larger memory footprint of the buffer yields a higher number of tiles and since there is a per-tile overhead, you can definitely get much better performance without MSAA.

For me what worked best for high-performance mobile VR is to not use MSAA but instead rely on shader based tricks (not post processing, but directly during ofrward rendering) and texture filtering to do anti-aliasing.
[/quote]

Thanks mabulous, could you elaborate a little?

What were you seeing is terms of FPS differences with MSAA and no AA?

If I disable a 1/3 of my scene the FPS difference is still quite large, so I don’t think its the “straw breaking the cammel’s back” situation.

Vanz

did you analyze a frame using the special oculus build of RenderDoc (https://developer.oculus.com/blog/renderdoc-for-oculus/) and compare one trace with MSAA and one without? if not, you should do that, it will give you more insight into how to attack your bottleneck

[quote=“mabulous”, post:9, topic: 872975]
did you analyze a frame using the special oculus build of RenderDoc (https://developer.oculus.com/blog/renderdoc-for-oculus/) and compare one trace with MSAA and one without? if not, you should do that, it will give you more insight into how to attack your bottleneck
[/quote]

I did not, I am working with Oculus OVR right now and do some side by side comparisons. Some early things I’m noticing is that real time lighting seems to have a big hit on MSAA 4XX but not so much on NO AA… one important feature in my game is that the player can walk around with a torch so I can bake most lights but not all…

Thanks for the above info mabulous

Vanz

[quote=“Vanz”, post:10, topic: 872975]
one important feature in my game is that the player can walk around with a torch so I can bake most lights but not all…
[/quote]
I also wanted to use real-time lighting in Quest 2, but it is not always possible to maintain the required FPS (because AA)

https://www.youtube.com/watch?v=9PDl8oBJaeE

https://www.youtube.com/watch?v=vF771az5M-c

that’s why I removed all the real-time lights and started using decal shadows- but it’s a completely different game :slight_smile:

https://www.youtube.com/watch?v=ZC7VWb_uXt8

use FFR: Using Fixed Foveated Rendering | Oculus Developers it helps a bit

interesting... thanks fuzzy3d, what kind of an improvement in ms or FPS did you see with FFR?

so is that a common recommendation in VR, do no use real time lighting with MSAA 4X? I would think it would be on a case by case basis but I mean in general is that a rule of thumb? I get there may be exceptions... but I have not heard that before... thanks...

Er... do these realtime lights have shadows enabled, and are they point lights?

FFR technology gives me about 5-15fps with my setup, worth trying.

void Start()
{
OVRPlugin.fixedFoveatedRenderingLevel = OVRPlugin.FixedFoveatedRenderingLevel.HighTop;
}

MSAA 4x is lowest painless AA for me. Rendering scale 1.

I tried a point light, spot light without and with shadows tuned to the lowest level, but I couldn't keep 72 FPS absolutely stably. So now I have no lights at all, lightprobes and baked only. + decal shadows.

Maybe Quest 3 gets the lights back?

EDIT 16.4.2022: After returning to the Oculus Quest project, I can't restart FFR (so I can see the pattern). In the meantime, I switched to the new version of Unity and Quest was also updated several times ...

EDIT 26.1.2023: new project with 2021 and everything works fine

[quote=“hippocoder”, post:14, topic: 872975]
Er… do these realtime lights have shadows enabled, and are they point lights?
[/quote]
point light, no shadows enabled, they are torches in the game…

[quote=“fuzzy3d”, post:15, topic: 872975]
FFR technology gives me about 5-15fps with my setup, worth trying.

void Start()
{
OVRPlugin.fixedFoveatedRenderingLevel = OVRPlugin.FixedFoveatedRenderingLevel.HighTop;
}

MSAA 4x is lowest painless AA for me. Rendering scale 1.

I tried a point light, spot light without and with shadows tuned to the lowest level, but I couldn’t keep 72 FPS absolutely stably. So now I have no lights at all, lightprobes and baked only. + decal shadows.

Maybe Quest 3 gets the lights back?
[/quote]

wow, that’s a lot, thanks for sharing…

[quote=“mabulous”, post:7, topic: 872975]
It’s not all that little actually, especially on tiled rendering hardware. Whereas on that hardware the MSAA resolve happens before reading out the data and thus GMEM bandwidth isn’t increased, the larger memory footprint of the buffer yields a higher number of tiles and since there is a per-tile overhead, you can definitely get much better performance without MSAA.

For me what worked best for high-performance mobile VR is to not use MSAA but instead rely on shader based tricks (not post processing, but directly during ofrward rendering) and texture filtering to do anti-aliasing.
[/quote]

Hi, could you explain more about the shader trick? It sounds really helpful and interesting,

+1

this?
Trying to create custom standard shader with geometric specular aliasing - Unity Forum