Ending: the Director's call, flyovers into orbit, Earth turning green, credits

When the planet is mown the ending plays by itself: G.R.A.S.S.A. calls, the
camera skims the stubble into the base, circles it and rises without a cut
into orbit over the bald planet (title, the crew's results). Then a jump
across space to a scorched, dried-out Earth: a rocket from Herbaria-7 passes
the lens and lands in Africa, and the green spreads from there over the whole
globe (seed pods, a glowing front, clouds and blue air coming back). The
credits roll over the green Earth (PlayWay credited as publisher), then THE
END and a card to keep mowing, leave a review or go to the menu. Space, Enter
or Esc skips to the green Earth and the card.

- EndingCinematic, EndingEarth (globe, air shell, rocket, seeds), SpaceSky
  (split out of the intro), EarthGlobe/EarthAir shaders and Earth maps in
  Resources/Ending
- the far meadow shows as stubble once the planet is mown
- "all of it" mown now means no sector with grass left (MowMap.Left); mown
  area summed in double
- the crew's total pay and play time are counted and saved for the results
- the "ending" cheat; -ending previews it in a test world; the -ending bot
  shoots every stage
- loc for the new lines in all 11 languages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-11-28 01:52:24 +03:00
parent 5e30bd4c26
commit 3ee5956694
43 changed files with 2405 additions and 72 deletions

View File

@ -0,0 +1,58 @@
// The ending's Earth's air: a shell a little bigger than the ball, drawn from the inside, glowing just past the ball's edge
// and fading out into space. Dusty brown while the ball is dead, blue once it lives.
Shader "GrassCutter/EarthAir"
{
Properties
{
_SunDir ("Sun (world)", Vector) = (0, 0, 1, 0)
_AirColor ("Air", Color) = (0.8, 0.55, 0.3, 1)
_Edge ("Edge (cos at the ball's rim)", Float) = 0.33
_Power ("Power", Float) = 1
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
Pass
{
Name "Air"
Tags { "LightMode" = "UniversalForward" }
Blend One One
ZWrite Off
Cull Front
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _SunDir;
float4 _AirColor;
float _Edge;
float _Power;
CBUFFER_END
struct Attributes { float4 positionOS : POSITION; float3 normalOS : NORMAL; };
struct Varyings { float4 positionCS : SV_POSITION; float3 normalWS : TEXCOORD0; float3 positionWS : TEXCOORD1; };
Varyings vert(Attributes v)
{
Varyings o;
o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
o.positionCS = TransformWorldToHClip(o.positionWS);
o.normalWS = TransformObjectToWorldNormal(v.normalOS);
return o;
}
float4 frag(Varyings i) : SV_Target
{
float3 n = normalize(i.normalWS);
float3 view = normalize(GetCameraPositionWS() - i.positionWS);
// the far side of the shell: 0 at its own rim, _Edge where it meets the ball's rim
float k = saturate(-dot(n, view) / _Edge);
float glow = pow(k, 1.6) * (1 - smoothstep(0.92, 1.0, k) * 0.4);
float lit = saturate(dot(n, normalize(_SunDir.xyz)) * 0.8 + 0.35);
return float4(_AirColor.rgb * glow * lit * _Power, 1);
}
ENDHLSL
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f936d69a63a436b4ba232598ed960eaa
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,155 @@
// The ending's Earth: a scorched, dried-out ball that turns green from wherever the seeds come down. Each seed is a cap on
// the sphere (its centre in the ball's own space, and how far it has spread, in radians) with a ragged, glowing front;
// clouds and the sea's shine come back with the green. Lit by its own sun, so it reads the same wherever it is put.
Shader "GrassCutter/EarthGlobe"
{
Properties
{
_DryTex ("Dry", 2D) = "white" {}
_GreenTex ("Green", 2D) = "white" {}
_SunDir ("Sun (world)", Vector) = (0, 0, 1, 0)
_AirColor ("Air", Color) = (0.8, 0.55, 0.3, 1)
_Life ("Life", Range(0, 1)) = 0
_SeedCount ("Seeds", Float) = 0
}
SubShader
{
Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "RenderPipeline" = "UniversalPipeline" }
Pass
{
Name "Earth"
Tags { "LightMode" = "UniversalForward" }
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
TEXTURE2D(_DryTex); SAMPLER(sampler_DryTex);
TEXTURE2D(_GreenTex); SAMPLER(sampler_GreenTex);
CBUFFER_START(UnityPerMaterial)
float4 _DryTex_ST, _GreenTex_ST;
float4 _SunDir;
float4 _AirColor;
float _Life;
float _SeedCount;
CBUFFER_END
// xyz: the seed's centre on the ball (object space, unit), w: how far it has spread (radians)
float4 _Seeds[12];
// x: how bright the seed's front still is (it goes out once the patch has done spreading)
float4 _SeedFx[12];
struct Attributes { float4 positionOS : POSITION; float3 normalOS : NORMAL; };
struct Varyings
{
float4 positionCS : SV_POSITION;
float3 dirOS : TEXCOORD0;
float3 normalWS : TEXCOORD1;
float3 positionWS : TEXCOORD2;
};
Varyings vert(Attributes v)
{
Varyings o;
o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
o.positionCS = TransformWorldToHClip(o.positionWS);
o.normalWS = TransformObjectToWorldNormal(v.normalOS);
o.dirOS = v.positionOS.xyz;
return o;
}
float hash(float3 p)
{
p = frac(p * 0.3183099 + 0.1);
p *= 17.0;
return frac(p.x * p.y * p.z * (p.x + p.y + p.z));
}
float vnoise(float3 x)
{
float3 i = floor(x);
float3 f = frac(x);
f = f * f * (3.0 - 2.0 * f);
return lerp(lerp(lerp(hash(i + float3(0, 0, 0)), hash(i + float3(1, 0, 0)), f.x),
lerp(hash(i + float3(0, 1, 0)), hash(i + float3(1, 1, 0)), f.x), f.y),
lerp(lerp(hash(i + float3(0, 0, 1)), hash(i + float3(1, 0, 1)), f.x),
lerp(hash(i + float3(0, 1, 1)), hash(i + float3(1, 1, 1)), f.x), f.y), f.z);
}
float fbm(float3 p)
{
float s = 0, a = 0.5;
for (int k = 0; k < 5; k++) { s += a * vnoise(p); p = p * 2.03 + 17.1; a *= 0.5; }
return s;
}
// the map is equirectangular; the derivatives come from whichever of two seams is further away, so the
// line where the longitude wraps never shows
float3 SampleMap(TEXTURE2D_PARAM(tex, smp), float2 uv, float2 dx, float2 dy)
{
return SAMPLE_TEXTURE2D_GRAD(tex, smp, uv, dx, dy).rgb;
}
float4 frag(Varyings i) : SV_Target
{
float3 d = normalize(i.dirOS);
float lon = atan2(d.z, d.x);
float lat = asin(clamp(d.y, -1, 1));
float2 uv = float2(lon / (2 * PI) + 0.5, lat / PI + 0.5);
float2 uv2 = float2(frac(uv.x + 0.5) - 0.5, uv.y);
float2 dx = ddx(uv), dy = ddy(uv), dx2 = ddx(uv2), dy2 = ddy(uv2);
if (abs(dx2.x) + abs(dy2.x) < abs(dx.x) + abs(dy.x)) { dx = dx2; dy = dy2; }
float3 dry = SampleMap(TEXTURE2D_ARGS(_DryTex, sampler_DryTex), uv, dx, dy);
float3 green = SampleMap(TEXTURE2D_ARGS(_GreenTex, sampler_GreenTex), uv, dx, dy);
// how green this spot is, and how close it is to a front that is still moving
float wob = fbm(d * 7.0) - 0.5;
float wob2 = fbm(d * 23.0 + 5.3) - 0.5;
float g = 0, front = 0;
for (int s = 0; s < 12; s++)
{
if (s >= (int)_SeedCount) break;
float4 sd = _Seeds[s];
if (sd.w <= 0) continue;
float ang = acos(clamp(dot(d, sd.xyz), -1, 1));
// ragged at the front; a seed spread past 4.7 has covered the whole ball whatever the wobble
float reach = sd.w * (1 + wob * 0.55 + wob2 * 0.18);
float e = reach - ang;
g = max(g, smoothstep(0, 0.035, e));
front = max(front, exp(-abs(e) / 0.011) * _SeedFx[s].x * smoothstep(0, 0.02, sd.w));
}
float water = saturate((green.b - max(green.r, green.g * 0.8)) * 4.0);
float3 albedo = lerp(dry, green, g);
float3 n = normalize(i.normalWS);
float3 sun = normalize(_SunDir.xyz);
float3 view = normalize(GetCameraPositionWS() - i.positionWS);
float ndl = dot(n, sun);
float light = smoothstep(-0.12, 0.55, ndl) * 1.05 + 0.035;
// clouds come back over the green; the dead ball only has thin streaks of dust
float3 cd = d;
float cs = _Time.y * 0.004;
cd = float3(cd.x * cos(cs) - cd.z * sin(cs), cd.y, cd.x * sin(cs) + cd.z * cos(cs));
float cn = fbm(cd * 4.5 + float3(0, cd.x * 2.0, 0));
float cloud = smoothstep(0.56, 0.78, cn) * (0.15 + 0.85 * g) * _Life * 0.85;
float dust = smoothstep(0.55, 0.8, fbm(cd * float3(3, 9, 3) + 11.0)) * (1 - g) * 0.25;
float3 col = albedo * light;
// the sea's shine
float3 h = normalize(sun + view);
float spec = pow(saturate(dot(n, h)), 60) * water * g * saturate(ndl * 4);
col += spec * float3(1, 0.95, 0.85) * 0.6;
col = lerp(col, float3(0.6, 0.43, 0.28) * light, dust);
col = lerp(col, float3(1, 1, 1) * (light * 0.95 + 0.03), cloud);
// the air seen edge on
float rim = pow(1 - saturate(dot(n, view)), 3.0);
col += _AirColor.rgb * rim * saturate(ndl * 0.8 + 0.45) * 0.9;
// the moving front glows, day side or night; softer out at sea
col += float3(0.55, 1.0, 0.3) * front * (0.35 + 0.65 * (1 - water)) * 1.1;
return float4(col, 1);
}
ENDHLSL
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b5db199a12a5d1c4e81aa7793db0fb66
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Ending/earth_dry.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: 293b6ffc779149546ae2aa858118ddf2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationMethod: 0
spriteTessellationDetail: -1
spriteGeometrySubdivision: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Ending/earth_green.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: d9a40abb906a7f745b7e54fd3b256c49
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationMethod: 0
spriteTessellationDetail: -1
spriteGeometrySubdivision: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant: