Hey Guys
Im pretty new to Unity and still learning, so be gentle.
Im currenty working through the brilliant hex map tutorial by Catlike Coding.
In part 1 we create our custom shader.
Since Im planning to do something slightly different with my game I want to introduce transparency to my shader.
After trying to learn more about shaders with this tutorial, I have reduced my shader to this which still does the job:
Shader "Custom/VertexColors" {
SubShader{
Tags{ "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
struct Input {
float4 color : COLOR;
};
void surf(Input IN, inout SurfaceOutputStandard o)
{
o.Albedo = IN.color;
}
ENDCG
}
FallBack "Diffuse"
}
I now want to add transparency to my shader.
As I understand it if I want to change all cells to just be 50% transparent this should work:
Shader "Custom/VertexColors" {
SubShader{
Tags{ "RenderType" = "Transparent" }
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
struct Input {
float4 color : COLOR;
};
void surf(Input IN, inout SurfaceOutputStandard o)
{
o.Albedo = IN.color;
o.Alpha = 0.5;
}
ENDCG
}
FallBack "Diffuse"
}
But of course, this doesnt change anything.
I have been working on this for hours now.
Really looking forward to your help.
Lucas