Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Metropolia/Damage"
- {
- Properties
- {
- _Damage("Damage", range(0,1)) = 0
- }
- SubShader
- {
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #include "Lighting.cginc"
- struct appdata
- {
- float4 pos : POSITION;
- float3 nor : NORMAL;
- };
- struct v2f
- {
- float4 pos : SV_POSITION;
- float3 nor : NORMAL;
- };
- float _Damage;
- v2f vert(appdata i)
- {
- v2f o;
- o.pos = UnityObjectToClipPos(i.pos);
- o.nor = UnityObjectToWorldNormal(i.nor);
- return o;
- }
- fixed4 frag(v2f i) : SV_Target
- {
- float ndl = max(0, dot(i.nor, _WorldSpaceLightPos0));
- fixed4 col = lerp(
- fixed4(0.5, 0.5, 0.5, 1),
- fixed4(1.0, 0.5, 0.5, 1),
- _Damage);
- return col * ndl * 2;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement