Created
December 2, 2016 23:01
-
-
Save Problematic/6e607c40f936d5d82b78f580e26366d0 to your computer and use it in GitHub Desktop.
Standard-lit particle shader for Unity3D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.