How to specify "LightMode" tag? (ShaderGraph, URP)

I’m working on a shader that must render using a custom LightMode tag. In ShaderLab I can simply specify:

Tags { "LightMode"="MyCustomLightModeTag" }

How can you I specify a LightMode tag in ShaderGraph?

I’m currently using Unity 2022.3 with URP Forward+.

1 Like

bump

@FredMoreau Can you please add support for LightMode tag to your roadmap

Done. It’s here. Thanks for the heads up @Peter77

2 Likes

Just a bump here. This feature would be extremely helpful to me because I run a Post Transparency pass where I render a small number of meshes for visual effects. They use a unique light mode tag. I put some info on the ‘road map’

Hi there, thank you for the support.
Moving to URP we loosed a lot of flexibility in the process.
One of the main drawback is No Surface Shaders and Unity forcing us to use Shader Graph.

The lack of Surface Shaders make custom shaders (using Unity PBR lighting) very tedious to develop and maintain.

While i can understand why Unity is forcing us to move to SRP and Shader Graph, then there is the responsibility and the ethic to support what was available in Birp.

Furthermore, it seems that what is available in Shader Graph already would make this implementation pretty straight forward for the Shader Graph team, and it would bring a lof of flexibility to all of us.

If this feature is not going to make it anytime soon, i would like some hint of were to look to implement that myself. (Even tho its really not ideal to do Unity Shader Graph team work)

Thank you in advance.

3 Likes

bump!
Yeah this would be so much more usefull!!!

Hey, let me use this thread to frame expectations here.

Each Shader Graph Target/SubTarget features several Shader Passes (Forward, DepthOnly, GBuffer, ShadowCaster, ScenePicking, etc).

Most of those passes use a specific LightMode, except for the Forward pass.

So, what is it you need to do here?

  • Set the LightMode tag on the Forward pass?
  • Edit the Tags / LightMode tag of each pass in the SubTarget?
  • Add a new custom pass?

Thanks

Add LightMode tag for custom stuff.
Override existing “passes” like ShadowCast.
Maybe we should see separate outputs vertex/fragment blocks
for each pass we would like to Add/Override

1 Like

This has been on my mind for a while.
Shader Graph is in between two abstraction layers.
It gives you access to vertex and fragment stages, but the fragment stage is already a surface description, structs and passes are handled by the Target/SubTarget, which makes it easier to use, and harder to customize further at the same time.

Do you have a use case in mind? What other LightMode tag would you use for the ShadowCaster pass, and why?

1 Like

Hi,
can you share more details here? Like:

  • which Shader Graph Target/SubTarget (URP/Unlit, Lit)?
  • which passes do you need to override the LightMode tag on (Forward, ShadowCaster)?

Hi,

same question as above, can you share more details on the Material Type (Unlit, Lit), and the passes you need to customize the LightMode tag for, and an overall description of the use case?

I use custom LightMode to render my RenderFeatures when I don’t want / can’t use layers to mask renderers.
For now the only way to exclude renderer is to use LayerMask (not RenderingLayerMask) and it is very rigid and collide with other systems.
Example: recently I wrote custom distortion effect, where particles render to offscreen RT and blend their distortion vectors. So I wrote custom shader pass with LightMode=“Distortion” and then using FilteringSettings I get RenderingList.

1 Like