Don't force Renderer Feature in URP

Avatar
  • updated
  • Fixed

We updated Shapes recently and have been having performance issues on the Quest. Turns out that it's the new Shapes renderer feature. URP forces an extra blit whenever there's ANY renderer feature added even if it doesn't need it. This is bad for the Quest because the extra blit is super expensive and wont allow foveated rendering. It may also disable MSAA. Unity said they'll make it explicit later, but this is an issue for now.

Previous versions didn't use this and ran fine.

Reporting a bug? please specify Unity version:
2019.4.16
Reporting a bug? please specify Shapes version:
3.2.3
Reporting a bug? please specify Render Pipeline:
URP
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Fixed

render features are no longer forced as of 4.1.1

note that they are required for immediate mode drawing to function!

Avatar
Markus Hötzinger
Quote from Freya Holmér

It looks like it should be possible by calling SetActive on the render features, and there's a snippet here for toggling it in the inspector, in case it helps!

https://forum.unity.com/threads/enable-or-disable-render-features-at-runtime.932571/#post-7991289

Wow, that actually works. Thanks a lot! 

Avatar
Freya Holmér creator
Quote from Markus Hötzinger

We are using immediate mode drawing for our debug drawer. We can't have the render feature enabled by default because of the performance problems it causes when running on the Quest 2 HMD. So whenever I need debug drawing, I have to enable the render feature manually and restart the game, or even worse, make a new build. 

Is there any hope the situation could be improved? If only the render feature could be enabled on demand at runtime.  

It looks like it should be possible by calling SetActive on the render features, and there's a snippet here for toggling it in the inspector, in case it helps!

https://forum.unity.com/threads/enable-or-disable-render-features-at-runtime.932571/#post-7991289

Avatar
Markus Hötzinger

We are using immediate mode drawing for our debug drawer. We can't have the render feature enabled by default because of the performance problems it causes when running on the Quest 2 HMD. So whenever I need debug drawing, I have to enable the render feature manually and restart the game, or even worse, make a new build. 

Is there any hope the situation could be improved? If only the render feature could be enabled on demand at runtime.  

Avatar
Freya Holmér creator
  • Answer
  • Fixed

render features are no longer forced as of 4.1.1

note that they are required for immediate mode drawing to function!

Avatar
bertos barticus

Hello, I have use case where we have a second camera with a different URP renderer. This camera has a specific setup and currently Shapes automatically adds the render feature to each ForwardRendererData it finds which is problematic.

Ideally there'd be some way to control this behaviour as you mentioned. One option you can use is this API

UnityEditor.AssetSettingsProvider

With this you end up with a settings asset that lives in ProjectSettings so you can avoid janky ways to store values. I'd like to think that would provide you with a mechanism to distinguish between Unity importing Shapes for the first time in a project, and perfom user dialogs then and save their choice.

For me I'd imagine a Manual mode which doesn't perform any asset modifications. You could also have an option for automatically adding to only the default renderer rather than all.


TextMeshPro also utilizes this project settings api so you can their code as a guide:

Avatar
Raincoat

Ah this may be what was causing my issue. https://shapes.userecho.com/en/communities/1/topics/229-xr-urp-msaa-not-working-when-shapes-is-in-project

I was just about to post an issue here where performance on Quest and URP is greatly decreased when shapes is imported. (And even without any shapes being drawn)

Currently switching the graphics API to Vulkan from GLES3 seems to be a workaround for the performance decrease. Since switching we've seen no slowdown. However MSAA and Foveated Rendering still doesn't work.

Avatar
kevin comerford
Quote from Freya Holmér

great! I love unity quirks~

so it sounds like I'll have to make it less automatic, or at least have a way to turn it off. might do something like this:

  • If Shapes detects URP, and is missing a render feature, a window will pop up asking you if you want to add it. You'll have two options: Auto (recommended), Manual (Advanced)
    • if auto, Shapes will auto-add it (current behavior)
    • if manual, Shapes will turn off auto-setup, and the window will not appear again and you'll have to manually set it up if you need immediate mode rendering

Sounds like a good compromise. I added a early out return to the EnsureShapesPassExistsInTheUrpRenderer function and removed the feature from the renderer list. Seems to work for now.

Thanks!

Avatar
Freya Holmér creator
  • Planned

great! I love unity quirks~

so it sounds like I'll have to make it less automatic, or at least have a way to turn it off. might do something like this:

  • If Shapes detects URP, and is missing a render feature, a window will pop up asking you if you want to add it. You'll have two options: Auto (recommended), Manual (Advanced)
    • if auto, Shapes will auto-add it (current behavior)
    • if manual, Shapes will turn off auto-setup, and the window will not appear again and you'll have to manually set it up if you need immediate mode rendering