Aetheria/Assets/Shaders/DitheredParticles.shader
Reinier Vens b53e4aec8c Combat & Visibility & Collisions
Converted entity materials to new fade shader
Implemented visibility system
Refactored per-instance entity code to run inside monobehavior on entity instances
Created state machine AI for enemy ships with basic patrol and combat routines
Removed legacy AI code (controller item behaviors)
Added automatic trigger group assignment for matched weapons
Created ship collision system
Created shield VFX and colliders
2021-02-26 19:01:47 +00:00

73 lines
2.1 KiB
Text

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
Shader "Aetheria/Dithered Particles"
{
Properties
{
[HDR]_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
Cull Off
CGPROGRAM
#include "Dither Functions.cginc"
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard vertex:vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct appdata_particles {
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 color : COLOR;
float4 texcoord : TEXCOORD0;
};
struct Input {
float2 uv_MainTex;
float2 ditherOffset;
float4 color;
float4 screenPos;
};
void vert(inout appdata_particles v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input,o);
o.uv_MainTex = v.texcoord.xy;
o.ditherOffset = v.texcoord.zw;
o.color = v.color;
}
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color * IN.color;
// Apply screen space dithering
float2 screenUV = IN.screenPos.xy / IN.screenPos.w;
ditherClip(screenUV + IN.ditherOffset, c.a);
o.Emission = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = 1;
}
ENDCG
}
FallBack "Diffuse"
}