Add MEGA Ocean Liner, split decks, and detailed ship materials
This commit is contained in:
@@ -18,6 +18,7 @@ Shader "BigShipTycoon/Port Scenery Surface"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "TycoonTexturing.cginc"
|
||||
|
||||
float4 _Color, _HazeColor;
|
||||
float _Detail, _Glow;
|
||||
@@ -33,20 +34,13 @@ Shader "BigShipTycoon/Port Scenery Surface"
|
||||
return output;
|
||||
}
|
||||
|
||||
float Lattice(float2 cell)
|
||||
{
|
||||
float3 p = frac(cell.xyx * .1031);
|
||||
p += dot(p, p.yzx + 33.33);
|
||||
return frac((p.x + p.y) * p.z);
|
||||
}
|
||||
|
||||
float GroundNoise(float2 position)
|
||||
{
|
||||
float2 cell = floor(position);
|
||||
float2 blend = frac(position);
|
||||
blend *= blend * (3 - 2 * blend);
|
||||
return lerp(lerp(Lattice(cell), Lattice(cell + float2(1,0)), blend.x),
|
||||
lerp(Lattice(cell + float2(0,1)), Lattice(cell + 1), blend.x), blend.y);
|
||||
return lerp(lerp(TycoonCell(cell), TycoonCell(cell + float2(1,0)), blend.x),
|
||||
lerp(TycoonCell(cell + float2(0,1)), TycoonCell(cell + 1), blend.x), blend.y);
|
||||
}
|
||||
|
||||
fixed4 frag(Output input, fixed side : VFACE) : SV_Target
|
||||
@@ -55,24 +49,36 @@ Shader "BigShipTycoon/Port Scenery Surface"
|
||||
float3 n = normalize(input.normal) * (side >= 0 ? 1 : -1);
|
||||
float3 view = normalize(_WorldSpaceCameraPos.xyz - p);
|
||||
float3 sun = normalize(float3(-.69,.40,-.43));
|
||||
float2 face = TycoonPlane(p, n);
|
||||
float2 samplePosition = p.xz + p.y * float2(.42,.76);
|
||||
float relief = GroundNoise(samplePosition * .22) - .5;
|
||||
float fine = (GroundNoise(samplePosition * 1.35) - .5) * (1 - smoothstep(.35,.91, length(fwidth(samplePosition))));
|
||||
float fine = (GroundNoise(face * 1.25) - .5) * TycoonDetail2(face * 1.25);
|
||||
float coarse = GroundNoise(samplePosition * .071) - .5;
|
||||
float3 albedo = _Color.rgb * (1 + relief * .10 + fine * .075);
|
||||
if (_Detail == 1)
|
||||
{
|
||||
float stone = smoothstep(-.23,.29, .55 * relief + .24 * fine + .42 * coarse);
|
||||
albedo *= .79 + .30 * stone + coarse * .19;
|
||||
albedo *= .79 + .30 * stone + coarse * .19 + TycoonStipple(face, 6.8) * .13;
|
||||
albedo *= lerp(.72, 1, smoothstep(-.12, 1.4, p.y));
|
||||
}
|
||||
if (_Detail == 2)
|
||||
else if (_Detail == 2)
|
||||
{
|
||||
float tile = 1 - smoothstep(.024,.094, abs(frac((p.z + p.y * .56) * 1.9 + .5) - .5));
|
||||
albedo *= 1 + fine * .11 - tile * .10 * (1 - smoothstep(.28, .68, fwidth(p.z * 1.9)));
|
||||
float tileShade;
|
||||
float joint = TycoonPanel(face, float2(3.5, 5.2), .5, .016, tileShade);
|
||||
albedo *= 1 + fine * .10 + tileShade * .22 - joint * .27;
|
||||
}
|
||||
if (_Detail == 4)
|
||||
albedo *= .87 + relief * .16 + fine * .12 + coarse * .13;
|
||||
else if (_Detail == 4)
|
||||
albedo *= .87 + relief * .16 + fine * .12 + coarse * .13 + TycoonStipple(face, 7.1) * .115;
|
||||
else if (_Detail == 5)
|
||||
{
|
||||
float board;
|
||||
float seam = TycoonPanel(face, float2(.40, 5.8), .39, .0032, board);
|
||||
albedo *= 1 + board * .21 + TycoonGrain(face, 11) * .055 - seam * .27;
|
||||
}
|
||||
else if (_Detail == 6)
|
||||
albedo *= 1 + TycoonStipple(face, 18) * .17 + TycoonStipple(face, 7.8) * .070;
|
||||
else if (_Detail == 7)
|
||||
albedo *= 1 + TycoonGrain(face, 33) * .105;
|
||||
|
||||
float diffuse = saturate(dot(n, sun));
|
||||
float sky = n.y * .5 + .5;
|
||||
@@ -87,7 +93,7 @@ Shader "BigShipTycoon/Port Scenery Surface"
|
||||
}
|
||||
float distance = length(_WorldSpaceCameraPos.xyz - p);
|
||||
float haze = smoothstep(120, 640, distance) * .87;
|
||||
return fixed4(lerp(color, _HazeColor.rgb, haze), 1);
|
||||
return fixed4(TycoonHighlightRollOff(lerp(color, _HazeColor.rgb, haze)), 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user