diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-02 07:13:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 07:13:04 +0200 |
commit | bda2274969d704d74bd654c3727077a64b9b79ca (patch) | |
tree | 515d27593cbbaada4ac755cf7a3a00881b18ceb2 /servers | |
parent | 2cdef4d5320dad8600b5764aa7d5aaf1773436f5 (diff) | |
parent | dfc6035ce1073b46080f9f8e4339c36b007bd35d (diff) |
Merge pull request #63627 from and-rad/vector-field-attractor-fix
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); |