Bug + issue with shader stripping and keep all + shader variant recording (procedural instancing)

Hi and good day dear developers!

I just reported a bug “1. [IN-144771]# Issue with shader stripping in Unity and HDRP.” about this but decided to also ask around here if someone has found a solution.

I have been trying to figure out this shader stripping issue for weeks on the side in total and since unity 6.2-6.4 and came to conclusion after multiple attempts that this is an unity issue with hdrp and shader stripping.
Unity strips a way the shader nature renderer and amplify impostors are creating and cannot find them.

So I get message spam like this in the build (in the real game this happens hundreds to thousands of times).

*Shader Hidden/Amplify Impostors/Octahedron Impostor HDRP (Nature Renderer), subshader 0, pass 0, stage all: variant PROCEDURAL_INSTANCING_ON not found.*
*Shader Hidden/Amplify Impostors/Octahedron Impostor HDRP (Nature Renderer), subshader 0, pass 4, stage all: variant PROCEDURAL_INSTANCING_ON not found.*

What I’ve tried to stop the tree/grass shader-variant spam in builds

  1. “Keep All” for Instancing + BatchRendererGroup stripping - no change, variants still stripped.
  2. “Disable shader-variant stripping entirely” (HDRP assets) - build never finishes, compiles the whole variant matrix. With minimal project the issue still happens.
  3. “Hand-written .shadervariants file” - Unity rejects it, imports as invalid.
  4. “Recorded a Shader Variant Collection” in-editor - never captures the procedural (GPU-instanced) draws, so the needed variants aren’t in it.
  5. “Marked the shaders “Always Included””- keeps the shader, but not the specific variants.
  6. “Patched the Amplify Impostors shader” for the new HDRP 6.4 keyword - variant now exists in the editor, build still strips it.
  7. “Built a valid Shader Variant Collection by script” (the exact 30 variants) and preloaded it in the build profiles - variants still stripped; worse, the preload warm-up logs a “not found” for each one, adding more spam.
  8. “Set Project Graphics stripping to Keep All” - still stripped.

My conclusion is that that this is a nasty bug and not a project misconfigure after exhausting every keep variants path and using the tools + settings available.

Hello,
Feel free to also send me copy in private thru email support@amplify.pt so we can have a closer look and see if also can reproduce on our side.

Note Amplify Impostors v1.0.4 added support for Unity 6.4
I see from title/name of the shader in error posted you may also have modified adding Nature Renderer that may have used PROCEDURAL INSTANCING ON variant

also, I would suggest look closely if the 3rd party Nature Renderer HLSL is getting stripped as it is likely the source for that variant

Ok thanks. I sent you an email containing minimal project to reproduce the bug.

I think this is Unity related issue, but who knows if you can find a way to patch those shaders in way that would fix the bug with the cannot find shader spam.

As an additional note. The trees do render, but I don’t know if they are using the optimized shaders or not. I think at least the spam is hard and causes some slow down even in release builds

I’m having the same issue. Unity is stripping all passes of my shader from build - a shader I am using to do indirect rendering.

Is there a solution for this?
I have been trying to resolve this for a full week now.

But I feel like they made the ticket wrong. Because the shader is used and is stripped. Although there is the object rendering just fine (don’t know about the performance). So What could be happening is that it doesn’t find the material and logs that it cannot be found and falls back to some other variant. In this case I guess there is some lost performance + the logging perf hit. But weirdest thing is that with nature materials they are not visible/rendering in editor without the shader. So it could be that there is a variant that is compiled and it is stripped since it is not being used, like a ghost variant that the developer cannot see. It doesn’t make any sense.

Just upvote the bug and hope it gets solved