Fix: EEVEE-Next: Alpha hashed transparency doesn't converge #115620

Merged
Miguel Pozo merged 2 commits from pragma37/blender:pull-eevee-improve-alpha-hashed into main 2023-11-30 20:18:17 +01:00
5 changed files with 24 additions and 4 deletions
Showing only changes of commit 1478c0b2ea - Show all commits

View File

@ -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),

View File

@ -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 = 1.0f;
pragma37 marked this conversation as resolved Outdated

When is alpha_hash_scale set to less than 1?

When is `alpha_hash_scale` set to less than 1?

🤦‍♂️ I've modified it to take the screenshots and committed the wrong version.

🤦‍♂️ I've modified it to take the screenshots and committed the wrong version.
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_);

View File

@ -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()
{

View File

@ -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)

View File

@ -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);