CarmenSandiego/Assets/Shaders/NoiseParticle.shader
Jamie Greunbaum 820df6c2bd - Lightning strike animations are now fully working.
- Added an alternate spawn marker, since it was needed for testing anyway.
- Round 1 podium name placard now has baked shading.
- Fixed umbrella model's blend shape normals.
- Removed a lot of unnecessary materials and textures.
- KNOWN ISSUE: Winner camera in round 2 no longer follows winner. Again.
2026-05-13 22:27:55 -04:00

98 lines
2.3 KiB
Plaintext

// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// Simplified Diffuse shader. Differences from regular Diffuse one:
// - no Main Color
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
Shader "Carmen/Noise Particle"
{
Properties
{
_MainTex ("Noise", 2D) = "white" {}
_Color ("Colour", Color) = (1.0, 1.0, 1.0, 1.0)
_MaskWobble ("Mask", 2D) = "white" {}
_MaskFadePower ("Fade Power", Range(0.1, 5.0)) = 1.0
_MaskWobbleAmount ("Wobble Amount", Range(0.0, 1.0)) = 1.0
}
SubShader
{
Tags { "Queue"="Transparent" "RenderType"="Transparent" "CanUseSpriteAtlas"="True" }
LOD 200
Pass {
Cull Back
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#include "UnityCG.cginc"
#pragma target 4.5
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature _VERTEX_COLORS
UNITY_DECLARE_TEX2D(_MainTex);
fixed4 _MainTex_ST;
half4 _Color;
UNITY_DECLARE_TEX2D(_MaskWobble);
fixed4 _MaskWobble_ST;
half _MaskFadePower;
half _MaskWobbleAmount;
struct Data
{
float4 vertex : POSITION;
float4 vertex_colour : COLOR;
float2 uv : TEXCOORD0;
float2 uv_mask : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct V2F
{
float4 position : SV_POSITION;
float4 vertex_colour : VAR_COLOR;
float2 uv : TEXCOORD0;
float2 uv_mask : TEXCOORD1;
};
V2F vert(Data v)
{
V2F o;
o.position = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.uv_mask = TRANSFORM_TEX(v.uv_mask, _MaskWobble);
o.vertex_colour = v.vertex_colour;
return o;
}
fixed4 frag(V2F i) : SV_TARGET
{
half3 colour = UNITY_SAMPLE_TEX2D(_MainTex, i.uv) * _Color;
half mask_wobble = UNITY_SAMPLE_TEX2D(_MaskWobble, i.uv_mask);
half mask = pow(1.0 - (distance(i.uv / _MainTex_ST.rg, half2(0.5, 0.5)) * 2.0), _MaskFadePower);
mask += ((mask_wobble - 0.5) * 2.0) * _MaskWobbleAmount;
colour *= i.vertex_colour.rgb;
mask *= i.vertex_colour.a;
return fixed4(saturate(colour).rgb, saturate(mask).r);
}
ENDCG
}
}
FallBack "Diffuse"
}