Grass Cutters Together: the project as of moon-sweepers f3666f0

A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and
Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date.
Images, audio, models and binaries go through Git LFS (.gitattributes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-06 18:44:40 +06:00
parent 0f0467cd0c
commit d1c3761e58
4190 changed files with 270757 additions and 1 deletions

158
Assets/Shaders/Sky.shader Normal file
View File

@ -0,0 +1,158 @@
// Tethys-B sky: soft overcast-teal gradient, a hazy sun, drifting cloud banks and a huge ringed gas giant.
Shader "GrassCutter/Sky"
{
Properties
{
_ZenithColor ("Zenith", Color) = (0.33, 0.62, 0.86, 1)
_HorizonColor ("Horizon", Color) = (0.78, 0.9, 0.93, 1)
_GroundColor ("Below horizon", Color) = (0.55, 0.72, 0.78, 1)
_SunColor ("Sun", Color) = (1, 0.95, 0.85, 1)
_SunDir ("Sun direction", Vector) = (0.3, 0.55, -0.6, 0)
_CloudTex ("Cloud noise", 2D) = "white" {}
_CloudColor ("Clouds", Color) = (1, 1, 1, 1)
_CloudShade ("Cloud shade", Color) = (0.62, 0.74, 0.84, 1)
_CloudCover ("Cloud cover", Range(0,1)) = 0.5
_PlanetTex ("Planet", 2D) = "black" {}
_PlanetDir ("Planet direction", Vector) = (-0.55, 0.42, 0.72, 0)
_PlanetSize ("Planet angular size", Float) = 0.42
_PlanetTint ("Planet tint", Color) = (1, 1, 1, 1)
_Exposure ("Exposure", Float) = 1.0
}
SubShader
{
Tags { "Queue" = "Background" "RenderType" = "Background" "PreviewType" = "Skybox" "RenderPipeline" = "UniversalPipeline" }
Cull Off ZWrite Off
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _ZenithColor, _HorizonColor, _GroundColor, _SunColor, _SunDir, _CloudColor, _CloudShade, _PlanetDir, _PlanetTint;
float _CloudCover, _PlanetSize, _Exposure;
float4 _CloudTex_ST, _PlanetTex_ST;
CBUFFER_END
TEXTURE2D(_CloudTex); SAMPLER(sampler_CloudTex);
TEXTURE2D(_PlanetTex); SAMPLER(sampler_PlanetTex);
TEXTURE3D(_GcNoise3); SAMPLER(sampler_GcNoise3);
float _OsTime, _GcSkyOn, _GcNight;
// weather (all 0 when nothing sets them): extra cloud, storm gloom, a lightning flash, acid tint, sunrise/sunset
float _GcCoverAdd, _GcStorm, _GcFlash, _GcAcid, _GcDusk;
float4x4 _GcSkyRot; // the sky hangs over wherever the camera stands on the planet
struct A { float4 pos : POSITION; };
struct V { float4 pos : SV_POSITION; float3 dir : TEXCOORD0; };
V vert(A a)
{
V o;
o.pos = TransformObjectToHClip(a.pos.xyz);
o.dir = a.pos.xyz;
return o;
}
float Noise(float3 p) { return SAMPLE_TEXTURE3D_LOD(_GcNoise3, sampler_GcNoise3, p / 64.0, 0).r; }
// billows on a dome: a big slow shape, bent about so it never lines up, its edges worn away by finer noise
float Billows(float2 uv, float t)
{
float3 p = float3(uv.x + t * 0.012, t * 0.004, uv.y + t * 0.005);
float3 bend = SAMPLE_TEXTURE3D_LOD(_GcNoise3, sampler_GcNoise3, p * 0.5 / 64.0, 0).gba - 0.5;
return Noise(p * 0.55 + bend * 1.6) * 0.62 + Noise(p * 1.4 + bend) * 0.26 + Noise(p * 3.7) * 0.09 + Noise(p * 8.3) * 0.03;
}
float Clouds(float3 d, float3 sun, float t, out float lit)
{
lit = 1;
if (d.y <= 0.0) return 0;
// curved cloud dome: the big offset keeps the projection from stretching into streaks at the horizon
float2 uv = d.xz / (d.y + 0.3) * 2.2;
float a = Billows(uv, t);
float edge = lerp(0.68, 0.36, saturate(_CloudCover + _GcCoverAdd));
float c = smoothstep(edge, edge + 0.13, a);
if (c <= 0) return 0;
// the side away from the sun is the one with more cloud in front of it
lit = saturate(0.6 + (a - Billows(uv + normalize(sun.xz + 1e-4) * 0.16, t)) * 6);
// clouds thin out into haze toward the horizon
return c * smoothstep(0.02, 0.2, d.y);
}
float Stars(float3 d)
{
float3 g = floor(d * 420);
float h = frac(sin(dot(g, float3(12.9898, 78.233, 37.719))) * 43758.5453);
return step(0.9988, h) * (h - 0.9988) * 700 * smoothstep(-0.02, 0.2, d.y);
}
half4 frag(V i) : SV_Target
{
float3 d = normalize(i.dir);
if (_GcSkyOn > 0.5) d = mul((float3x3)_GcSkyRot, d);
float3 sun = normalize(_SunDir.xyz);
float t = _OsTime;
float up = d.y;
float3 sky = lerp(_HorizonColor.rgb, _ZenithColor.rgb, pow(saturate(up), 0.55));
sky = lerp(sky, _GroundColor.rgb, saturate(-up * 6));
float sd = saturate(dot(d, sun));
// sunrise and sunset: the horizon catches fire, hottest under the sun, and the zenith turns violet
float2 flatD = normalize(d.xz + 1e-4), flatS = normalize(sun.xz + 1e-4);
float toward = pow(saturate(dot(flatD, flatS) * 0.5 + 0.5), 3);
float low = 1 - saturate(abs(up) * 2.2);
float3 fire = lerp(float3(0.95, 0.38, 0.32), float3(1.0, 0.55, 0.16), toward) * lerp(0.75, 1.3, toward);
sky = lerp(sky, fire, _GcDusk * low * (0.5 + 0.5 * toward));
sky = lerp(sky, sky * float3(0.82, 0.66, 1.0), _GcDusk * saturate(up * 1.5) * 0.55);
sky += _SunColor.rgb * (pow(sd, 6) * 0.25 + pow(sd, 64) * 0.6);
// gas giant (drawn behind clouds)
float3 pd = normalize(_PlanetDir.xyz);
float3 pr = normalize(cross(float3(0, 1, 0), pd));
float3 pu = cross(pd, pr);
float facing = dot(d, pd);
if (facing > 0)
{
float2 puv = float2(dot(d, pr), dot(d, pu)) / (facing * _PlanetSize) * 0.5 + 0.5;
if (all(puv > 0) && all(puv < 1))
{
float4 p = SAMPLE_TEXTURE2D(_PlanetTex, sampler_PlanetTex, puv) * _PlanetTint;
// atmospheric fade near the horizon
float haze = saturate(up * 4 + 0.2);
sky = lerp(sky, p.rgb * 1.05 + sky * 0.12, p.a * haze * 0.96);
}
}
// sun disc
sky += _SunColor.rgb * smoothstep(0.9993, 0.9998, sd) * 4;
// clouds, lit from the sun side
float lit;
float c = Clouds(d, sun, t, lit);
float3 cloud = lerp(_CloudShade.rgb, _CloudColor.rgb, lit);
// at sunrise and sunset the clouds glow from below
cloud = lerp(cloud, cloud * float3(1.25, 0.72, 0.55), _GcDusk * 0.7);
cloud *= lerp(1, 0.42, _GcStorm);
sky = lerp(sky, cloud, c * 0.92);
// the thin edges of the clouds near the sun catch fire
sky += _SunColor.rgb * pow(sd, 10) * c * (1 - c) * 2.4;
// weather: storms grey the whole sky out, acid rain stains it sulphur-green, lightning lights the clouds
float grey = dot(sky, float3(0.3, 0.5, 0.2));
sky = lerp(sky, grey * float3(0.5, 0.56, 0.62), _GcStorm * 0.7);
sky = lerp(sky, sky * float3(0.85, 1.05, 0.55), _GcAcid * 0.6);
sky += _GcFlash * float3(0.75, 0.8, 1.0) * (0.25 + c * 1.2);
// night: the sky goes out and the stars come through the gaps in the clouds
float3 dark = sky * 0.07 + float3(0.012, 0.018, 0.04) + Stars(d) * (1 - c);
sky = lerp(sky, dark, _GcNight);
return half4(sky * _Exposure, 1);
}
ENDHLSL
}
}
FallBack Off
}