Hi,
I’m working in a 2D isometric city building with 3D characters. We have been using the built-in render pipeline for a few years, but now we are trying to convert the project to URP. All changes have been made as all the updates are needed in shaders and materials, but we have a problem trying to convert the multipass shader from the built-in pipeline, we have used this shader to make the 3D characters pass behind the buildings.
The first attempt was to split up the shader with two materials it worked until we had to update the Unity version again to the 2022.3.20f1 version.
Currently, this solution was working fine in the 2022.3.1f1 version, but now only works in the editor.
Why is this happening? Is there any solution for this?
This is the shader that we use to make the character respect the z-order:
Do you know if its an issue with your shader I the new Unity version, or whether the new version has different behaviour and only draws the first material on an object?
Have you tried using either RenderDoc or the Frame Debugger to capture draw calls from your build to confirm the shader is being drawn? I was wondering if DEBUG_DISPLAY is not defined in your build shader.
An alternative: If you find that only the first material is drawn for an object in that Unity version, you could combine the shaders into a single .shader through UsePass.
You are also using a custom name for your pass (Z clear) - the URP renderers probably only render passes with names matching a predefined list (eg Forward2D - check the URP shaders), unless you explicitly make a render feature to do otherwise.
Sorry for the late response, I was trying to learn how to use the RenderDoc and testing some alternatives, but I had no luck.
When I tried to use the RenderDoc I noticed that the shader I use for the “Z-punching” was replaced by a default error shader.
I thought it could be because of the multiple materials so I tested with only the “Z-punching” material, but the shader kept being replaced. So now I think that the problem is the shader. I already put it in the always included shader, but it didn’t work either.
I tested the UsePass alternative but it didn’t work, maybe I’m doing something wrong.
And I checked the URP shader and changed the pass name to “Foward”, but no luck here either. And now I’m out of ideas.