The Universal Render Pipeline/Lit shader has a ‘Surface Type’ property for making something transparent/opaque. In shader graph, it only seems possible to set this directly on the PBR master node.
Is it possible to add this to the blackboard somehow to expose it?
I just discovered that in my case A LOT more shader flags have to be set and that only the transparent → opaque conversion worked with the subset of flags shared earlier.
ohh, of course i also add it too…
Obstruction.gameObject.GetComponent().material…SetInt(“_RenderQueueType”, 4);
Obstruction.gameObject.GetComponent().material…SetInt(“_RenderQueueType”, 1);
I must be missing something. Sorry for my n00bness, but you’re all talking about code where the Shader graph is, well, a graph tool for shaders. What am I missing? where do you implement the code you all talk about?
I don’t when this might have changed, but I tried this in Unity 2021 and there was no such value as _SurfaceType, but if you change it to _Surface then it works.
I missed this at first too. He’s saying instead of setting this in ShaderGraph as a variable, you don’t need to do this, because ALL URP materials have these variables dynamically defined.
i.e., why would we want a variable? So we can change it in C#, right? Well, we can change it in C# without declaring a variable.
I made a new solution for this problem for a custom shader graph built on lit.
What I’ve done to solve the problem, which feels a bit more reliable to me, is just to make two shaders (one transparent, one opaque), then, when I need to toggle at runtime (or from within the materials editor) I just do material.shader = Shader.Find("Transparent_counterpart")
All of the prop values get transferred seamlessly, and, presumably, this will work across versions. I think it should be the recommended method, even though it creates some duplicate code/graph.