Improve close-up ship cameras and marine rendering
This commit is contained in:
@@ -30,9 +30,10 @@ Shader "Soundings/Harbor Reflection"
|
||||
float time = lerp(_Time.y, _SoundingsSeaTime, _SoundingsSeaSailing);
|
||||
float3 wave = OceanWave(worldPosition.xz, time, _SoundingsSeaWeather) * _SoundingsSeaSailing;
|
||||
worldPosition.y = -worldPosition.y * .59;
|
||||
worldPosition.y += wave.x * 1.5;
|
||||
worldPosition.z += sin(worldPosition.x * .53 + worldPosition.y * 2.14 + time * 1.55) * .27 + wave.z * 4;
|
||||
worldPosition.x += sin(worldPosition.y * .88 - time) * .29 + wave.y * 4;
|
||||
float spread = smoothstep(0, 5, -worldPosition.y);
|
||||
worldPosition.y += wave.x * .80;
|
||||
worldPosition.z += (sin(worldPosition.x * .53 + worldPosition.y * 2.14 + time * 1.55) * .27 + wave.z * 3.5) * spread;
|
||||
worldPosition.x += (sin(worldPosition.y * .88 - time) * .29 + wave.y * 3.5) * spread;
|
||||
output.clip = UnityWorldToClipPos(worldPosition.xyz);
|
||||
output.world = worldPosition.xyz;
|
||||
return output;
|
||||
@@ -42,9 +43,18 @@ Shader "Soundings/Harbor Reflection"
|
||||
{
|
||||
clip(-input.world.y);
|
||||
float time = lerp(_Time.y, _SoundingsSeaTime, _SoundingsSeaSailing);
|
||||
float breakup = .48 + .38 * sin(input.world.y * 14 + input.world.x * .62 - time * 1.02);
|
||||
float alpha = saturate(1 + input.world.y / 7.5) * breakup * lerp(.34, .24 - .11 * _SoundingsSeaWeather, _SoundingsSeaSailing);
|
||||
return fixed4(_Color.rgb * float3(.51,.60,.64), alpha);
|
||||
float3 view = lerp(normalize(_WorldSpaceCameraPos - input.world), UNITY_MATRIX_V[2].xyz, unity_OrthoParams.w);
|
||||
float depth = -input.world.y;
|
||||
float2 surface = input.world.xz + view.xz * depth / max(.10, view.y);
|
||||
float primary = sin(dot(surface, float2(.58, 2.83)) + depth * 1.40 - time * 2.22);
|
||||
float crossing = sin(dot(surface, float2(-1.19, 1.62)) + depth * 2.71 + time * 1.43);
|
||||
float breakup = .58 + .26 * primary + .16 * crossing;
|
||||
float closeReflection = lerp(.43, breakup, smoothstep(0, 1.5, depth));
|
||||
float grazing = 1 - saturate(view.y);
|
||||
float strength = lerp(.36, .25 - .10 * _SoundingsSeaWeather, _SoundingsSeaSailing);
|
||||
float fade = exp(-depth * lerp(.24, .43, _SoundingsSeaSailing)) * (1 - smoothstep(6, 10, depth));
|
||||
float alpha = fade * closeReflection * strength * (.66 + .34 * grazing);
|
||||
return fixed4(_Color.rgb * float3(.55,.65,.68), alpha);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user