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

View File

@ -0,0 +1,138 @@
// Soil of Herbaria-7, wrapped around the whole ball (Ground.cs). It reads as dense meadow from far away, steep hillsides
// turn to rock, and thin gold lines mark the borders of the sectors. What was cut is drawn over it (GrassFur.shader).
Shader "GrassCutter/Ground"
{
Properties
{
_Meadow ("Meadow floor", Color) = (0.12, 0.27, 0.07, 1)
_MeadowFar ("Meadow far", Color) = (0.3, 0.52, 0.16, 1)
_Rock ("Rock", Color) = (0.5, 0.46, 0.4, 1)
_Border ("Sector border", Color) = (0.95, 0.72, 0.25, 1)
}
SubShader
{
Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "RenderPipeline" = "UniversalPipeline" }
Cull Off
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Planet.hlsl"
// the mesh is unit directions around the camera; the soil lifts them into place
float3 GroundDir(float3 positionOS) { return normalize(mul((float3x3)UNITY_MATRIX_M, positionOS)); }
ENDHLSL
Pass
{
Name "GroundForward"
Tags { "LightMode" = "UniversalForward" }
HLSLPROGRAM
#pragma target 4.5
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
#pragma multi_compile_fog
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _Meadow, _MeadowFar, _Rock, _Border;
CBUFFER_END
float _GcSkyOn, _GcTime;
float4 _GcCam;
float4x4 _GcSkyRot;
float4 _GcIcoN[20], _GcIcoR0[20], _GcIcoR1[20], _GcIcoR2[20];
struct Attributes { float3 positionOS : POSITION; };
struct Varyings { float4 positionCS : SV_POSITION; float3 positionWS : TEXCOORD0; float3 normalWS : TEXCOORD1; float3 dir : TEXCOORD2; float fog : TEXCOORD3; };
Varyings vert(Attributes v)
{
Varyings o;
float3 d = GroundDir(v.positionOS);
float3 t1, t2;
GcTangents(d, t1, t2);
float h = GcHeight(d);
const float e = 6.0;
float slope1 = GcHeight(normalize(d + t1 * e / _GcPlanet.w)) - h;
float slope2 = GcHeight(normalize(d + t2 * e / _GcPlanet.w)) - h;
o.dir = d;
o.normalWS = normalize(d - (t1 * slope1 + t2 * slope2) / e);
o.positionWS = _GcPlanet.xyz + d * (_GcPlanet.w + h);
o.positionCS = TransformWorldToHClip(o.positionWS);
o.fog = ComputeFogFactor(o.positionCS.z);
return o;
}
// metres to the nearest sector border (the same lattice as HexGrid.cs)
float HexEdge(float3 d)
{
int f = 0;
float best = -2;
for (int k = 0; k < 20; k++)
{
float dt = dot(_GcIcoN[k].xyz, d);
if (dt > best) { best = dt; f = k; }
}
float3 w = float3(dot(_GcIcoR0[f].xyz, d), dot(_GcIcoR1[f].xyz, d), dot(_GcIcoR2[f].xyz, d));
w *= 128.0 / (w.x + w.y + w.z);
float3 r = round(w), e = abs(r - w);
if (e.x > e.y && e.x > e.z) r.x = 128 - r.y - r.z;
else if (e.y > e.z) r.y = 128 - r.x - r.z;
else r.z = 128 - r.x - r.y;
float3 o = w - r;
return (1 - max(abs(o.x - o.y), max(abs(o.y - o.z), abs(o.z - o.x)))) * 13.0;
}
half4 frag(Varyings i) : SV_Target
{
float3 p = i.positionWS;
float n1 = SAMPLE_TEXTURE3D(_GcNoise3, sampler_GcNoise3, p * 0.25 / 64.0).r;
float n2 = SAMPLE_TEXTURE3D(_GcNoise3, sampler_GcNoise3, p * 1.3 / 64.0).g;
float n3 = SAMPLE_TEXTURE3D(_GcNoise3, sampler_GcNoise3, p * 6.0 / 64.0).b;
// meadow floor: dark and dense near (the blades stand on it), lighter canopy colour far away
float dist = length(p - _GcCam.xyz);
float3 col = lerp(_Meadow.rgb, _MeadowFar.rgb, smoothstep(40, 150, dist)) * lerp(0.8, 1.15, n1) * lerp(0.9, 1.08, n3);
// steep hillsides are rock
float3 nrm = normalize(i.normalWS);
float3 up = normalize(i.dir);
col = lerp(col, _Rock.rgb * lerp(0.8, 1.1, n2), smoothstep(0.86, 0.72, dot(nrm, up)));
// sector borders: a thin line that fades away instead of breaking up once it is under a pixel wide
float edge = HexEdge(up);
float pixel = max(fwidth(edge), 1e-3);
float line_ = (1 - smoothstep(0.1, 0.1 + pixel, edge)) * saturate(0.16 / pixel);
col = lerp(col, _Border.rgb, line_ * (1 - smoothstep(120, 320, dist)));
Light main = GetMainLight(TransformWorldToShadowCoord(p));
float ndl = saturate(dot(nrm, main.direction));
float3 ambient = SampleSH(_GcSkyOn > 0.5 ? mul((float3x3)_GcSkyRot, nrm) : nrm);
float3 lit = col * (main.color * ndl * lerp(0.3, 1, main.shadowAttenuation) * GcCloudSun(p, _GcTime) + ambient + GcLamp(p));
lit *= GcContact(p);
lit = MixFog(lit, i.fog);
return half4(lit, 1);
}
ENDHLSL
}
Pass
{
Name "DepthOnly"
Tags { "LightMode" = "DepthOnly" }
ZWrite On
ColorMask R
HLSLPROGRAM
#pragma target 4.5
#pragma vertex vert
#pragma fragment frag
struct A { float3 positionOS : POSITION; };
float4 vert(A v) : SV_POSITION { return TransformWorldToHClip(GcSoil(GroundDir(v.positionOS))); }
half frag() : SV_Target { return 0; }
ENDHLSL
}
}
}