Hello !
I’m trying to use the BatchRenderGroup API to render some custom mesh that is generated every frame (it’s an animated spine asset rendered as a new mesh every frame)
I have a problem that looks like an engine bug : I use a transparent shader, because I want it to be rendered last, but the engine keeps putting it here according to the frame debugger :
But that’s not the weirdest part : as soon as I change anything in the configuration of the material, it starts rendering properly, and it’s now put inside the DrawTransparentObject pass :
The data sent to the GPU is exactly the same in both cases (at least what is shown in the frame debugger), and the bug is also present on builds : characters are rendered properly only if I have modified their materials at least once after launching the editor…
That’s really puzzling, any idea why it behaves like that, and/or any workaround ? I don’t actually need the mesh to be considered as transparent, I just need to make sure it will be rendered after opaques.
Are you using the BatchDrawCommandFlags.HasSortingPosition flag for these objects? If not, try setting that flag, I think anything with that flag should render in the transparent pass.
Thank you for the quick answer !
But I just tried it, and it does not solve the problem unfortunately…
Is there any way to see what the SRP batcher does under the hood ?
SRP Batcher assigns draws to passes using Material.renderQueue and Shader.renderQueue. Perhaps there is something weird going on with one of those two.
I would start investigation by logging those values for the Material in question and see if there’s something that looks fishy.
Thank you ! It actually seems to come from the material, which gets a Custom Render Queue of 2000 ish at load if I keep the QueueControl to auto, but gets refreshed properly after I change anything in the material… It doesn’t have this problem with UserOverride though, so there’s still a bug, but at least I have a workaround !