Skip to content

Instantly share code, notes, and snippets.

@Problematic
Created December 2, 2016 23:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Problematic/6e607c40f936d5d82b78f580e26366d0 to your computer and use it in GitHub Desktop.
Save Problematic/6e607c40f936d5d82b78f580e26366d0 to your computer and use it in GitHub Desktop.
Standard-lit particle shader for Unity3D
Shader "Custom/Lit Particle" {
Properties {
_TintColor ("Tint Color", Color) = (1,1,1,1)
_MainTex ("Particle Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 200
CGPROGRAM
#pragma surface surf Standard alpha
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
fixed4 color : COLOR;
};
fixed4 _TintColor;
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * (IN.color * _TintColor);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
@runevision
Copy link

I would suggest changing the keyword "alpha" to "alpha:fade" in order to change the shader to fade-mode alpha. Otherwise even the fully transparent parts of the surface will sometimes be lit by reflections or similar, since the default alpha mode treats transparency as a transparent material (e.g. glass) rather than as nothingness.

Worked like a charm for me after I made that change locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment