diff --git a/source/blender/draw/engines/eevee_next/eevee_instance.hh b/source/blender/draw/engines/eevee_next/eevee_instance.hh index 6ca01c14147..af844b6a39f 100644 --- a/source/blender/draw/engines/eevee_next/eevee_instance.hh +++ b/source/blender/draw/engines/eevee_next/eevee_instance.hh @@ -119,7 +119,7 @@ class Instance { sync(*this), materials(*this), subsurface(*this, global_ubo_.subsurface), - pipelines(*this), + pipelines(*this, global_ubo_.pipeline), shadows(*this, global_ubo_.shadow), lights(*this), ambient_occlusion(*this, global_ubo_.ao), diff --git a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc index 02cb048bfec..f4cbecf7826 100644 --- a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc +++ b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc @@ -417,6 +417,10 @@ void DeferredLayer::begin_sync() /* Textures. */ prepass_ps_.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx); + inst_.pipelines.data.alpha_hash_scale = 0.1f; + if (inst_.is_viewport() && inst_.velocity.camera_has_motion()) { + inst_.pipelines.data.alpha_hash_scale = 1.0f; + } inst_.bind_uniform_data(&prepass_ps_); inst_.velocity.bind_resources(prepass_ps_); inst_.sampling.bind_resources(prepass_ps_); diff --git a/source/blender/draw/engines/eevee_next/eevee_pipeline.hh b/source/blender/draw/engines/eevee_next/eevee_pipeline.hh index 86b10e98d86..5f189a5bd0e 100644 --- a/source/blender/draw/engines/eevee_next/eevee_pipeline.hh +++ b/source/blender/draw/engines/eevee_next/eevee_pipeline.hh @@ -593,9 +593,10 @@ class PipelineModule { CapturePipeline capture; UtilityTexture utility_tx; + PipelineInfoData &data; public: - PipelineModule(Instance &inst) + PipelineModule(Instance &inst, PipelineInfoData &data) : background(inst), world(inst), world_volume(inst), @@ -605,7 +606,8 @@ class PipelineModule { forward(inst), shadow(inst), volume(inst), - capture(inst){}; + capture(inst), + data(data){}; void begin_sync() { diff --git a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh index b5204a197a7..b5f81f3d1d3 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh +++ b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh @@ -1394,7 +1394,19 @@ struct ProbePlanarDisplayData { BLI_STATIC_ASSERT_ALIGN(ProbePlanarDisplayData, 16) /** \} */ +/* -------------------------------------------------------------------- */ +/** \name Pipeline Data + * \{ */ +struct PipelineInfoData { + float alpha_hash_scale; + float _pad0; + float _pad1; + float _pad3; +}; +BLI_STATIC_ASSERT_ALIGN(PipelineInfoData, 16) + +/** \} */ /* -------------------------------------------------------------------- */ /** \name Uniform Data * \{ */ @@ -1410,6 +1422,7 @@ struct UniformData { ShadowSceneData shadow; SubsurfaceData subsurface; VolumesInfoData volumes; + PipelineInfoData pipeline; }; BLI_STATIC_ASSERT_ALIGN(UniformData, 16) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_surf_depth_frag.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_surf_depth_frag.glsl index 9fac616d64d..b5d55177d45 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_surf_depth_frag.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_surf_depth_frag.glsl @@ -38,7 +38,8 @@ void main() float threshold = 0.0; # else float noise_offset = sampling_rng_1D_get(SAMPLING_TRANSPARENCY); - float threshold = transparency_hashed_alpha_threshold(1.0, noise_offset, g_data.P); + float threshold = transparency_hashed_alpha_threshold( + uniform_buf.pipeline.alpha_hash_scale, noise_offset, g_data.P); # endif float transparency = average(g_transmittance);