summaryrefslogtreecommitdiffstats
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorConor Lawton <conor.lawton1@gmail.com>2023-09-05 12:52:13 +0100
committerConor Lawton <conor.lawton1@gmail.com>2023-09-08 20:01:57 +0100
commit9ecafcc491515665430cb862f9ad59229b2c02cd (patch)
tree299446406942ffdff04b7bfbfc57841f6541e65e /drivers/gles3/shaders
parent75de1ca76871fdf7f5a9e081aa57ec0e33061107 (diff)
downloadredot-engine-9ecafcc491515665430cb862f9ad59229b2c02cd.tar.gz
Fixed z-billboard-y-velocity to correctly respect non-uniform scale instead of averaging scale
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r--drivers/gles3/shaders/particles_copy.glsl7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gles3/shaders/particles_copy.glsl b/drivers/gles3/shaders/particles_copy.glsl
index 774aa139b3..0bb8efc52d 100644
--- a/drivers/gles3/shaders/particles_copy.glsl
+++ b/drivers/gles3/shaders/particles_copy.glsl
@@ -84,7 +84,6 @@ void main() {
} break;
case TRANSFORM_ALIGN_Z_BILLBOARD_Y_TO_VELOCITY: {
vec3 sv = velocity_flags.xyz - sort_direction * dot(sort_direction, velocity_flags.xyz); //screen velocity
- float s = (length(txform[0]) + length(txform[1]) + length(txform[2])) / 3.0;
if (length(sv) == 0.0) {
sv = align_up;
@@ -92,9 +91,9 @@ void main() {
sv = normalize(sv);
- txform[0].xyz = normalize(cross(sv, sort_direction)) * s;
- txform[1].xyz = sv * s;
- txform[2].xyz = sort_direction * s;
+ txform[0].xyz = normalize(cross(sv, sort_direction)) * length(txform[0]);
+ txform[1].xyz = sv * length(txform[1]);
+ txform[2].xyz = sort_direction * length(txform[2]);
} break;
}