0
To nie jest błąd
Black decal with transparency not working
I have a black decal with transparency stored as a 24-bit PNG. The image is a Unity asset with the
"Alpha Is Transparency" checked. I was using the decal with the basic Unity shaders. I just recently discovered the power of creating custom shaders and found Shader Forge as a fun way to create shaders.
Using the Texture Asset node I see the preview of the black decal correctly. When I connect the Texture Asset to a Texture 2D node I see nothing but black in the preview. Connecting the RGB output connector to something, for example diffuse, results in a pure black output.
Attempting to select the decal in the Texture 2D node without the Asset node creates the same result. It appears that the Texture 2D node is not handling the transparency correctly.
"Alpha Is Transparency" checked. I was using the decal with the basic Unity shaders. I just recently discovered the power of creating custom shaders and found Shader Forge as a fun way to create shaders.
Using the Texture Asset node I see the preview of the black decal correctly. When I connect the Texture Asset to a Texture 2D node I see nothing but black in the preview. Connecting the RGB output connector to something, for example diffuse, results in a pure black output.
Attempting to select the decal in the Texture 2D node without the Asset node creates the same result. It appears that the Texture 2D node is not handling the transparency correctly.
Customer support service by UserEcho
In order to use transparency, you need to either use the A channel in the alpha clip input (for cutout transparency) or in the Alpha input (for partial transparency)
I have years of experience in other tools such as Blender's node editor and only have hours of experience using Shader Forge. The output node in Blender is implied as RGB or RGBA if alpha available. Forgive me for assuming the same thing here and not fully realizing the difference. I can understand how the input channels of the "Main" node expect a more explicit split.
This still don't explain my main concern that caused my confusion in the first place. The Textured 2D preview is showing nothing but black. Texture Asset shows the preview correctly. If I connect the output of the Texture Asset to the Texture 2D input and no operation was performed between the nodes, I expect to see the exact same preview. Likewise if I load the exact same asset directly in to the Texture 2D node I would expect to see the image with the transparency.
1. The Texture2D node cannot simply always apply the alpha channel to all textures, as you often use the alpha channel for something other than transparency, such as specular masking, etc.
2. In this case, SF should apply the alpha to the node preview, if and only if you've marked the node to use the alpha as transparency. However, last time I tried this, it returned incorrect values, so it was unreliable.