diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-09-08 23:14:27 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-09-08 23:14:27 +0200 |
commit | 3815b2f98e51f918d6d4526547fdcedd40491c76 (patch) | |
tree | 09cfbf731532d0c4612ea20758e143ead64a94f5 /drivers/gles3/shaders | |
parent | 5fef875cd85492ab15177f5b3ff8a8b177c6656c (diff) | |
parent | 9ecafcc491515665430cb862f9ad59229b2c02cd (diff) | |
download | redot-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.glsl | 7 |
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; } |