diff options
author | Andreas Raddau <raddau@robopoets.com> | 2022-07-29 16:52:54 +0200 |
---|---|---|
committer | Andreas Raddau <raddau@robopoets.com> | 2022-07-29 16:52:54 +0200 |
commit | dfc6035ce1073b46080f9f8e4339c36b007bd35d (patch) | |
tree | 5ba654c2153812070e66b68635557332054feb6d /servers | |
parent | cd24fb848e5727ebc7ccbcd0fc94112c6baed4f2 (diff) |
Fix vector field particle attractor texture sampling
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/particles.glsl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/servers/rendering/renderer_rd/shaders/particles.glsl b/servers/rendering/renderer_rd/shaders/particles.glsl index 4369bddc83..fb5759bc17 100644 --- a/servers/rendering/renderer_rd/shaders/particles.glsl +++ b/servers/rendering/renderer_rd/shaders/particles.glsl @@ -458,11 +458,11 @@ void main() { } break; case ATTRACTOR_TYPE_VECTOR_FIELD: { - vec3 uvw_pos = (local_pos / FRAME.attractors[i].extents) * 2.0 - 1.0; + vec3 uvw_pos = (local_pos / FRAME.attractors[i].extents + 1.0) * 0.5; if (any(lessThan(uvw_pos, vec3(0.0))) || any(greaterThan(uvw_pos, vec3(1.0)))) { continue; } - vec3 s = texture(sampler3D(sdf_vec_textures[FRAME.attractors[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos).xyz; + vec3 s = texture(sampler3D(sdf_vec_textures[FRAME.attractors[i].texture_index], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw_pos).xyz * 2.0 - 1.0; dir = mat3(FRAME.attractors[i].transform) * safe_normalize(s); //revert direction amount = length(s); |