Age | Commit message (Collapse) | Author |
|
With this commit, curve objects support the geometry nodes modifier.
Curves objects now evaluate to `CurveEval` unless there was a previous
implicit conversion (tessellating modifiers, mesh modifiers, or the
settings in the curve "Geometry" panel). In the new code, curves are
only considered to be the wire edges-- any generated surface is a mesh
instead, stored in the evaluated geometry set.
The consolidation of concepts mentioned above allows remove a lot of
code that had to do with maintaining the `DispList` type temporarily
for modifiers and rendering. Instead, render engines see a separate
object for the mesh from the mesh geometry component, and when the
curve object evaluates to a curve, the `CurveEval` is always used for
drawing wire edges.
However, currently the `DispList` type is still maintained and used as
an intermediate step in implicit mesh conversion. In the future, more
uses of it could be changed to use `CurveEval` and `Mesh` instead.
This is mostly not changed behavior, it is just a formalization of
existing logic after recent fixes for 2.8 versions last year and two
years ago. Also, in the future more functionality can be converted
to nodes, removing cases of implicit conversions. For more discussion
on that topic, see T89676.
The `use_fill_deform` option is removed. It has not worked properly
since 2.62, and the choice for filling a curve before or after
deformation will work much better and be clearer with a node system.
Applying the geometry nodes modifier to generate a curve is not
implemented with this commit, so applying the modifier won't work
at all. This is a separate technical challenge, and should be solved
in a separate step.
Differential Revision: https://developer.blender.org/D11597
|
|
Previously, the Point Instance node in geometry nodes could only instance
existing objects or collections. The reason was that large parts of Blender
worked under the assumption that objects are the main unit of instancing.
Now we also want to instance geometry within an object, so a slightly larger
refactor was necessary.
This should not affect files that do not use the new kind of instances.
The main change is a redefinition of what "instanced data" is. Now, an
instances is a cow-object + object-data (the geometry). This can be nicely
seen in `struct DupliObject`. This allows the same object to generate
multiple geometries of different types which can be instanced individually.
A nice side effect of this refactor is that having multiple geometry components
is not a special case in the depsgraph object iterator anymore, because those
components are integrated with the `DupliObject` system.
Unfortunately, different systems that work with instances in Blender (e.g.
render engines and exporters) often work under the assumption that objects are
the main unit of instancing. So those have to be updated as well to be able to
handle the new instances. This patch updates Cycles, EEVEE and other viewport
engines. Exporters have not been updated yet. Some minimal (not master-ready)
changes to update the obj and alembic exporters can be found in P2336 and P2335.
Different file formats may want to handle these new instances in different ways.
For users, the only thing that changed is that the Point Instance node now
has a geometry mode.
This also fixes T88454.
Differential Revision: https://developer.blender.org/D11841
|
|
* Reduce code duplication.
* Give methods more standardized names (e.g. `move_to_initialized` -> `move_assign`).
* Support wrapping arbitrary C++ types, even those that e.g. are not copyable.
|
|
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
|
|
This allows us to remove a callback from the modifier type info struct.
In the future the these modifiers might just be replaced by nodes
internally anyway, but in the meantime it's nice to unify the handling
of evaluated geometry a bit.
Differential Revision: https://developer.blender.org/D11080
|
|
Where possible, nodes in the "Geometry" category should support all
geometry component types. This adds support for volumes in the
recently added bounding box node, based on functions added in the
previous two commits.
Differential Revision: https://developer.blender.org/D10906
|
|
Previously, the spreadsheet editor could only show data of the original
and of the final evaluated object. Now it is possible to show the data
at some intermediate stages too.
For that the mode has to be set to "Node" in the spreadsheet editor.
Furthermore, the preview of a specific node has to be activated by
clicking the new icon in the header of geometry nodes.
The exact ui of this feature might be refined in upcoming commits.
It is already very useful for debugging node groups in it's current
state though.
Differential Revision: https://developer.blender.org/D10875
|
|
This removes a lot of unnecessary code that is generated by
the compiler automatically.
In very few cases, a defaulted destructor in a .cc file is
still necessary, because of forward declarations in the header.
I removed some defaulted virtual destructors, because they are not
necessary, when the parent class has a virtual destructor already.
Defaulted constructors are only necessary when there is another
constructor, but the class should still be default constructible.
Differential Revision: https://developer.blender.org/D10911
|
|
Now that object_dupli.cc is a C++ file, we don't have to have a specific
function to retrieve the instance data from the geometry set.
|
|
Previously this was only supported within nested node groups.
Now it is also supported for the root node group that is referenced
by the modifier.
|
|
|
|
This allows us to use it in rna for the spreadsheet editor.
|
|
This was meant to be part of rB9ce950daabbf, but the change dropped from
the set at some point in the process of updating and committing.
Sorry for the noise.
|
|
Previously, functions would have to ask for every geometry type explicitely.
Using a vector is return type is fine. In practice this will probably never
allocate because of the small buffer optimization in vector.
|
|
In an upcoming commit I'll also move the make-instances-real functionality
to this file. This code is not essential to working with geometry sets in general,
so it makes sense to move it to a separate header.
|
|
|
|
This commit makes the geometry output of the collection info usable.
The output is the geometry of a collection instance, but this commit
adds a utility to convert the instances to real geometry, used in the
background whenever it is needed, like copy on write.
The recursive nature of the "realize instances" code is essential,
because collection instances in the `InstancesComponent`, might have no
geometry sets of their own containing even more collection instances,
which might then contain object instances, etc.
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. So this
commit adds a `GeometryInstanceGroup` to support this future optimization.
The API for instances 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.
Any code that needs to change data, like most of the attribute nodes,
can simply call `geometry_set_realize_instances(geometry_set)`,
which will move any geometry in the `InstancesComponent` to new "real"
geometry components.
Many nodes can support read-only access to instances in order to avoid
making them real, this will be addressed where needed in the near future.
Instances from the existing "dupli" system are not supported yet.
Differential Revision: https://developer.blender.org/D10327
|
|
|
|
Ids stored in the `id` attribute cannot be assumed to be unique. While they
might be unique in some cases, this is not something that can be guaranteed
in general. For some use cases (e.g. generating "stable randomness" on points)
uniqueness is not important. To support features like motion blur, unique ids
are important though.
This patch implements a simple algorithm that turns non-unique ids into
unique ones. It might fail to do so under very unlikely circumstances, in
which it returns non-unique ids instead of possibly going into an endless
loop.
Here are some requirements I set for the algorithm:
* Ids that are unique already, must not be changed.
* The same input should generate the same output.
* Handle cases when all ids are different and when all ids are the same
equally well (in expected linear time).
* Small changes in the input id array should ideally only have a small
impact on the output id array.
The reported bug happened because cycles found multiple objects with
the same id and thought that it was a single object that moved on every
check.
Differential Revision: https://developer.blender.org/D10402
|
|
Goals:
* Clarify the distinction between builtin and other attributes at the code level.
* Reduce number of places that need to be modified to add more builtin attributes.
* Reduce number of virtual methods that need to be implemented by e.g. `MeshComponent`.
To achieve these goals, this patch implements the concept of "attribute providers".
An attribute provider knows how to give access to attributes on a geometry component.
Each geometry component can have multiple attribute providers, whereby each provider
manages an different set of attributes.
The separation of builtin and other attributes is now done at the attribute provider level.
There are two types of attribute providers. One for builtin attributes and one for all others.
This refactor also helps with T84297.
Differential Revision: https://developer.blender.org/D10341
|
|
|
|
Because the the vertex group name-to-index map is stored in the object
rather than object data, the object info node has to replace the
map when it replaces the mesh component on the geometry set with mesh
data from another object.
This normally works fine as a way to use the vertex groups from the
input mesh, but when passing this mesh to the next modifier, the entire
mesh component was replaced, removing the vertex group name map.
This commit adds a function to replace only the mesh data in mesh
component, uses it in the modifier code, and updates the relevant
comments.
Note that the fact that vertex group names are stored in object data
is a legacy design decision that should be reevaluated at some point.
Differential Revision: https://developer.blender.org/D10256
|
|
|
|
Use transform matrices instead of loc, rot, scale variables to store instance transforms.
Reviewed By: JacquesLucke
Differential Revision: http://developer.blender.org/D10211
|
|
For the most part, this just adds boilerplate code for volume support in geometry nodes:
* Add `VolumeComponent` next to `MeshComponent`, etc.
* Support `VolumeComponent` in depsgraph object iterator.
Furthermore, I added initial volume support in a few nodes:
* The Object Info node outputs an object instance when the input is a volume object
(that will be the same for mesh objects soonish, to avoid copies).
* Support transforming a `VolumeComponent` in the Transform node.
* Support the `VolumeComponent` in Join Geometry nodes, but only when just one of the
inputs has a volume component for now.
Right now, there is no way to create a `VolumeComponent`, because the Object Info node
outputs an object instance. The `VolumeComponent` will be necessary for upcoming nodes,
which will generate volumes on the fly.
Viewport selection does not work correctly with `VolumeComponent`s currently. I don't
know why that is. That can be figured out a bit later, once we can actually create
new volumes in geometry nodes.
Ref T84604.
Differential Revision: https://developer.blender.org/D10147
|
|
The manipulation of rot/scale was simply not implemented.
|
|
Instances are created with an "index" parameter used for persistence over
time through animation. Currently the geometry nodes instancer passes
the index in the array for this value, but the arrays created by the
"Point Distribution" node aren't necessarily stable in this way when
the input mesh is deformed. In D9832 we already mostly solved this
problem with an `id` attribute. The solution here is to create instances
with this attribute as well.
It's important to note that deforming the instanced points *after*
distribution will usually be a better solution for this problem. This
solution is likely still important though.
Differential Revision: https://developer.blender.org/D10024
|
|
In the report, the geometry is copied because it has two users and the
final join node needs to write to it. The join node also happens to
remove attributes apparently, because it exposed a mistake in the "copy"
method of the `MeshComponent` class. The copy is supposed to be
a deep copy, but the vertex group name map was not duplicated.
Differential Revision: https://developer.blender.org/D9991
|
|
The Point Instance node can instance entire collections now.
Before, only individual collections were supported.
Randomly selecting objects from the collection on a per point basis
is not support, yet.
Last part of D9739.
Ref T82372.
|
|
This is the initial merge from the geometry-nodes branch.
Nodes:
* Attribute Math
* Boolean
* Edge Split
* Float Compare
* Object Info
* Point Distribute
* Point Instance
* Random Attribute
* Random Float
* Subdivision Surface
* Transform
* Triangulate
It includes the initial evaluation of geometry node groups in the Geometry Nodes modifier.
Notes on the Generic attribute access API
The API adds an indirection for attribute access. That has the following benefits:
* Most code does not have to care about how an attribute is stored internally.
This is mainly necessary, because we have to deal with "legacy" attributes
such as vertex weights and attributes that are embedded into other structs
such as vertex positions.
* When reading from an attribute, we generally don't care what domain the
attribute is stored on. So we want to abstract away the interpolation that
that adapts attributes from one domain to another domain (this is not
actually implemented yet).
Other possible improvements for later iterations include:
* Actually implement interpolation between domains.
* Don't use inheritance for the different attribute types. A single class for read
access and one for write access might be enough, because we know all the ways
in which attributes are stored internally. We don't want more different internal
structures in the future. On the contrary, ideally we can consolidate the different
storage formats in the future to reduce the need for this indirection.
* Remove the need for heap allocations when creating attribute accessors.
It includes commits from:
* Dalai Felinto
* Hans Goudey
* Jacques Lucke
* Léo Depoix
|