Build Soundings cruise management simulator

This commit is contained in:
josh
2026-11-27 20:50:28 -05:00
parent 250dc988a3
commit ba7902dd5e
88 changed files with 6226 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
Shader "Soundings/Harbor Water"
{
Properties
{
_Backdrop ("Harbor photograph", 2D) = "black" {}
_BackdropCrop ("Harbor crop", Vector) = (1,1,0,0)
_HullSpan ("Hull length and beam", Vector) = (71,7,0,0)
}
SubShader
{
Tags { "Queue"="Background" "RenderType"="Opaque" }
Pass
{
Cull Off
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _Backdrop;
float4 _BackdropCrop, _HullSpan;
struct Output { float4 clip : SV_POSITION; float4 screen : TEXCOORD0; float2 world : TEXCOORD1; };
Output vert(appdata_base input)
{
Output output;
output.clip = UnityObjectToClipPos(input.vertex);
output.screen = ComputeScreenPos(output.clip);
output.world = mul(unity_ObjectToWorld, input.vertex).xz;
return output;
}
fixed4 frag(Output input) : SV_Target
{
float2 uv = input.screen.xy / input.screen.w;
uv = (uv - .5) * _BackdropCrop.xy + .5;
float waterMask = 1 - smoothstep(.55,.69,uv.y);
float2 p = input.world;
float t = _Time.y;
float textureWave = sin(p.y * 1.94 + p.x * .30 + sin(p.x * .44 - t * .30)) * .0015;
uv += waterMask * float2(textureWave, textureWave * .14);
float3 color = tex2D(_Backdrop, uv).rgb;
if (_HullSpan.x < 1)
return fixed4(color, 1);
float halfLength = _HullSpan.x * .5;
float along = abs((p.x + halfLength * .022) / halfLength);
float shaft = saturate(1 - pow(max(0,along), 3.2));
float waterline = _HullSpan.y * lerp(.28, 1, shaft);
float offset = abs(p.y + .5) - waterline;
float shadow = (1 - smoothstep(-.8, 5.1, offset)) * (1 - smoothstep(.90,1.12,along));
color *= 1 - .39 * shadow * waterMask;
float edgeWave = sin(p.x * 1.46 + p.y * 1.88 + t * .65) + .36 * sin(p.x * 3.3 + p.y * 2.42 - t * .50);
float foam = saturate(edgeWave - .55) * (1 - smoothstep(.12, 1.3, abs(offset - .25))) * (1 - smoothstep(.81,1.06,along));
color += float3(.19,.23,.24) * foam * waterMask;
return fixed4(color, 1);
}
ENDCG
}
}
}