HDRP Sprite Multi Pass

Hello Everyone.
I am experimenting on using 2D sprites in HDRP, trying to create a 2D/HD vibe.

For my character sprites I would like to have two passes. One lit and one unlit. The unlit pass would be for parts of the character that glow and must always be bright regardless of the lighting. Think glowing eyes or light sabers, that sort of stuff. My problem is I didn’t find a good way to do it.

I thought of putting two sprites atop of each others, one with the lit material and one with the unlit material. But this is clumsy, especially since I use vertex shaders to rotate the sprites.

If I was using URP or my own scriptable pipeline I would have created a shader with two pass, one lit and one unlit. I would have put a LightMode tag on the unlit pass and I would have added a custom pass to the pipeline to render this pass. But I don’t know if the same is possible with HDRP.

According to the documentation the only supported way to create custom shaders for HDRP is to use the shader graph. I couldn’t find any example of custom HDRP shaders written in HLSL. And, as far as I know, there is no way to create multi pass materials with the shader graph, nor it is possible to add a LightMode tag.

So I’m at a loss here. How would you do it?
Thank you very much.

I would rotate the sprite’s plane using transform’s rotation, this way I could also easily add VFX like glowing eyes in addition to rotating orbs, skill effects etc. This way would be much easier in the long run in my opinion

PS: I would also make the character’s sprite a child of the main player transform, you’ll move the player transform and rotate or offset the GFX independently

1 Like

For the unlit parts, you could simply get away with a single pass and use the emission options of the HDRP/Lit shader.

1 Like

Thank you Remy. Emission was almost what I needed. It differs from unlit because the emissive color is added to the diffuse color. But this is fixable by making the diffuse color black behind the emissive pixels.