[SRP Batching] PositionOS cannot be converted to PositionWS

Hi, I was trying to support SRP Batching on my custom URP shader.

  • Move all parameters in inspector to one “UnityPerMaterial” cbuffer.
  • Make sure the shader has a “UnityPerDraw” cbuffer. (include “UnityInput.hlsl”)

I finished it successfully on 2022.2.a17 URP14.0.3. (Everything works fine)

But when I test it on URP13-12, the mesh (with my shader) will always stay at the origin.

Then I realized that there must be some thing wrong with the “unity_ObjectToWorld” matrix.
(but I cannot see that matrix in Frame Debugger, the same to URP Lit shader)
8228715--1075113--CBUFFER_UnityPerDraw.jpg

I include “UnityInput.hlsl” manually but the problem still exists. (It should be included by other URP files)

So, how can I fix the OS->WS conversion on URP 13 or what happened to SRP batching on URP 14?

Thx a lot!

Seems that I cannot find a fix to the “unity_ObjectToWorld” matrix.

I can reproduce the problem manually on URP14 by treating positionOS as world space, so I’m sure that matrix is broken.

Maybe the include order has changed between URP14 and URP13, but I failed to find the key changes.

My current fix is to disable SRP Batching on URP 13 and below:
8230725--1075446--CBUFFER_UnityPerMaterial.jpg

Please let me know if you know what breaks that matrix, thx! :frowning: