Blender Git Loki

Git Commits -> Revision 38dd9db

February 5, 2021, 15:40 (GMT)
Geometry Nodes: Instances API, support in point distribute node

This patch changes the object info node to always output an instance.
Theoretically, this change should be invisible to the user, because
we plan to make instances real on demand. The benefit is improved
performance because we can avoiding copying the input geometry when
it's only needed for read operations.

To make this work, we need a proper API to enable recursive reading
of instanced geometry. This is essential, because we can even have
collection instances in the `InstancesComponent`, which have no
geometry of their own. And then any object in that collection could
also contain an instance with a reference to another collection, etc.
That might seem crazy, but it's essential for many more complicated
workflows like the tree sample file.

Another consideration is that currently, every single instance contains
a reference to its data. This is inefficient since most of the time
there are many locations and only a few sets of unique data. When we
add the ability to instance a geometry set directly, this will be
more important. So this patch adds a `GeometryInstanceGroup` to support
this future optimization.

Two APIs to the instances component are provided here. First is a
callback approach that executes a function for every "final" geometry
set. This can be used to optimize for many instances, to avoid heap
allocations for each instance.

The second API is one that returns a vector of `GeometryInstanceGroup`.
This may be less efficient when there are many instances, but it makes
more complicated operations like point distribution that need to iterate
over input geometry multiple times much simpler.

Even then, this patch makes the point distribute code much more
complicated. It may be possible to simplify it further.

The last TODO is support for making instances real on demand, which
I am currently working on. The change to the object info node can't
land without it. The transform spaces may be incorrect too.

Differential Revision: https://developer.blender.org/D10327

Commit Details:

Full Hash: 38dd9db9af0514c7d9d1255564016307650d8347
Parent Commits: 134d55a, 4d39a0f

Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021