Make Soundings voyages playable with ship operations and guided tips
This commit is contained in:
@@ -6,6 +6,7 @@ Shader "Soundings/Harbor Water"
|
||||
_BackdropCrop ("Harbor crop", Vector) = (1,1,0,0)
|
||||
_HullSpan ("Hull length and beam", Vector) = (71,7,0,0)
|
||||
_Underway ("Open water blend", Range(0,1)) = 0
|
||||
_WeatherSeverity ("Sea conditions", Range(0,1)) = 0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
@@ -21,7 +22,7 @@ Shader "Soundings/Harbor Water"
|
||||
|
||||
sampler2D _Backdrop;
|
||||
float4 _BackdropCrop, _HullSpan;
|
||||
float _Underway;
|
||||
float _Underway, _WeatherSeverity;
|
||||
struct Output { float4 clip : SV_POSITION; float4 screen : TEXCOORD0; float2 world : TEXCOORD1; };
|
||||
|
||||
Output vert(appdata_base input)
|
||||
@@ -40,7 +41,8 @@ Shader "Soundings/Harbor Water"
|
||||
float waterMask = 1 - smoothstep(.55,.69,uv.y);
|
||||
float2 p = input.world - _HullSpan.zw;
|
||||
float t = _Time.y;
|
||||
float textureWave = sin(p.y * 1.94 + p.x * .30 + sin(p.x * .44 - t * .30)) * .0015;
|
||||
float textureWave = sin(p.y * 1.94 + p.x * .30 + sin(p.x * .44 - t * (.30 + 1.2 * _WeatherSeverity)))
|
||||
* (.0015 + .003 * _WeatherSeverity);
|
||||
uv += waterMask * float2(textureWave, textureWave * .14);
|
||||
float3 color = tex2D(_Backdrop, uv).rgb;
|
||||
if (_Underway > 0)
|
||||
@@ -53,7 +55,19 @@ Shader "Soundings/Harbor Water"
|
||||
float west = pow(1 - screen.x, 1.65);
|
||||
float3 horizon = lerp(float3(.45,.53,.59), float3(.83,.60,.46), west);
|
||||
float3 sky = lerp(horizon, float3(.13,.24,.38), twilight);
|
||||
float cloud = .76 + .24 * sin(screen.x * 18 + screen.y * 8 + sin(screen.x * 41 - t * .2));
|
||||
float3 stormSky = lerp(float3(.37,.45,.49), float3(.10,.15,.20), twilight) * cloud;
|
||||
sky = lerp(sky, stormSky, _WeatherSeverity);
|
||||
float chop = sin(p.y * .83 + p.x * .45 - t * 2.4) * sin(p.x * .48 + p.y * 2.2 + t * 1.6);
|
||||
openWater = lerp(openWater, openWater * .56 + float3(.055,.082,.09), _WeatherSeverity);
|
||||
openWater += max(0, chop - .70) * .19 * _WeatherSeverity;
|
||||
color = lerp(color, lerp(openWater, sky, skyBand), _Underway);
|
||||
if (_WeatherSeverity > .75)
|
||||
{
|
||||
float2 rainGrid = float2(screen.x * 160 + screen.y * 42, screen.y * 22 + t * 15);
|
||||
float rain = step(.973, frac(rainGrid.x + floor(rainGrid.y) * .381)) * step(.58, frac(rainGrid.y));
|
||||
color += rain * .22 * _Underway * float3(.55,.69,.77);
|
||||
}
|
||||
waterMask = lerp(waterMask, 1 - skyBand, _Underway);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user