summaryrefslogtreecommitdiffstats
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-09-08 23:14:27 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-09-08 23:14:27 +0200
commit3815b2f98e51f918d6d4526547fdcedd40491c76 (patch)
tree09cfbf731532d0c4612ea20758e143ead64a94f5 /drivers/gles3/shaders
parent5fef875cd85492ab15177f5b3ff8a8b177c6656c (diff)
parent9ecafcc491515665430cb862f9ad59229b2c02cd (diff)
downloadredot-engine-3815b2f98e51f918d6d4526547fdcedd40491c76.tar.gz
Merge pull request #81315 from conorlawton/z-billboard-y-velocity-no-scale
Fix z-billboard + y to velocity transform alignment to correctly respect non-uniform 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;
}