From 27a36ccc0f8ce7cdba7af55be7313ed759649b95 Mon Sep 17 00:00:00 2001 From: Miguel Pozo Date: Wed, 13 Sep 2023 21:05:46 +0200 Subject: [PATCH] Fix: EEVEE-Next: SSS image rendering Compute SSS samples location at the render function, once sampling.rng functions return valid data. --- source/blender/draw/engines/eevee_next/eevee_subsurface.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/eevee_subsurface.cc b/source/blender/draw/engines/eevee_next/eevee_subsurface.cc index e2741d07ff8..ef3dfd2a2a2 100644 --- a/source/blender/draw/engines/eevee_next/eevee_subsurface.cc +++ b/source/blender/draw/engines/eevee_next/eevee_subsurface.cc @@ -29,8 +29,6 @@ void SubsurfaceModule::end_sync() data_.sample_len = 55; } - precompute_samples_location(); - subsurface_ps_.init(); subsurface_ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_STENCIL_EQUAL | DRW_STATE_BLEND_ADD_FULL); @@ -51,6 +49,8 @@ void SubsurfaceModule::end_sync() void SubsurfaceModule::render(View &view, Framebuffer &fb, Texture &diffuse_light_tx) { + precompute_samples_location(); + fb.bind(); diffuse_light_tx_ = *&diffuse_light_tx; inst_.manager->submit(subsurface_ps_, view); @@ -74,6 +74,8 @@ void SubsurfaceModule::precompute_samples_location() data_.samples[i].y = sinf(theta) * r; data_.samples[i].z = 1.0f / burley_pdf(d, r); } + + inst_.push_uniform_data(); } const Vector &SubsurfaceModule::transmittance_profile()