diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-02-23 08:01:28 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-02-23 08:06:54 +0300 |
commit | 82605093e9bf3b68f6a218d46660ed62ea89816d (patch) | |
tree | 0f7842479742bdf092f100a85140b42cc38d791c /intern/cycles | |
parent | 87ef03745971e1c860894ddc18172a183f42ed26 (diff) |
Alembic procedural: avoid storing constant hair topology for each frame
Only store the curve keys and radiuses for each frame if the topology does not change through time, this helps saving quit a bit of memory.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/render/alembic.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/intern/cycles/render/alembic.cpp b/intern/cycles/render/alembic.cpp index 13144f46314..627ffe2318a 100644 --- a/intern/cycles/render/alembic.cpp +++ b/intern/cycles/render/alembic.cpp @@ -966,6 +966,8 @@ void AlembicObject::load_all_data(AlembicProcedural *proc, array<int> curve_first_key; array<int> curve_shader; + const bool is_homogenous = schema.getTopologyVariance() == kHomogenousTopology; + curve_keys.reserve(position->size()); curve_radius.reserve(position->size()); curve_first_key.reserve(curves_num_vertices->size()); @@ -986,16 +988,21 @@ void AlembicObject::load_all_data(AlembicProcedural *proc, curve_radius.push_back_reserved(radius * radius_scale); } - curve_first_key.push_back_reserved(offset); - curve_shader.push_back_reserved(0); + if (!is_homogenous || cached_data.curve_first_key.size() == 0) { + curve_first_key.push_back_reserved(offset); + curve_shader.push_back_reserved(0); + } offset += num_vertices; } cached_data.curve_keys.add_data(curve_keys, time); cached_data.curve_radius.add_data(curve_radius, time); - cached_data.curve_first_key.add_data(curve_first_key, time); - cached_data.curve_shader.add_data(curve_shader, time); + + if (!is_homogenous || cached_data.curve_first_key.size() == 0) { + cached_data.curve_first_key.add_data(curve_first_key, time); + cached_data.curve_shader.add_data(curve_shader, time); + } } // TODO(@kevindietrich): attributes, need example files |