As a tech artist making VFX, I’ve been working a little with Shader Graph lately, and often ended up stuck because of lack of basic features. And I feel like some are low hanging fruits.
Sorry if I’m mistaken, I tried to look online for solutions before.
No stencil support
Point of making custom shader most of the time is to make vfx, which often use stencil to mask out things.
Sub Graph shaders doesn’t declare properties in the Material inspector. Probably the most frustrating so far.
When I make a shader feature, like a distortion on diffuse texture for example, which is reused on multiples different shaders on my character.
Right now, I need to declare the same properties of my sub graph again, connect them to the sub graph, set the slider info and default value again, do this for each shader which use my sub-graph, and repeat again each time I make a change to my sub graph.
AlphaToMask doesn’t seem to be accessible from shader graph settings ?
Ability to hook code (like custom fog) after lighting is processed / before end of fragment shader. Given color result as input.
Force a value to be in v2f (Equivalent to Amplify’s “Vertex To Fragment” node) (I think it’s mostly used for optimizations) (additional idea: display which node is vertex / which is fragment after compilation? for debugging)
(nice to have) Expose pass properties in material ? (like it is currently for render queue, these should overridable for ALL materials, with a “From Shader” default setting)
Otherwise, one has to duplicate shader graph as many times as he needs variant of these values.
Example: I want a 2 sided material, but I want the inside face to have different properties than the outside face. (need to make 2 duplicated shader, instead of 2 materials, or edit my 3D model)
Or maybe I want to have an Opaque and a Transparent version of my material, without making copies of my shader code.
Other than that, Shader graph is really nice and slick and fun to use.
But these missing features are really important, and in my opinion, Shader graph cannot a real professional tool until it has few of these.
Probably just a matter of time!
This is great feedback, Kushulain. Thank you very much! I can’t comment on all of these specifically - but I do want to say that many of them are being worked on and others we have on our list to work on in the future.
Regarding v2f, I think what you may be looking for is called a Custom Interpolator. (Documentation here.) It allows you to perform some operations in the vertex shader and then use interpolation (interpolator registers) to bring that data to the pixel shader. Let us know if that’s what you wanted to be able to do.
I’m actually new to scriptable/Universal renderpipeline. I’ve been working with builtin pipeline all this time!
That’s why I’m new to the shader graph, and I haven’t tested the VFX graph yet. I should give it a go soon.
I’ve been using Legacy particles, custom shaders, sometime custom particles solution when needed (C# generating quads + compute shader)
My use case of stencil is for a VR game with hand tracking (URP), player can make bubbles by positioning his index+thumb finger into a ring shape, and blowing on it.
My bubble is made using shader graph, is two-sided (2 materials). I want the outside face to be masked out inside the ring shape of the finger, so we can only see the inside face (just like it happen in reality).
My shader already has a ton of expensive features, stencil seemed to be the right solution for that.
Would this Render Objects Renderer Feature work for this ?
To lean in here as someone who does tech art as well. I use both depending on how much particles I need. For small particles I use the old system. This way I don’t tax the GPU more than needed in XR games.
For big or complex effects I use VFX Graph for sure.
If VFX graph also runs on CPU for simple effects I am not sure which I would use more
This sounds like a very practical use case. Exactly what I’m after to make sure we appreciate what we enable or improve.
Can you share a bit more details on your setup and constraints?
The bubble is a sphere like geometric shape?
Two individual materials? Meaning:
Two objects? One mesh with duplicated faces and two materials? Or a Two-Sided Material using IsFrontFace node?
I’m not sure Stencil can help if it’s the same material with Culling set to Both.
How do you handle the mesh creation, mask etc?
Some screenshots would help.
Erm on this RenderObjects does not handle AO for some reason so you can use it to do a stencil ‘portal’ into somewhere else but then the drawn stuff inside the ‘portal’ has no AO.
Render Objects have many limitations so unless v6 is fixing then that is why you need stencil, also it is historically the way to do this stuff. Even with Render Objects you have to draw the stencil material to set the stencil buffer for a portal and then use RenderObjects with a stencil check, which means a manual shader because… shader graph can not do.
TLDR: not having stencil buffer support and using RenderObjects is limited/buggy
Much agreed on the limitations, of course customizing lighting is still a big no no in general, however there are some hacky ways around it using an unlit shader and then doing your own lighting!!
Some reference info I found:
Inability to do stylized lighting is a problem as the pipelines are targeting realism, even URP - I hacked a basic wrap-lighting shader graph using an unlit graph
Edit: NB if you do not see the Surface options for a shader graph (so you can choose Render face, surface type etc.) then toggle on the “Allow Material override” setting in the Graph Settings. This is not particularly obvious because of the naming so has caught out a number of people!
I made this video for you explaining my situation.
It’s not critical, I gave up. But if this can give you idea to make shader graph better, I would be really happy.
Ability to set
blending Mode
Culling option
ZWrite ZTest
Stencil
Maybe via a toggle through the shader graph Settings. I know it’s possible in classic forward rendering. but maybe more complicated with URP (in my situation)
In our game The Light Brigade, we could not use ShaderGraph specifically because of the lack of stencils (and lack of a final color node - and no custom lighting node). The game uses stencil-based portals for level transitions (on Quest 2/3/PC/Consoles).