diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-06-02 17:27:19 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-06-03 16:15:06 +0300 |
commit | 14df74ea8b60c0feb8b333faad257c57f691c015 (patch) | |
tree | 0c54bc8f3c99f2884a3fa5279ce3fe3a935c37b1 /source/blender/draw/engines/eevee/eevee_instance.cc | |
parent | 060c462f3ae3a38ad0a8a4833844e954a6bcc23a (diff) |
EEVEE: LightCache: Port baking
Some things differs from old implementation.
- Object visibility is filtered correctly without using a visibility
callback (which is to be removed).
The implementation is also more high level using less low level tricks.
A dedicated LightProbeView is created for each lightprobe cubeface to
render using all pipeline (deferred and forward).
There is still a few things not working.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_instance.cc')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_instance.cc | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_instance.cc b/source/blender/draw/engines/eevee/eevee_instance.cc index 893c5ba921e..e388b368be1 100644 --- a/source/blender/draw/engines/eevee/eevee_instance.cc +++ b/source/blender/draw/engines/eevee/eevee_instance.cc @@ -26,6 +26,7 @@ #include "BLI_rect.h" #include "DEG_depsgraph_query.h" #include "DNA_ID.h" +#include "DNA_lightprobe_types.h" #include "eevee_instance.hh" @@ -45,14 +46,13 @@ void Instance::init(const ivec2 &output_res, const rcti *output_rect, RenderEngine *render_, Depsgraph *depsgraph_, + const struct LightProbe *light_probe_, Object *camera_object_, const RenderLayer *render_layer_, const DRWView *drw_view_, const View3D *v3d_, const RegionView3D *rv3d_) { - BLI_assert(camera_object_ || drw_view_); - render = render_; depsgraph = depsgraph_; render_layer = render_layer_; @@ -60,6 +60,7 @@ void Instance::init(const ivec2 &output_res, drw_view = drw_view_; v3d = v3d_; rv3d = rv3d_; + baking_probe = light_probe_; update_eval_members(); @@ -100,7 +101,9 @@ void Instance::update_eval_members(void) { scene = DEG_get_evaluated_scene(depsgraph); view_layer = DEG_get_evaluated_view_layer(depsgraph); - camera_eval_object = DEG_get_evaluated_object(depsgraph, camera_orig_object); + camera_eval_object = (camera_orig_object) ? + DEG_get_evaluated_object(depsgraph, camera_orig_object) : + nullptr; } /** \} */ @@ -108,7 +111,7 @@ void Instance::update_eval_members(void) /* -------------------------------------------------------------------- */ /** \name Sync * - * Sync with gather data from the scene that can change over a time step (i.e: motion steps). + * Sync will gather data from the scene that can change over a time step (i.e: motion steps). * IMPORTANT: xxx.sync() functions area responsible for creating DRW resources (i.e: DRWView) as * well as querying temp texture pool. All DRWPasses should be ready by the end end_sync(). * \{ */ @@ -180,7 +183,26 @@ void Instance::object_sync_render(void *instance_, Depsgraph *depsgraph) { UNUSED_VARS(engine, depsgraph); - reinterpret_cast<Instance *>(instance_)->object_sync(ob); + + Instance &inst = *reinterpret_cast<Instance *>(instance_); + + if (inst.baking_probe != nullptr) { + if (inst.baking_probe->visibility_grp != nullptr) { + bool test = BKE_collection_has_object_recursive(inst.baking_probe->visibility_grp, ob); + test = (inst.baking_probe->flag & LIGHTPROBE_FLAG_INVERT_GROUP) ? !test : test; + if (!test) { + return; + } + } + /* Exclude planar lightprobes. */ + if (ob->type == OB_LIGHTPROBE) { + LightProbe *prb = (LightProbe *)ob->data; + if (prb->type == LIGHTPROBE_TYPE_PLANAR) { + return; + } + } + } + inst.object_sync(ob); } void Instance::end_sync(void) @@ -189,6 +211,7 @@ void Instance::end_sync(void) lights.end_sync(); sampling.end_sync(); render_passes.end_sync(); + lightprobes.end_sync(); } void Instance::render_sync(void) |