summaryrefslogtreecommitdiffstats
path: root/Shaders/grass
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-11-19 17:01:52 -0800
committeryum <yum.food.vr@gmail.com>2023-11-19 17:01:52 -0800
commitdb026d39d481d22155afc1ac9eda0b4496c9f7c2 (patch)
tree07d66dc4a350c174581044c8192b2f95c04dd2b7 /Shaders/grass
parent7bb1910e7ababa58299de4e00d75f1e894326ec7 (diff)
Delete far-away grass in geometry shader
Diffstat (limited to 'Shaders/grass')
-rw-r--r--Shaders/grass/grass_lighting.cginc5
1 files changed, 5 insertions, 0 deletions
diff --git a/Shaders/grass/grass_lighting.cginc b/Shaders/grass/grass_lighting.cginc
index d243763..8b6e3a1 100644
--- a/Shaders/grass/grass_lighting.cginc
+++ b/Shaders/grass/grass_lighting.cginc
@@ -104,6 +104,11 @@ void geom(triangle v2f tri_in[3],
v1.worldPos += float3(xoff, 0, yoff);
v2.worldPos += float3(xoff, 0, yoff);
+ // Don't bother rendering geometry if it's too far away.
+ if (length(v0.worldPos - _WorldSpaceCameraPos) > 35) {
+ continue;
+ }
+
// Omit polygons in blacklisted regions.
{
float2 p0 = float2(-4, 0);