Immediate Mode not working with AR Foundation

Avatar
  • updated
  • Unity's Fault

I'm trying to use the Immediate Mode example on a AR Foundation project, but it seems it doesn't draw anything on my phone

Reporting a bug? please specify Unity version:
2021.1.9
Reporting a bug? please specify Shapes version:
3.2.3
Reporting a bug? please specify Render Pipeline:
URP
Avatar
Freya Holmér creator
  • Under Review

What platform is your phone? iOS/android? and does it work fine on PC?

Avatar
Fabrizio Corda

I am using an Android phone (Samsung Note 20), but the project works fine on my pc (MacOS) not using the AR Foundation for Augmented Reality

Avatar
Freya Holmér creator

does that device support GPU instancing? it's required for Shapes to run properly. might also be worth trying to turn off GPU instancing in the Shapes settings, to see if that's the problem

Avatar
Fabrizio Corda

Yes, it does. I'm instancing an AR scene that contains several GPU Instanced elements.
I'll try to disable GPU instancing for shapes ASAP, but I'm concerned about the consequent performance

Avatar
Freya Holmér creator

if other instanced things work then Shapes should work as well.

You can try doing a clean install of shapes, sometimes old shaders stick for some reason
1. delete shapes

2. close unity
3. delete the library folder (will reimport your whole project on next startup)
4. open Unity

5. reinstall Shapes

6. see if things work!

another thing to test is in graphics settings, make sure it includes all instancing variants

Avatar
Keith OConor

I'm having a very similar problem, but on PS4, Xbox One and Mac standalone. Windows and Nintendo Switch work fine. 


Turning off GPU instancing fixes it, at least on PS4. Can you give some details on what you do differently without GPU instancing?

Avatar
Keith OConor

I should mention we're on 2019.4.17f1.

Avatar
Freya Holmér creator

the only difference is that I don't use instanced shaders when drawing. however, unity might do stuff like strip instancing variants on build if you only ever use them in immediate mode, but never as components.

however, this shouldn't be an issue in the latest version you have.



Avatar
Keith OConor

The fact that it works on Windows and Switch makes me think it's not related to shader stripping, but I'll dig in and see if I can determine anything there.

Avatar
Freya Holmér creator

any info on it would be super useful! I can't really try this on my own. things to check:

1. does the platform support instancing in general?

2. is the render pipeline disabling GPU instancing? (I think URP/HDRP might have options for this)
3. is this a problem for only immediate mode drawing or the component based shapes as well?

Avatar
Keith OConor

1. Yes, all affected platforms support instancing.

2. We're using the built in rendering pipeline. 

3. Unfortunately, I can't tell you because I just tried to check after deleting my library, and now I can't reproduce it any more! I'm starting to suspect this is a Unity import issue. I've logged a private support ticket with Unity, I'll let you know if that goes anywhere; until then, I'll keep trying to nail down a repro. 

Avatar
Freya Holmér creator
  • Unity's Fault

I'm closing this, as issues like this seem to consistently be an import issue in Unity, and not something I can control on my end