From 990612040a7d3e399554422e16f70753cde3d6d7 Mon Sep 17 00:00:00 2001
From: Brandon Haley <brandon.haley94@gmail.com>
Date: Sun, 5 Jan 2025 16:04:51 -0500
Subject: [PATCH] Implemented fix from #91219 in compatibility renderer by
 reversing the z axis in the particle shader.

---
 drivers/gles3/shaders/particles.glsl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl
index 2591937a1da8..bdc28e292e2d 100644
--- a/drivers/gles3/shaders/particles.glsl
+++ b/drivers/gles3/shaders/particles.glsl
@@ -453,14 +453,14 @@ void main() {
 
 					vec3 uvw_pos = vec3(local_pos_bottom / colliders[i].extents.xyz) * 0.5 + 0.5;
 
-					float y = 1.0 - texture(height_field_texture, uvw_pos.xz).r;
+					float y = texture(height_field_texture, uvw_pos.xz).r;
 
 					if (y + EPSILON > uvw_pos.y) {
 						//inside heightfield
 
 						vec3 pos1 = (vec3(uvw_pos.x, y, uvw_pos.z) * 2.0 - 1.0) * colliders[i].extents.xyz;
-						vec3 pos2 = (vec3(uvw_pos.x + DELTA, 1.0 - texture(height_field_texture, uvw_pos.xz + vec2(DELTA, 0)).r, uvw_pos.z) * 2.0 - 1.0) * colliders[i].extents.xyz;
-						vec3 pos3 = (vec3(uvw_pos.x, 1.0 - texture(height_field_texture, uvw_pos.xz + vec2(0, DELTA)).r, uvw_pos.z + DELTA) * 2.0 - 1.0) * colliders[i].extents.xyz;
+						vec3 pos2 = (vec3(uvw_pos.x + DELTA, texture(height_field_texture, uvw_pos.xz + vec2(DELTA, 0)).r, uvw_pos.z) * 2.0 - 1.0) * colliders[i].extents.xyz;
+						vec3 pos3 = (vec3(uvw_pos.x, texture(height_field_texture, uvw_pos.xz + vec2(0, DELTA)).r, uvw_pos.z + DELTA) * 2.0 - 1.0) * colliders[i].extents.xyz;
 
 						normal = normalize(cross(pos1 - pos2, pos1 - pos3));
 						float local_y = (vec3(local_pos / colliders[i].extents.xyz) * 0.5 + 0.5).y;