Fix: EEVEE-Next: Artifacts with volume + motion blur

The root cause is still unknown. But replacing the
use of the depth texture by the hiz buffer fixes the
issue.

The issue was apparent on Linux + Mesa + AMD.
This commit is contained in:
Clément Foucault
2024-02-02 14:38:36 +01:00
parent c15d1b8ccb
commit 18a04965fd
3 changed files with 6 additions and 4 deletions

View File

@@ -225,7 +225,7 @@ void VolumeModule::end_sync()
resolve_ps_.shader_set(inst_.shaders.static_shader_get(VOLUME_RESOLVE));
resolve_ps_.bind_resources(inst_.uniform_data);
resolve_ps_.bind_resources(this->result);
resolve_ps_.bind_texture("depth_tx", &inst_.render_buffers.depth_tx);
resolve_ps_.bind_resources(inst_.hiz_buffer.front);
resolve_ps_.bind_image(RBUFS_COLOR_SLOT, &inst_.render_buffers.rp_color_tx);
resolve_ps_.bind_image(RBUFS_VALUE_SLOT, &inst_.render_buffers.rp_value_tx);
/* Sync with the integration pass. */
@@ -277,6 +277,8 @@ void VolumeModule::draw_resolve(View &view)
return;
}
inst_.hiz_buffer.update();
resolve_fb_.ensure(GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(inst_.render_buffers.combined_tx));
resolve_fb_.bind();

View File

@@ -11,8 +11,8 @@
void main()
{
vec2 uvs = gl_FragCoord.xy / vec2(textureSize(depth_tx, 0));
float scene_depth = texture(depth_tx, uvs).r;
vec2 uvs = gl_FragCoord.xy * uniform_buf.volumes.viewport_size_inv;
float scene_depth = texelFetch(hiz_tx, ivec2(gl_FragCoord.xy), 0).r;
VolumeResolveSample vol = volume_resolve(
vec3(uvs, scene_depth), volume_transmittance_tx, volume_scattering_tx);

View File

@@ -94,8 +94,8 @@ GPU_SHADER_CREATE_INFO(eevee_volume_resolve)
.additional_info("eevee_volume_lib")
.additional_info("draw_fullscreen")
.additional_info("eevee_render_pass_out")
.additional_info("eevee_hiz_data")
.fragment_source("eevee_volume_resolve_frag.glsl")
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0)
.fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1)
/** TODO(Miguel Pozo): Volume RenderPasses. */