WIP: eevee-next-world-irradiance #108304

Closed
Jeroen Bakker wants to merge 79 commits from Jeroen-Bakker:eevee-next-world-irradiance into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 25 additions and 13 deletions
Showing only changes of commit 4ad77fcc74 - Show all commits

View File

@ -452,11 +452,12 @@ void Instance::update_passes(RenderEngine *engine, Scene *scene, ViewLayer *view
EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL); EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL);
} }
void Instance::light_bake_irradiance(Object &probe, void Instance::light_bake_irradiance(
std::function<void()> context_enable, Object &probe,
std::function<void()> context_disable, std::function<void()> context_enable,
std::function<bool()> stop, std::function<void()> context_disable,
std::function<void(LightProbeGridCacheFrame *)> result_update) std::function<bool()> stop,
std::function<void(LightProbeGridCacheFrame *, float progress)> result_update)
{ {
BLI_assert(is_baking()); BLI_assert(is_baking());
@ -508,7 +509,10 @@ void Instance::light_bake_irradiance(Object &probe,
else { else {
cache_frame = irradiance_cache.bake.read_result_packed(); cache_frame = irradiance_cache.bake.read_result_packed();
} }
result_update(cache_frame);
float bounce_progress = sampling.sample_index() / float(sampling.sample_count());
float progress = (bounce - 1 + bounce_progress) / float(bounce_len);
result_update(cache_frame, progress);
}); });
if (stop()) { if (stop()) {

View File

@ -146,11 +146,12 @@ class Instance {
/* Light bake. */ /* Light bake. */
void init_light_bake(Depsgraph *depsgraph, draw::Manager *manager); void init_light_bake(Depsgraph *depsgraph, draw::Manager *manager);
void light_bake_irradiance(Object &probe, void light_bake_irradiance(
std::function<void()> context_enable, Object &probe,
std::function<void()> context_disable, std::function<void()> context_enable,
std::function<bool()> stop, std::function<void()> context_disable,
std::function<void(LightProbeGridCacheFrame *)> result_update); std::function<bool()> stop,
std::function<void(LightProbeGridCacheFrame *, float progress)> result_update);
static void update_passes(RenderEngine *engine, Scene *scene, ViewLayer *view_layer); static void update_passes(RenderEngine *engine, Scene *scene, ViewLayer *view_layer);

View File

@ -156,7 +156,7 @@ class LightBake {
[this]() { context_enable(); }, [this]() { context_enable(); },
[this]() { context_disable(); }, [this]() { context_disable(); },
[&]() { return (G.is_break == true) || ((stop != nullptr) ? *stop : false); }, [&]() { return (G.is_break == true) || ((stop != nullptr) ? *stop : false); },
[&](LightProbeGridCacheFrame *cache_frame) { [&](LightProbeGridCacheFrame *cache_frame, float grid_progress) {
{ {
std::scoped_lock lock(result_mutex_); std::scoped_lock lock(result_mutex_);
/* Delete any existing cache that wasn't transferred to the original object. */ /* Delete any existing cache that wasn't transferred to the original object. */
@ -171,7 +171,7 @@ class LightBake {
} }
if (progress) { if (progress) {
/* TODO: Update progress. */ *progress = (i + grid_progress) / original_probes_.size();
} }
}); });

View File

@ -129,11 +129,18 @@ class Sampling {
return interactive_mode_; return interactive_mode_;
} }
/* Target sample count. */
uint64_t sample_count() const uint64_t sample_count() const
{ {
return sample_count_; return sample_count_;
} }
/* 0 based current sample. Might not increase sequentially in viewport. */
uint64_t sample_index() const
{
return sample_;
}
/* Return true if we are starting a new motion blur step. We need to run sync again since /* Return true if we are starting a new motion blur step. We need to run sync again since
* depsgraph was updated by MotionBlur::step(). */ * depsgraph was updated by MotionBlur::step(). */
bool do_render_sync() const bool do_render_sync() const