From 87ce1a7351da490571de518590998d4b803fe344 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 28 Jan 2021 23:30:24 +0000 Subject: [PATCH] Explain stomp constants --- files/shaders/groundcover_vertex.glsl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/shaders/groundcover_vertex.glsl b/files/shaders/groundcover_vertex.glsl index 9cba204d69..d7d221e45f 100644 --- a/files/shaders/groundcover_vertex.glsl +++ b/files/shaders/groundcover_vertex.glsl @@ -68,8 +68,10 @@ vec2 groundcoverDisplacement(in vec3 worldpos, float h) float d = length(worldpos.xy - footPos.xy); #endif vec2 stomp = vec2(0.0); - if (d < 150.0 && d > 0.0) - stomp = (60.0 / d - 0.4) * (worldpos.xy - footPos.xy); + const float STOMP_RANGE = 150.0; // maximum distance from player that grass is affected by stomping + const float STOMP_DISTANCE = 60.0; // maximum distance stomping can move grass + if (d < STOMP_RANGE && d > 0.0) + stomp = (STOMP_DISTANCE / d - STOMP_DISTANCE / STOMP_RANGE) * (worldpos.xy - footPos.xy); #if 1 stomp *= clamp((worldpos.z - footPos.z) / h, 0.0, 1.0);