Shader Graph Transparent Texture Problem HELP!
Hello, I have a problem in Unity Shader Graph. Why transparent texture looks like this? Is there any way to make it transparent?
Answer by dan_wipf · Aug 27, 2019 at 10:52 AM
You need to a add Clip function =>
EDIT:
i do an example Step by Step on a Unlit Graph High Definition RP
Create new Shader => Create/Shader/HDRP/Unlit Graph & Name it as you like
Open the Shader and click on the Unlit Master node. There's a Wheel next to a little arrow(for expand / minimize node Preview) click on it and press on dropdown button called "Surface Type". Default is Opaque, change that to Transparent (Second Option). If needed check Double-Sided for front and back displaying the Texture.
Click on the "+" in the Blackboard Window (where the Name of your shader appears), select Vector 1 and name it "Cutoff". Press on the Mode Dropdown and select Slide. Set the Default value to 0.2.
Create now a new "Step" Node, a "Property: Cutoff Node and a "Sample Texture 2D" Node.
Connect the Cutoff to the Step's "Edge" input and the Alpha Value from the Sample Texture 2D Node to the Step's "In" input. The Output of the Step's Node goes to the Alpha Input from the Unlit Master Node.
Connect the RGBA Channel to the Color Input of your Unlit Master Node.
Works on Unlit and Lit HDRP Graph, and Unlit LWRP (as far as I know haven't tested other Shader Variant's yet)
EDIT 2: ![Example Picture][3]
Now you can do an overlay Material method. Simply add as first Material your Main Opaque Texture (in my case a bark texture). As second Material I added my cutoff material with the Shader example above (in my case a branch texture).
this will result that the transparent texture will be rendered above the main texture => I guess the effect you're looking for
EDIT 3: From the comments, it's a Blend Node in Override Mode what you're looking for, with the Alpha clip Explanation from above => here's the picture:
@siberhecy I've update my Answer.. (and replaced the picture of the Shader Graph, there was an unnecessary connection. if it still not works let me know.
@dan_wipf Hey! Thanks for your comment, but there is a problem. I cannot make Surface Type to Transparent because my object is not transparent. The thing I want to do is, for example; I have a "face texture" but this "face texture" doesn't have "eyebrows", I want to combine "face texture" with this "eyebrows texture". So that's why I cannot make surface type transparent. It will be broken when I make transparent :(
@dan_wipf Yes this is the effect I looking for but I don't have two materials.. How you split up cube into two materials?
Answer by zain9 · Feb 12, 2020 at 12:40 PM
I faced the same problem, no matter what I did with the transparent texture the result in sample texture was blurry. I just multiplied the RGBA output with the Alpha output and my problem was solved. So that every pixel where the alpha value is zero is negated by the multiplication and hence result in a clear output.
Answer by Mehrdad995 · May 16 at 03:32 PM
There was once that I had a similar problem with Transparency and no matter what I did I couldn't have the transparency in my shader, what I was doing wrong was that instead of using the "Sample Texture 2D" I was using "Gather Texture 2D".
Thought it might be good to point that out here.