Add manual helm, grounded interiors, and taller ship classes
This commit is contained in:
46
Assets/Soundings/Resources/BridgeGlazing.shader
Normal file
46
Assets/Soundings/Resources/BridgeGlazing.shader
Normal file
@@ -0,0 +1,46 @@
|
||||
Shader "Soundings/Bridge Glazing"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color ("Glass tint", Color) = (.52,.74,.79,1)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
fixed4 _Color;
|
||||
struct Input { float4 vertex : POSITION; float3 normal : NORMAL; };
|
||||
struct Output { float4 clip : SV_POSITION; float3 world : TEXCOORD0; float3 normal : TEXCOORD1; };
|
||||
|
||||
Output vert(Input input)
|
||||
{
|
||||
Output output;
|
||||
output.clip = UnityObjectToClipPos(input.vertex);
|
||||
output.world = mul(unity_ObjectToWorld, input.vertex).xyz;
|
||||
output.normal = UnityObjectToWorldNormal(input.normal);
|
||||
return output;
|
||||
}
|
||||
|
||||
fixed4 frag(Output input) : SV_Target
|
||||
{
|
||||
float3 eye = normalize(_WorldSpaceCameraPos.xyz - input.world);
|
||||
float3 normal = normalize(input.normal);
|
||||
float edge = pow(1 - abs(dot(eye, normal)), 2);
|
||||
float reflection = pow(saturate(reflect(-eye, normal).y), 4);
|
||||
float3 tint = lerp(_Color.rgb * .64, float3(.89,.82,.66), reflection * .36);
|
||||
return fixed4(tint, .041 + edge * .21 + reflection * .058);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Assets/Soundings/Resources/BridgeGlazing.shader.meta
Normal file
10
Assets/Soundings/Resources/BridgeGlazing.shader.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47adb39f54f8432ca58db6eab81a2b16
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,6 +5,7 @@ Shader "Soundings/Harbor Water"
|
||||
_Backdrop ("Harbor photograph", 2D) = "black" {}
|
||||
_BackdropCrop ("Harbor crop", Vector) = (1,1,0,0)
|
||||
_HullSpan ("Hull length and beam", Vector) = (71,7,0,0)
|
||||
_HullCourse ("Hull heading and wake strength", Vector) = (1,0,0,0)
|
||||
_Underway ("Open water blend", Range(0,1)) = 0
|
||||
_WeatherSeverity ("Sea conditions", Range(0,1)) = 0
|
||||
}
|
||||
@@ -21,27 +22,36 @@ Shader "Soundings/Harbor Water"
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _Backdrop;
|
||||
float4 _BackdropCrop, _HullSpan;
|
||||
float _Underway, _WeatherSeverity;
|
||||
struct Output { float4 clip : SV_POSITION; float4 screen : TEXCOORD0; float2 world : TEXCOORD1; };
|
||||
float4 _BackdropCrop, _HullSpan, _HullCourse, _ViewSize;
|
||||
float3 _ViewOrigin, _ViewForward, _ViewRight, _ViewUp;
|
||||
float _Underway, _WeatherSeverity, _SeaTime;
|
||||
struct Output { float4 clip : SV_POSITION; float2 screen : TEXCOORD0; };
|
||||
|
||||
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;
|
||||
float2 corner = input.vertex.xz / 2000;
|
||||
output.clip = float4(corner.x, corner.y * _ProjectionParams.x, .99, 1);
|
||||
output.screen = corner * .5 + .5;
|
||||
return output;
|
||||
}
|
||||
|
||||
fixed4 frag(Output input) : SV_Target
|
||||
{
|
||||
float2 screen = input.screen.xy / input.screen.w;
|
||||
float2 screen = input.screen;
|
||||
float2 offsetOnFilm = (screen * 2 - 1) * _ViewSize.xy;
|
||||
float3 viewOffset = offsetOnFilm.x * _ViewRight + offsetOnFilm.y * _ViewUp;
|
||||
float3 origin = _ViewOrigin + viewOffset * _ViewSize.z;
|
||||
float3 ray = normalize(_ViewForward + viewOffset * (1 - _ViewSize.z));
|
||||
float distanceToWater = min(2600, max(0, -origin.y / min(ray.y, -.0001)));
|
||||
float2 world = origin.xz + ray.xz * distanceToWater;
|
||||
float2 uv = (screen - .5) * _BackdropCrop.xy + .5 + _BackdropCrop.zw;
|
||||
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 + 1.2 * _WeatherSeverity)))
|
||||
float2 relative = world - _HullSpan.zw;
|
||||
float2 p = float2(dot(relative, float2(_HullCourse.x, -_HullCourse.y)),
|
||||
dot(relative, _HullCourse.yx));
|
||||
float t = lerp(_Time.y, _SeaTime, _Underway);
|
||||
float textureWave = sin(world.y * 1.94 + world.x * .30 + sin(world.x * .44 - t * (.30 + 1.2 * _WeatherSeverity)))
|
||||
* (.0015 + .003 * _WeatherSeverity);
|
||||
uv += waterMask * float2(textureWave, textureWave * .14);
|
||||
float3 color = tex2D(_Backdrop, uv).rgb;
|
||||
@@ -50,15 +60,15 @@ Shader "Soundings/Harbor Water"
|
||||
float seaHeight = clamp(uv.y * .59 + .056, .055, .49);
|
||||
float drift = sin(p.y * .166 + t * .19) * .017;
|
||||
float3 openWater = tex2D(_Backdrop, float2(saturate(uv.x + drift), seaHeight)).rgb;
|
||||
float skyBand = smoothstep(.67, .70, screen.y);
|
||||
float twilight = saturate((screen.y - .70) * 3.8);
|
||||
float skyBand = lerp(smoothstep(-.006, .004, ray.y), smoothstep(.67, .70, screen.y), _ViewSize.z);
|
||||
float twilight = lerp(saturate(ray.y * 2.8), saturate((screen.y - .70) * 3.8), _ViewSize.z);
|
||||
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);
|
||||
float chop = sin(world.y * .83 + world.x * .45 - t * 2.4) * sin(world.x * .48 + world.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);
|
||||
@@ -92,7 +102,7 @@ Shader "Soundings/Harbor Water"
|
||||
+ .22 * sin(p.y * 13.7 - p.x * .37 - t * 2.2);
|
||||
float wake = smoothstep(.05, 2, trail) * (1 - smoothstep(1, 5 + trail * .062, abs(v)))
|
||||
* (1 - smoothstep(12, 89, trail)) * turbulence;
|
||||
color = lerp(color, float3(.72,.84,.84), wake * waterMask * .43 * _Underway);
|
||||
color = lerp(color, float3(.72,.84,.84), wake * waterMask * .43 * _Underway * _HullCourse.z);
|
||||
}
|
||||
return fixed4(color, 1);
|
||||
}
|
||||
|
||||
@@ -134,3 +134,20 @@
|
||||
.voyage-camera { margin-right: 15px; }
|
||||
.voyage-camera-help { color: #c4d4cf; font-size: 11px; margin-top: 5px; }
|
||||
.action.voyage-skip { flex-shrink: 0; }
|
||||
|
||||
.passage-helm {
|
||||
position: absolute;
|
||||
right: 30px;
|
||||
bottom: 151px;
|
||||
width: 280px;
|
||||
padding: 10px;
|
||||
background-color: rgba(9, 22, 31, .95);
|
||||
border-width: 1px;
|
||||
border-top-width: 2px;
|
||||
border-color: #ad9468;
|
||||
}
|
||||
.helm-readout { color: #eee0bd; font-size: 15px; margin: 4px 0 7px; }
|
||||
.helm-throttle { flex-direction: row; margin-bottom: 3px; }
|
||||
.action.helm-order { flex-grow: 1; min-height: 25px; padding: 2px 4px; margin-right: 2px; font-size: 11px; }
|
||||
.helm-help { color: #b7c8c4; font-size: 11px; margin: 2px 0 6px; }
|
||||
.action.helm-toggle { min-height: 32px; font-size: 12px; }
|
||||
|
||||
76
Assets/Soundings/Resources/ServiceSurface.shader
Normal file
76
Assets/Soundings/Resources/ServiceSurface.shader
Normal file
@@ -0,0 +1,76 @@
|
||||
Shader "Soundings/Service Deck Surface"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color ("Finish", Color) = (1,1,1,1)
|
||||
_Roughness ("Roughness", Range(.02,1)) = .58
|
||||
_Metal ("Metal", Range(0,1)) = 0
|
||||
_Emissive ("Emission", Range(0,1)) = 0
|
||||
_BayLength ("Compartment length", Float) = 6
|
||||
_RoomLight ("Compartment fixture offset", Float) = 4
|
||||
_DeckTread ("Deck surface", Float) = 0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
fixed4 _Color;
|
||||
float _Roughness, _Metal, _Emissive, _BayLength, _RoomLight, _DeckTread;
|
||||
struct Input { float4 vertex : POSITION; float3 normal : NORMAL; };
|
||||
struct Output { float4 clip : SV_POSITION; float3 local : TEXCOORD0; float3 normal : TEXCOORD1; };
|
||||
|
||||
Output vert(Input input)
|
||||
{
|
||||
Output output;
|
||||
output.clip = UnityObjectToClipPos(input.vertex);
|
||||
output.local = input.vertex.xyz;
|
||||
output.normal = input.normal;
|
||||
return output;
|
||||
}
|
||||
|
||||
float3 fixture(float3 delta, float3 viewDirection, float3 normal, float3 tint)
|
||||
{
|
||||
float distanceSq = max(.19, dot(delta, delta));
|
||||
float3 incident = delta * rsqrt(distanceSq);
|
||||
float diffuse = saturate(dot(normal, incident));
|
||||
float3 halfVector = normalize(incident + viewDirection);
|
||||
float specular = pow(saturate(dot(normal, halfVector)), lerp(104, 12, _Roughness));
|
||||
return tint * (diffuse * .69 + specular * lerp(.12, .64, _Metal)) / (1 + distanceSq * .21);
|
||||
}
|
||||
|
||||
fixed4 frag(Output input) : SV_Target
|
||||
{
|
||||
float3 p = input.local;
|
||||
float3 normal = normalize(input.normal);
|
||||
float3 eye = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1)).xyz;
|
||||
float3 viewDirection = normalize(eye - p);
|
||||
float interval = _BayLength * .5;
|
||||
float dx = (frac(p.x / interval) - .5) * interval;
|
||||
float nearestRoom = p.z < 0 ? -_RoomLight : _RoomLight;
|
||||
float3 corridor = fixture(float3(-dx, 2.85 - p.y, -p.z), viewDirection, normal, float3(1.00, .87, .67));
|
||||
float3 work = fixture(float3(-dx, 2.89 - p.y, nearestRoom - p.z), viewDirection, normal, float3(.90, .94, .93));
|
||||
corridor *= 1 - .62 * smoothstep(1.10, 2.25, abs(p.z));
|
||||
work *= smoothstep(.35, 1.88, abs(p.z));
|
||||
float fill = lerp(.72, 1, saturate(p.y * .72));
|
||||
float grain = p.x * 112 + p.y * 91;
|
||||
float matte = .98 + .018 * (1 - smoothstep(.5, 2.4, fwidth(grain))) * sin(grain) * sin(p.z * 87 - p.y * 30);
|
||||
float2 treadCoord = p.xz / .145;
|
||||
float2 cell = abs(frac(treadCoord) - .5);
|
||||
float relief = 1 - smoothstep(.30, .46, cell.x + cell.y);
|
||||
float detail = 1 - smoothstep(.45, 1.3, fwidth(treadCoord.x) + fwidth(treadCoord.y));
|
||||
matte += .086 * relief * detail * _DeckTread * saturate(normal.y);
|
||||
float3 diffuse = _Color.rgb * (float3(.34, .40, .42) * fill + corridor + work) * matte;
|
||||
float fresnel = pow(1 - saturate(dot(viewDirection, normal)), 3);
|
||||
float3 bounce = float3(.14, .20, .23) * fresnel * (.20 + _Metal * .40);
|
||||
return fixed4(saturate(diffuse + bounce + _Color.rgb * _Emissive * .66), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Assets/Soundings/Resources/ServiceSurface.shader.meta
Normal file
9
Assets/Soundings/Resources/ServiceSurface.shader.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5afa05c8d244ee4a24c372c911b5697
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user