Hi all,
I’ve got this shader for my voxel engine that is to be used on fluid blocks:
Shader "Voxel/Fluid Vertex"
{
Properties
{
_Color("Color", Color) = (1, 1, 1, 1)
_MainTex("Albedo (RGB)", 2D) = "white" {}
_Glossiness("Smoothness", Range(0, 1)) = 0.5
_Metallic("Metallic", Range(0,1)) = 0.0
_Speed("Speed", float) = 2.0
_Alpha("Alpha", float) = 0.8
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
LOD 200
Cull off
CGPROGRAM
#pragma surface surf Standard vertex:vert fullforwardshadows
#pragma target 3.0
float _Alpha;
float _Speed;
struct Input
{
float2 uv_MainTex;
float3 vertexColor;
};
struct v2f
{
float4 pos : SV_POSITION;
fixed4 color : COLOR;
};
void vert(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input,o);
v.texcoord.x += _Time * _Speed;
o.vertexColor = v.color;
}
sampler2D _MainTex;
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf(Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb * IN.vertexColor;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a * _Alpha;
}
ENDCG
}
FallBack "Standard"
}
I’m learning about shaders, but still am very new with them. This is supposed to scroll the fluid texture, be influenced by vertex colors, and have transparency. This isn’t entirely my shader. I only made a few modifications to it.
It scrolls just fine, it’s influenced by vertex colors just fine.
The transparency part isn’t working at all. It’s 100% opaque.
I have the RenderType = Transparent, the SrcAlpha OneMinusSrcAlpha blending, etc. I’ve tried changing the alpha value and also changing the alpha of the vertex colors themselves, and neither does a thing.
I’m not sure what I’m doing wrong here! Help would be appreciated.