diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-08-19 15:34:01 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-08-19 15:40:51 +0300 |
commit | 51862c8445c8d5f573d1c86780db9e0972ef14dd (patch) | |
tree | 5dbcf975fde4b4ef9a348b8695bcc5aa9a09abab /source/blender/render | |
parent | 5b97c00e9fc4e1e5d6cdfa7130eab5aada0e068e (diff) |
Cycles: experimental integration of Alembic procedural in viewport rendering
This patch exposes the Cycles Alembic Procedural through the MeshSequenceCache
modifier in order to use and test it from Blender.
To enable it, one has to switch the render feature set to experimental and
activate the Procedural in the modifier. An Alembic Procedural is then
created for each CacheFile from Blender set to use the Procedural, and each
Blender object having a MeshSequenceCache modifier is added to list of objects
of the right procedural.
The procedural's parameters derive from the CacheFile's properties which are
already exposed in the UI through the modifier, although more Cycles specific
options might be added in the future.
As there is currently no cache controls and since we load all the data at the
beginning of the render session, the procedural is only available during
viewport renders at the moment. When an Alembic procedural is rendered, data
from the archive are not read on the Blender side.
If a Cycles render is not active and the CacheFile is set to use the Cycles Procedural,
bounding boxes are used to display the objects in the scene as a signal that the
objects are not processed by Blender anymore. This is standard in other DCCs.
However this does not reduce the memory usage from Blender as the Alembic data
was already loaded either during an import or during a .blend file read.
This is mostly a hack to test the Cycles Alembic procedural until we have a
better Blender side mechanism for letting renderers load their own geometry,
which will be based on import and export settings on Collections (T68933).
Ref T79174, D3089
Reviewed By: brecht, sybren
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D10197
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/RE_engine.h | 7 | ||||
-rw-r--r-- | source/blender/render/intern/engine.c | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/render/RE_engine.h b/source/blender/render/RE_engine.h index 6b2861bbefd..dfc0d5d0e9f 100644 --- a/source/blender/render/RE_engine.h +++ b/source/blender/render/RE_engine.h @@ -66,6 +66,7 @@ extern "C" { #define RE_USE_GPU_CONTEXT 512 #define RE_USE_CUSTOM_FREESTYLE 1024 #define RE_USE_NO_IMAGE_SAVE 2048 +#define RE_USE_ALEMBIC_PROCEDURAL 4096 /* RenderEngine.flag */ #define RE_ENGINE_ANIMATION 1 @@ -235,6 +236,12 @@ void RE_engines_register(RenderEngineType *render_type); bool RE_engine_is_opengl(RenderEngineType *render_type); +/** + * Return true if the RenderEngineType has native support for direct loading of Alembic data. For + * Cycles, this also checks that the experimental feature set is enabled. + */ +bool RE_engine_supports_alembic_procedural(const RenderEngineType *render_type, Scene *scene); + RenderEngineType *RE_engines_find(const char *idname); rcti *RE_engine_get_current_tiles(struct Render *re, int *r_total_tiles, bool *r_needs_free); diff --git a/source/blender/render/intern/engine.c b/source/blender/render/intern/engine.c index 657cd1f606b..75b3f2db249 100644 --- a/source/blender/render/intern/engine.c +++ b/source/blender/render/intern/engine.c @@ -128,6 +128,19 @@ bool RE_engine_is_opengl(RenderEngineType *render_type) return (render_type->draw_engine != NULL) && DRW_engine_render_support(render_type->draw_engine); } +bool RE_engine_supports_alembic_procedural(const RenderEngineType *render_type, Scene *scene) +{ + if ((render_type->flag & RE_USE_ALEMBIC_PROCEDURAL) == 0) { + return false; + } + + if (BKE_scene_uses_cycles(scene) && !BKE_scene_uses_cycles_experimental_features(scene)) { + return false; + } + + return true; +} + /* Create, Free */ RenderEngine *RE_engine_create(RenderEngineType *type) |