Eevee-Next: World Reflective Light #108149
|
@ -8,13 +8,16 @@ namespace blender::eevee {
|
|||
|
||||
void ReflectionProbeModule::init()
|
||||
{
|
||||
cubemaps_tx_.ensure_cube_array(GPU_RGBA16F,
|
||||
max_resolution_,
|
||||
max_probes_,
|
||||
GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT,
|
||||
NULL,
|
||||
max_mipmap_levels_);
|
||||
GPU_texture_mipmap_mode(cubemaps_tx_, true, true);
|
||||
if (!initialized_) {
|
||||
cubemaps_tx_.ensure_cube_array(GPU_RGBA16F,
|
||||
max_resolution_,
|
||||
max_probes_,
|
||||
GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT,
|
||||
NULL,
|
||||
max_mipmap_levels_);
|
||||
GPU_texture_mipmap_mode(cubemaps_tx_, true, true);
|
||||
initialized_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace blender::eevee
|
||||
|
|
|
@ -41,6 +41,10 @@ class ReflectionProbeModule {
|
|||
|
||||
Texture cubemaps_tx_ = {"Probes"};
|
||||
|
||||
bool initialized_ = false;
|
||||
|
||||
bool do_world_update_ = false;
|
||||
|
||||
public:
|
||||
ReflectionProbeModule(Instance &instance) : instance_(instance) {}
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
|
||||
|
||||
|
@ -51,7 +55,17 @@ class ReflectionProbeModule {
|
|||
pass->bind_texture(REFLECTION_PROBE_TEX_SLOT, cubemaps_tx_);
|
||||
}
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Clément Foucault
commented
I don't know if this is covered by the next patch, but this should become an option. I don't know if this is covered by the next patch, but this should become an option.
Jeroen Bakker
commented
Yes, that will be part of the reflection probe baking patch. Might even land earlier when specific parts of that patch are stable. Currently this part isn't stable to land in main yet. Yes, that will be part of the reflection probe baking patch. Might even land earlier when specific parts of that patch are stable. Currently this part isn't stable to land in main yet.
|
||||
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Clément Foucault
commented
Maybe derive it from Maybe derive it from `MAX_RESOLUTION` ? `log2(MAX_RESOLUTION) + 1`
|
||||
void do_world_update_set(bool value)
|
||||
{
|
||||
do_world_update_ = value;
|
||||
}
|
||||
|
||||
private:
|
||||
bool do_world_update_get() const
|
||||
{
|
||||
return do_world_update_;
|
||||
}
|
||||
|
||||
/* Capture View requires access to the cubemaps texture for framebuffer configuration. */
|
||||
friend class CaptureView;
|
||||
};
|
||||
|
|
|
@ -195,9 +195,10 @@ void ShadingView::update_view()
|
|||
|
||||
void CaptureView::render()
|
||||
{
|
||||
if (!world_capture_enable_) {
|
||||
if (!inst_.reflection_probes.do_world_update_get()) {
|
||||
Clément Foucault
commented
Replace by Replace by `inst_.reflection_probes.do_world_update`.
|
||||
return;
|
||||
}
|
||||
inst_.reflection_probes.do_world_update_set(false);
|
||||
|
||||
GPU_debug_group_begin("World.Capture");
|
||||
View view = {"World.Capture.View"};
|
||||
|
@ -209,14 +210,12 @@ void CaptureView::render()
|
|||
GPU_framebuffer_bind(capture_fb_);
|
||||
|
||||
float4x4 view_m4 = cubeface_mat(face);
|
||||
float4x4 win_m4;
|
||||
cubeface_winmat_get(win_m4, 1.0f, 10.0f);
|
||||
float4x4 win_m4 = math::projection::perspective(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 10.0f);
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Clément Foucault
commented
use use `math::projection::perspective()`
|
||||
view.sync(view_m4, win_m4);
|
||||
inst_.pipelines.world.render(view);
|
||||
}
|
||||
GPU_texture_update_mipmap_chain(inst_.reflection_probes.cubemaps_tx_);
|
||||
GPU_debug_group_end();
|
||||
world_capture_enable_ = false;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -153,16 +153,9 @@ class CaptureView {
|
|||
Instance &inst_;
|
||||
Framebuffer capture_fb_ = {"World.Capture"};
|
||||
|
||||
bool world_capture_enable_ = false;
|
||||
|
||||
public:
|
||||
CaptureView(Instance &inst) : inst_(inst) {}
|
||||
void render();
|
||||
|
||||
void world_capture_enable(bool enable)
|
||||
{
|
||||
world_capture_enable_ = enable;
|
||||
}
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -90,7 +90,7 @@ void World::sync()
|
|||
WorldHandle &wo_handle = inst_.sync.sync_world(bl_world);
|
||||
|
||||
if (wo_handle.recalc != 0) {
|
||||
inst_.capture_view.world_capture_enable(true);
|
||||
inst_.reflection_probes.do_world_update_set(true);
|
||||
}
|
||||
wo_handle.reset_recalc_flag();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Style: No uppercase