Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
- // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
- Shader "Custom/SimpleShieldShader2" {
- Properties {
- _Color ("Color", Color) = (1,1,1,1)
- _PointColor("Point Color (RGB)", Color) = (1,0,0,1)
- _MainTex ("Albedo (RGB)", 2D) = "white" {}
- _ImpactSize("ImpactSize", Float) = 0.5
- }
- SubShader {
- Tags { "Queue" = "Transparent" }
- LOD 200
- Blend One One
- Lighting Off
- CGPROGRAM
- // Physically based Standard lighting model, and enable shadows on all light types
- #pragma surface surf Standard //NoLighting
- // Use shader model 3.0 target, to get nicer looking lighting
- #pragma target 3.0
- sampler2D _MainTex;
- struct Input {
- float2 uv_MainTex;
- float3 worldPos;
- };
- fixed4 _Color;
- fixed4 _PointColor;
- float _ImpactSize;
- int _PointsSize;
- fixed4 _Points[50];
- void surf (Input IN, inout SurfaceOutputStandard o) {
- fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
- fixed emissive = 0;
- float3 objPos = mul(unity_WorldToObject, float4(IN.worldPos, 1)).xyz;
- for (int i = 0; i < _PointsSize; ++i) {
- float amount = max(0, frac(1.0 - max(0, (_Points[i].w * _ImpactSize) - distance(_Points[i].xyz, objPos.xyz)) / _ImpactSize) * (1 - _Points[i].w));
- emissive += amount;
- }
- o.Albedo = c.rgb;
- o.Emission = emissive * _PointColor;
- o.Metallic = 0;
- o.Smoothness = 0;
- o.Alpha = c.r;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement