Created
September 9, 2013 10:19
-
-
Save sugi-cho/6493847 to your computer and use it in GitHub Desktop.
v2f、shader、参考にする書き方
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 "AngryBots/Particle/AlphaBlend" { | |
Properties { | |
_MainTex ("Base", 2D) = "white" {} | |
_TintColor ("TintColor", Color) = (1.0, 1.0, 1.0, 1.0) | |
} | |
CGINCLUDE | |
#include "UnityCG.cginc" | |
sampler2D _MainTex; | |
fixed4 _TintColor; | |
struct v2f { | |
half4 pos : SV_POSITION; | |
half2 uv : TEXCOORD0; | |
fixed4 vertexColor : COLOR; | |
}; | |
v2f vert(appdata_full v) { | |
v2f o; | |
o.pos = mul (UNITY_MATRIX_MVP, v.vertex); | |
o.uv.xy = v.texcoord.xy; | |
o.vertexColor = v.color * _TintColor; | |
return o; | |
} | |
fixed4 frag( v2f i ) : COLOR { | |
return tex2D (_MainTex, i.uv.xy) * i.vertexColor; | |
} | |
ENDCG | |
SubShader { | |
Tags { "RenderType" = "Transparent" "Queue" = "Transparent"} | |
Cull Off | |
Lighting Off | |
ZWrite Off | |
Fog { Mode Off } | |
Blend SrcAlpha OneMinusSrcAlpha | |
Pass { | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#pragma fragmentoption ARB_precision_hint_fastest | |
ENDCG | |
} | |
} | |
FallBack Off | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment