Fix: EEVEE-Next: No shading from lights for volume only scenes

The issue was that the shadow module was never setup by any
other pipeline before the volume lighting pass.

Fix #121971
This commit is contained in:
Clément Foucault
2024-05-23 21:20:52 +02:00
parent 427b356b87
commit f46e3d1067
4 changed files with 21 additions and 4 deletions

View File

@@ -308,7 +308,7 @@ class DeferredLayer : DeferredLayerBase {
bool is_empty() const
{
return closure_count_ != 0;
return closure_count_ == 0;
}
/* Returns the radiance buffer to feed the next layer. */
@@ -369,6 +369,11 @@ class DeferredPipeline {
void debug_draw(draw::View &view, GPUFrameBuffer *combined_fb);
bool is_empty() const
{
return opaque_layer_.is_empty() && refraction_layer_.is_empty();
}
private:
void debug_pass_sync();
};

View File

@@ -139,7 +139,7 @@ void ShadingView::render()
inst_.gbuffer.release();
inst_.volume.draw_compute(main_view_);
inst_.volume.draw_compute(main_view_, extent_);
// inst_.lookdev.render_overlay(view_fb_);

View File

@@ -377,11 +377,23 @@ void VolumeModule::draw_prepass(View &main_view)
DRW_stats_group_end();
}
void VolumeModule::draw_compute(View &main_view)
void VolumeModule::draw_compute(View &main_view, int2 extent)
{
if (!enabled_) {
return;
}
if (inst_.pipelines.deferred.is_empty()) {
/* This assume the volume are computed after deferred passes. This is needed to avoid broken
* lighting and shadowing as the lights are not setup otherwise (see #121971). */
inst_.hiz_buffer.swap_layer();
inst_.hiz_buffer.update();
inst_.volume_probes.set_view(main_view);
inst_.sphere_probes.set_view(main_view);
inst_.shadows.set_view(main_view, extent);
printf("here\n");
}
scatter_tx_.swap();
extinction_tx_.swap();

View File

@@ -139,7 +139,7 @@ class VolumeModule {
/* Render material properties. */
void draw_prepass(View &main_view);
/* Compute scattering and integration. */
void draw_compute(View &main_view);
void draw_compute(View &main_view, int2 extent);
/* Final image compositing. */
void draw_resolve(View &view);