Keywords and inspector support

This topic has been touched before, however some time has passed since then (~2 years?), plus I can’t find anything related to this on the roadmap, so I want to bring the discussion again.

The main point is to improve shader workflow and introduce any keyword support, because current workflow is very rigid and limited. Let’s start with variants, as example imagine we need special particle shader, nothing complex - some erosion stuff or texture blending. I can do that in shader graph and connect to the output, everything great. Then, 3 days later I need the same kind of shader, but with flipbook feature, but as there is no keyword support, no custom inspector or anything, I am forced to copy the previous shader and implement flipbook separately to not break anything. Next day I might need to add support for both flipbook and texture array and yet again I am forced to duplicate shader as there is no option to create checkbox or dropdown to switch mode like the default shader.
9159779--1274081--upload_2023-7-20_15-22-36.png

What I am actively doing is creating shader variants, but manually. Imagine someone added soft particles to the very first shader, now every other shader (flipbooks) has no such feature, it must be added separately.
I just want to be able to create one uber shader and enable/disable features I need (like the default one), and this is not possible, at all.

The second problem is using keywords to enable or disable features of existing shader graph Lit shader. Recently I wanted to disable “receive shadows” (_RECEIVE_SHADOWS_OFF) of default Lit, but it’s simply not possible. To overcome that I would need to recreate everything (lighting model) in shader graph and manually define that keyword somewhere I guess. In any case I could not make that work for both exposed and unexposed keywords in any way.

To summarize:

  1. Is there better workflow to overcome what I described above? Perhaps I am not aware of something.
  2. Would that be even possible to allow custom inspector or expose keywords as checkboxes or dropdowns?
  3. What is the current state and plans to solve problems above? Any ETA?

If I am understanding this correctly, the same capability would allow someone (me) to disable fog (while keeping other lighting as-is) with the FOG_LINEAR, FOG_EXP, FOG_EXP2 keywords. I would very much like this, because there seems to be no other way to do this with a VFX graph mesh output. (I just don’t want fog on my VFX!)

1 Like

Hello. Sadly, at the moment, the only answer that we can give you is that we’re aware of this limitation, and it is already in our backlog. But I have no ETA.

Small consolation, a card has been added by our product manager in the Product Board Roadmap. Will try to make a quick visual for it this week, but you can already comment/upvote the card.

2 Likes

Hi @Qriva ,

I just added two cards on Product Board to track those two issues.

VFX Graph : Shader-Graph Keyword Support
Shader Graph : Disable Fog from Lit Sub-Targets

Thank you.

On the side note, it would be really great if there was at least partial support (ASAP) mentioned by Paul here , as this is hard thing to overcome. I mentioned receive shadows and @jtheis85 mentioned fog, but there are dozens important keywords to control: reflections, additional lights, cookies, soft shadows, and those are examples only from URP.

Thank you, and by the way, also thank you for your presence on shader graph forum, finally it gets some love from unity staff :slight_smile:

3 Likes

Thanks @Qriva ,

so, looking at the current URP Lit Sub Target, is the option to disable Cast and Receive Shadows not enough?

Or do you simply want the same for Fog, Reflection, etc ?

PS: and thanks for noticing our commitment to the community :slight_smile:

The thing is that those options are carved in stone. In my case there is custom light, so to make it work I use Unlit graph with custom nodes and keywords to enable things. This, without vfx is already a bit tricky as modification of Lit calculations require understanding of this shader and there is huge amount of parameters. In any case because it’s Unlit shader technically it does not have the same options as Lit, so simply speaking I just can’t have this option.

In general modification of anything that is not covered/predicted by the SG is really hard, any customization requires a lot of work most of the time.

If those options do not “collide” with some features and still can be controlled by material keywords then why not.
In current state that would be helpful at least for vfx graph users, as we can’t change keywords.
Actually I am curious, what is the difference between keyword and this checkbox in the graph settings, does it compile templates differently, or it just sets keywords in some different magical way?

I am pretty sure I am not the only one who did :smile:

1 Like

Many thanks! Happy to see my card on the board.

1 Like