- Home /
How can i add a alpha value to this shader?
I need the _MainTextue to have a alpha setting.
Shader "ALTO/Additive Overlay Alpha" {
Properties{
_MainTex("Texture 1", 2D) = "white" {}
_SecondaryTex("Texture 2", 2D) = "white" {}
_SecondaryTexScale("Texture 2 Scale", Color) = (0,0,0,0)
}
Category{
Tags{ "Queue" = "Overlay" }
Blend SrcAlpha One
Cull Back Lighting Off ZWrite Off Fog{ Mode Off }
ZTest Always
BindChannels{
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader{
Tags{ "LightMode" = "Vertex" }
Pass{
SetTexture[_SecondaryTex]{
constantColor[_SecondaryTexScale]
combine texture * constant
}
SetTexture[_MainTex]{
combine texture + previous
}
SetTexture[_MainTex]{
combine previous * primary
}
}
}
}
}
Answer by Jessespike · Aug 12, 2016 at 07:38 PM
Start by adding an Alpha property at the top in properties:
_Alpha ("Alpha", Range(0,1)) = 1
In the last/third SetTexture block, update the code to include Alpha
SetTexture[_MainTex]{
//combine previous * primary
constantColor(1,1,1,[_Alpha])
combine previous * constant
}
I'm not sure what primary does and I don't know how to keep it with previous, I don't notice a difference without it, so maybe it's not needed. Sorry if I misinterpret your question, I know you asked how to change the alpha in only MainTexture and not everything, but I guessed that's you meant. If that's the case, then I'm not sure.
Your answer
Follow this Question
Related Questions
Depth mask with alpha / adding alpha to frag grabpass shader 0 Answers
How to add Emission to my custom shader? 2 Answers
Adding a clip() to the default shader? 0 Answers
Shader - What is float3.xy? 1 Answer
Shader: Modify XY Position of Texture 0 Answers