I’ve been trying to write a simple custom surface shader that lets me place a hole in my mesh for where the hole is on a golf green, and it’s working as expected, except when I enable alpha in the pragma line I get some weird artifacts. It looks like some of my triangles are being rendered before triangles in front and I’m not sure why.
Shader "Example/Diffuse Texture" {
Properties {
_MainTex ("Main", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
CGPROGRAM
#pragma surface surf Standard fullforwardshadows alpha
#pragma target 3.0
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutputStandard o) {
o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb;
o.Alpha = 1.0;
}
ENDCG
}
Fallback "Diffuse"
}