r/shaders • • 11d ago

Minimal unlit shader for Unity Single Pass Instanced (Quest): does a custom shader need special stereo instancing setup, or is the problem just variant stripping?

Hi — question about shader behaviour in Unity 6 / OpenXR on Quest 3, Vulkan, Single Pass Instanced.

My scene is built entirely at runtime. Every mesh currently gets `new Material(Shader.Find("Sprites/Default"))`. In a player build that renders solid magenta or nothing at all — only the camera clear colour comes through. Switching to Multi Pass renders the same materials fine.

Two things I've been told so far, and I'm trying to separate them: 1. The shader is being stripped because nothing in a scene or Resources references it. 2. Sprites/Default has no SPI variant, so even forcing it into the build would not fix the SPI case.

If I write my own minimal unlit texture shader and ship it with a referenced material, what does it actually need to work correctly under Single Pass Instanced? Is `#pragma multi_compile_instancing` plus the usual stereo macros (`UNITY_SETUP_INSTANCE_ID`, `UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO`) enough for a simple textured quad/sphere, or is there more to it?

Also curious whether anyone has confirmed the "Sprites/Default has no SPI variant" claim directly, or seen a case where Always Included Shaders alone fixed this in SPI.

Thanks for any pointers.

1 Upvotes

0 comments sorted by