Enable placeable sun deck attractions and finish project rebrand
This commit is contained in:
65
Assets/BigShipTycoon/Resources/PassageWake.shader
Normal file
65
Assets/BigShipTycoon/Resources/PassageWake.shader
Normal file
@@ -0,0 +1,65 @@
|
||||
Shader "BigShipTycoon/Passage Wake"
|
||||
{
|
||||
Properties { _OceanDetail ("Wake detail", 2D) = "gray" {} }
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Background+2" "RenderType"="Transparent" }
|
||||
Pass
|
||||
{
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "OceanWaves.cginc"
|
||||
|
||||
sampler2D _OceanDetail;
|
||||
float _SeaTime, _WeatherSeverity, _TrailLength, _TycoonSeaSailing;
|
||||
struct Input { float4 vertex : POSITION; float4 trace : TEXCOORD0; };
|
||||
struct Output { float4 clip : SV_POSITION; float4 trace : TEXCOORD0; float2 water : TEXCOORD1; };
|
||||
|
||||
Output vert(Input input)
|
||||
{
|
||||
Output output;
|
||||
float3 vertex = input.vertex.xyz;
|
||||
vertex.y += OceanWave(vertex.xz, _SeaTime, _WeatherSeverity).x * _TycoonSeaSailing;
|
||||
output.clip = UnityObjectToClipPos(float4(vertex, 1));
|
||||
output.trace = input.trace;
|
||||
output.water = vertex.xz;
|
||||
return output;
|
||||
}
|
||||
|
||||
fixed4 frag(Output input) : SV_Target
|
||||
{
|
||||
float across = input.trace.x;
|
||||
float age = input.trace.y;
|
||||
float thrust = input.trace.z;
|
||||
float distance = input.trace.w;
|
||||
float2 water = input.water;
|
||||
float2 cross = float2(dot(water, float2(.85,-.53)), dot(water, float2(.53,.85)));
|
||||
float eddies = tex2D(_OceanDetail, water * .055 + float2(-.016,.016) * _SeaTime).b;
|
||||
float bubbles = tex2D(_OceanDetail, cross * .168 + float2(.026,-.011) * _SeaTime).b;
|
||||
float flecks = tex2D(_OceanDetail, water * .35 + float2(.008,.028) * _SeaTime).b;
|
||||
float billow = (eddies - .5) * .18 + (bubbles - .5) * .074;
|
||||
float churn = smoothstep(.31,.73, eddies * .50 + bubbles * .34 + flecks * .16);
|
||||
float sternMix = smoothstep(2, 26, distance);
|
||||
float propellers = 1 - smoothstep(.03,.24, abs(abs(across + billow) - .23));
|
||||
float turbulence = 1 - smoothstep(.19,.56, abs(across + billow));
|
||||
float core = lerp(propellers, turbulence, sternMix);
|
||||
float shoulder = abs(across + billow * .45);
|
||||
float kelvin = 1 - smoothstep(.035,.165, abs(shoulder - .76));
|
||||
float crests = smoothstep(.18, .91, .5 + .5 * sin(distance * .36 + shoulder * 12.6 - _SeaTime * 1.56 + eddies * 4.3));
|
||||
float wake = turbulence * .14 + core * (.17 + .69 * churn) + kelvin * crests * (.16 + .35 * eddies);
|
||||
float endFade = smoothstep(0, min(_TrailLength * .38, 32), _TrailLength - distance);
|
||||
float lifetime = (1 - smoothstep(2, 34, age)) * endFade;
|
||||
float alpha = wake * thrust * lifetime * (.90 - _WeatherSeverity * .20);
|
||||
float3 foam = lerp(float3(.29,.50,.55), float3(.90,.96,.95), churn * .83 + .08);
|
||||
return fixed4(foam, alpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user