250 Commits

Author SHA1 Message Date
Charlie Jolly
729b2d026d Geometry Nodes: Add shader Musgrave texture node
Port shader node musgrave texture

Differential Revision: https://developer.blender.org/D12701
2021-10-18 14:24:14 +01:00
Johnny Matthews
1f51037676 Geometry Nodes: Endpoint Selection Nodes
The Endpoint Selection node allows for the Selection of an aribitrary
number of endpoints from each spline in a curve. The start and end
inputs are evaluated on the spline domain. The result is outputted
as a boolean field on the point domain.

Differential Revision: https://developer.blender.org/D12846
2021-10-18 06:45:16 -05:00
Jarrett Johnson
88d295f952 Geometry Nodes: Updated Subdivision Surface Node
Replaces the old Subdivision Surface Node.

Changes:
 - Removes implicit instance realization, instead the node runs once
   per unique instance.
 - "Use Creases" becomes a crease field input applied to edges.
   The values are clamped between zero and one.

Addresses T91763

Differential Revision: https://developer.blender.org/D12830
2021-10-15 15:12:04 -05:00
Hans Goudey
76f386a37a Geometry Nodes: Fields transfer attribute node
This commit adds an updated version of the old attribute transfer node.
It works like a function node, so it works in the context of a
geometry, with a simple data output.

The "Nearest" mode finds the nearest element of the specified domain on
the target geometry and copies the value directly from the target input.

The "Nearest Face Interpolated" finds the nearest point on anywhere on
the surface of the target mesh and linearly interpolates the value on
the target from the face's corners.

The node also has a new "Index" mode, which can pick data from specific
indices on the target geometry. The implicit default is to do a simple
copy from the target geometry, but any indices could be used. It is also
possible to use a single value for the index to to retrieve a single
value from an attribute at a certain index.

Differential Revision: https://developer.blender.org/D12785
2021-10-15 14:09:08 -05:00
Charlie Jolly
104887800c Geometry Nodes: Add Voronoi Texture
Port shader Voronoi to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12725
2021-10-15 15:28:20 +01:00
Charlie Jolly
d4f1bc5f39 Geometry Nodes: Port shader gradient texture node
Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D12717
2021-10-15 15:03:21 +01:00
Johnny Matthews
cddda70618 Geometry Nodes: Merge Conflict Cleanup
Removing a line that remained from a merge.
2021-10-14 12:22:33 -05:00
Johnny Matthews
42a05ff6ea Geometry Nodes: Rename Nodes ID Names + Menu Org
Re-alphabetize the main add menu.

Rename Node ID Names:
FloatCompare => CompareFloats
AttributeCapture => CaptureAttribute
Boolean => MeshBoolean
CurveFill => FillCurve
CurveFillet => FilletCurve
CurveReverse => ReverseCurve
CurveSample => SampleCurve
CurveResmaple => ResampleCurve
CurveSubdivide => SubdivideCurve
CurveTrim => TrimCurve
MaterialReplace => ReplaceMaterial
MeshSubdivide => SubdivideMesh
EdgeSplit => SplitEdges

Differential Revision: https://developer.blender.org/D12865
2021-10-14 12:10:52 -05:00
Hans Goudey
17b8da7196 Geometry Nodes: Field version of mesh to curve node
This commit adds a fields version of the mesh to curve node, with a
field for the input selection. In order to reduce code duplication,
it adds the mesh to curve conversion to the new geometry module
and calls that implementation from both places.

More details on the geometry module can be found here: T86869

Differential Revision: https://developer.blender.org/D12579
2021-10-14 12:06:48 -05:00
Charlie Jolly
2341ca990c Geometry Nodes: Add White Noise texture
Port White Noise shader to geometry nodes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12719
2021-10-14 14:56:48 +01:00
Johnny Matthews
9ca567bc4e Geometry Nodes: Reorganize Add Menu
- Move Converters to 'From' menus
  - Create Instances Menu
  - Realphabetize the Curve Menu

  Differential Revision: https://developer.blender.org/D12860
2021-10-14 06:41:52 -05:00
Hans Goudey
366cea95c5 Geometry Nodes: Fields version of edge split node
This changes the edge split node to have a selection input, which is
more aligned with the other design changes. This loses the ability to
split edges based on an angle, but the edge angle can be added as a
field input node in the future, which will make for a much more
flexible system.

Differential Revision: https://developer.blender.org/D12829
2021-10-13 11:34:29 -05:00
Erik Abrahamsson
78445ebd5f Geometry Nodes: Rotate Instances Node
Adds a node that can rotate each of a geometry's instances in global
(to the modifier object) or local space (of each point) by a specified
angle around a pivot point.

In the future, separating the local-global choice for the pivot and the
rotation might be useful. However, for now the node is kept simple.

Differential Revision: https://developer.blender.org/D12682
2021-10-13 09:42:10 -05:00
Erik Abrahamsson
6c11b320c4 Geometry Nodes: Scale Instances Node
Adds a node that can scale a geometry's instances. With "Local" turned
on, the instance is scaled individually from the center point input,
while when local space is turned off, it's more like the transform
node, except it scales outward from the center point instead of only
from the origin.

Differential Revision: https://developer.blender.org/D12681
2021-10-13 09:10:06 -05:00
Erik Abrahamsson
9d49fc2ba0 Geometry Nodes: Translate Instances Node
Adds a node that can translate instances in the transform space of
the modifier object, or the local space of their original transform.
One reason to have a special node for instances is that they always
have the existing transform, unlike mesh or point cloud points.

Differential Revision: https://developer.blender.org/D12679
2021-10-13 09:02:29 -05:00
Johnny Matthews
24cc552cf4 Geometry Nodes: Material Index, Set Material
Add Get/Set Nodes for Material Index
Rename Assign Material to Set Material

Differential Revision: https://developer.blender.org/D12837
2021-10-13 08:41:35 -05:00
Hans Goudey
4b31a21bcd Geometry Nodes: Use a separator in the add menu input category
This can help separate the field inputs from the other nodes,
like some other categories.
2021-10-11 18:14:03 -05:00
Charlie Jolly
f7ef68514b Geometry Nodes: Add Color input node
Adds a color input node with picker.

Differential Revision: https://developer.blender.org/D12793
2021-10-11 23:43:01 +01:00
Johnny Matthews
c1b4abf527 Geometry Nodes: Add Nodes to Get/Set Built-in Attributes
This commit implements T91780, adding nodes to get and set builtin
attributes. Individual set nodes are used so that the values can be
exposed for direct editing, which is useful for attributes like shade
smooth and spline resolution. Individual input nodes are used to allow
reusing nodes for multiple components, and to allow grouping multiple
outputs conceptually in the same node in the future.

Input Nodes
 - Radius
 - Curve Tilt
 - Curve Handle Positions
 - Is Shade Smooth
 - Spline Resolution
 - Is Spline Cyclic

'Set' Nodes
 - Curve Radius
 - Point Radius
 - Curve Tilt
 - Curve Handle Positions
 - Is Shade Smooth
 - Spline Resolution
 - Is Spline Cyclic

Using hardcoded categories is necessary to add separators to the node
menu.

Differential Revision: https://developer.blender.org/D12687
2021-10-11 11:03:57 -05:00
Wannes Malfait
9c00486451 Geometry Nodes: Separate and Delete Geometry for fields
Delete Geometry:
This adds a copy of the old node in the legacy folder and updates the
node to work with fields. The invert option is removed, because it is
something that should be very easy with fields, and to be consistent
with other nodes which have a selection. There is also a dropdown to
select the domain, because the domain can't be determined from the
field input. When the domain does not belong on any of the components
an info message is displayed.

Separate Geometry:
A more general version of the old Point Separate node. The "inverted"
output is the same as using the delete geometry node.

Differential Revision: https://developer.blender.org/D12574
2021-10-11 08:38:02 -05:00
Jarrett Johnson
79425ed326 Geometry Nodes: Align Euler to Vector Node
This commit introduces the Align Euler to Vector function node which
rotates to a body into a given direction. The node replaces the legacy
"Align Rotation to Vector" node, which only worked on an attribute
named `rotation` internally. The "Euler" in the name is meant to make
it clearer that the rotation isn't interchangeable with a regular
vector.

Addresses T91374.

Differential Revision: https://developer.blender.org/D12726
2021-10-09 14:40:37 -05:00
Johnny Matthews (guitargeek)
2305f270c5 Geometry Nodes: Handle Type Selection Node Update
This node creates a boolean field selection of bezier spline points
that have a handle of the given type on the selected 'side' of the
contol point. This is evaluated on the point domain.

Differential Revision: https://developer.blender.org/D12559
2021-10-03 15:01:30 -05:00
Johnny Matthews (guitargeek)
fb34cdc7da Geometry Nodes: Points to Volume Fields Update
This update of the Points to Volume node allows a field to populate the
radius input of the node and removes the implicit realization of
instances.

Differential Revision: https://developer.blender.org/D12531
2021-10-03 08:03:46 -05:00
Jarrett Johnson
c5c94e3eae Geometry Nodes: Add Rotate Euler Node
This commit introduces the Rotate Euler function node which modifies
an input euler rotation. The node replaces the "Point Rotate" node.

Addresses T91375.

Differential Revision: https://developer.blender.org/D12531
2021-10-02 20:04:45 -05:00
guitargeek
1476d35870 Geometry Nodes: Set Handle Type Node Field Update
This update of the Set Handle Type node allows for a bool field to be
used as the selection of the affected control point handles for
bezier splines. If no bezier splines are provided a info message is
shown.

Differential Revision: https://developer.blender.org/D12526
2021-10-01 14:22:24 -05:00
guitargeek
1fb364491b Geometry Nodes: Set Spline Type Node Field Update
This update of the Set Spline Type node allows for a bool field to be
used as the selection of the affected splines.

Differential Revision: https://developer.blender.org/D12522
2021-10-01 11:59:29 -05:00
guitargeek
dc30a9087c Geometry Nodes: Spline Length Input Node
The Spline Length Input node provides a field containing the
length of the current evaluated spline to the Point and Spline
domains.

Differential Revision: https://developer.blender.org/D12706
2021-10-01 09:58:49 -05:00
guitargeek
aae96176e8 Geometry Nodes: Curve Subdivide Node with Fields
The curve subdivide node can now take an int field to specify the
number of subdivisions to make at each curve segment.

Reviewed by: Hans Goudey
Differential Revision: https://developer.blender.org/D12534
2021-10-01 09:43:04 -05:00
Charlie Jolly
be70827e6f Nodes: Add Float Curve for GN and Shader nodes.
Replacement for float curve in legacy Attribute Curve Map node.

Float Curve defaults to [0.0-1.0] range.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D12683
2021-09-30 19:24:40 +01:00
Hans Goudey
9f0a3a99ab Geometry Nodes: Fields version of attribute proximity node
Add a fields-aware implementation of the attribute proximity node.
The Source position is an implicit position field, but can be
connected with a position input node with alterations before use.
The target input and mode function the same as the original node.

Patch by Johnny Matthews with edits from Hans Goudey (@HooglyBoogly).

Differential Revision: https://developer.blender.org/D12635
2021-09-28 15:21:36 -05:00
Johnny Matthews
85aac0ef6a Geometry Nodes: Field version of curve reverse node
The updated version has a selection input as a field
and does not realize instances implicitly.

Differential Revision: https://developer.blender.org/D12506
2021-09-28 13:53:20 -05:00
Jacques Lucke
95fca22bfe Geometry Nodes: Remove experimental option for fields
This enables fields as the official workflow for geometry nodes.
While many features are converted to use fields rather than the old
attribute workflow, many are not yet converted. In that case, the
unconverted nodes are still accessible with an experimental option.
In the coming weeks the rest of the nodes will be converted.

Differential Revision: https://developer.blender.org/D12672
2021-09-28 13:22:52 -05:00
Hans Goudey
262b211856 Geometry Nodes: Mesh Point Cloud Conversion Nodes
This commit adds nodes to do direct conversion between meshes and point
clouds in geometry nodes. The conversion from mesh to points is helpful
to instance once per face, or once per edge, which was previously only
possibly with ugly work-arounds. Fields can be evaluated on the mesh
to pass them to the points with the attribute capture node.

The other conversion, point cloud to mesh vertices, is a bit less
obvious, though it is still a common request from users. It's helpful
for flexibility when passing data around, better visualization in the
viewport (and in the future, cycles), and the simplicity of points.

This is a step towards T91754, where point clouds are currently
combined with meshes when outputing to the next modifier after geometry
nodes. Since we're removing the implicit behavior for realizing
instances, it feels natural to use an explicit node to convert points
to vertices too.

Differential Revision: https://developer.blender.org/D12657
2021-09-28 12:14:13 -05:00
Hans Goudey
f35ea668a1 Geometry Nodes: Move more nodes to legacy
- Curve to Points: Needs output sockets
- Curve Endpoitns: Needs the same output sockets
- Edge Split: Should have a selection input instead
- Subdivision Surface: Should not use "crease" implicitly
All new versions of these nodes should also not implicitly
realize instances.
2021-09-28 11:03:12 -05:00
Jacques Lucke
617954c143 Geometry Nodes: new Instance on Points node
This adds a new Instance on Points node that is a replacement
for the old Point Instance node. Contrary to the old node,
it does not have a mode to instance objects or collections
directly. Instead, the node has to be used with an Object/
Collection Info to achieve the same effect.

Rotation and scale of the instances can be adjusted in the node
directly or can be controlled with a field to get some variation
between instances.

The node supports placing different instances on different points.
The user has control over which instance is placed on which point
using an Instance Index input. If that functionality is used, the
Instance Geometry has to contain multiple instances that can are
instanced separately.

Differential Revision: https://developer.blender.org/D12478
2021-09-27 10:17:17 +02:00
Johnny Matthews
536f9eb82e Geometry Nodes: Random Value Node
This node replaces the deprecated Attribute Randomize node, populating
a vector, float, integer or boolean field with random values. Vector,
float, and integer have min/max settings, which are also field aware.
The boolean type has a probability value for controlling what portion
of the output should be true. All four types have a field seed input
which is implicitly driven by the index, otherwise, all values would
be the same "random" value.

The Random Float node is now deprecated like other nodes, since it is
redundant with this node.

Differential Revision: https://developer.blender.org/D12603
2021-09-24 14:03:42 -05:00
Erik Abrahamsson
be16794ba1 Geometry Nodes: String to Curves Node
This commit adds a node that generates a text paragraph as curve
instances. The inputs on the node control the overall shape of the
paragraph, and other nodes can be used to move the individual instances
afterwards. To output more than one line, the "Special Characters" node
can be used.

The node outputs instances instead of real geometry so that it doesn't
have to duplicate work for every character afterwards. This is much
more efficient, because all of the curve evaluation and nodes like fill
curve don't have to repeat the same calculation for every instance of
the same character.

In the future, the instances component will support attributes, and the
node can output attribute fields like "Word Index" and "Line Index".

Differential Revision: https://developer.blender.org/D11522
2021-09-24 12:41:49 -05:00
Erik Abrahamsson
5c0017e85a Geometry Nodes: Special string characters node
This patch adds a new node called "Special Characters" with two string
outputs: "Line Break" and "Tab". This is necessary because the newline
character cannot be easily typed with a keyboard, but is necessary for
the string to curve node.

Differential Revision: https://developer.blender.org/D12620
2021-09-24 11:00:21 -05:00
Jacques Lucke
e7ae2840a5 Geometry Nodes: new Distribute Points on Faces node
This adds a replacement for the deprecated Point Distribute node.

Arguments for the name change can be found in T91155.
Descriptions of the sockets are available in D12536.

Thanks to Jarrett Johnson for the initial patch!

Differential Revision: https://developer.blender.org/D12536
2021-09-24 11:50:02 +02:00
dilithjay
0d350e0193 Geometry Nodes: Curve Fillet Node
This node can be used to fillet splines at control points to
create a circular arc.
The implementation roughly follows T89227's design.

The node works in two main modes: Bezier and Poly
* Bezier: Creates a circular arc at vertices by changing
handle lengths (applicable only for Bezier splines).
* Poly: Creates a circular arc by creating vertices (as
many as defined by the Count fields input) along
the arc (applicable for all spline types).

In both modes, the radius of the created arc is defined
by the Radius fields input.
The Limit Radius attribute can be enabled to prevent
overlapping when the defined radius exceeds the maximum
possible radius for a given point.

Reviewed By: Hans Goudey

Differential Revision: https://developer.blender.org/D12115
2021-09-22 20:11:12 +05:30
Hans Goudey
4d881d9dad Geometry Nodes: Curve Parameter Node
This commit adds a field input node that outputs the fraction of the
total length of the spline on each control point. This is useful for
anything that involves varying a value depending on how far along
the spline it is.

It also works when evaluated on the spline domain, where it outputs
the fraction of the total length of all of the splines at the start.

The operation isn't as well defined for NURB splines for the reasons
noted in the code comment. That can be said explicitly in the docs.

Differential Revision: https://developer.blender.org/D12548
2021-09-21 17:38:37 -05:00
Erik Abrahamsson
29e3545194 Geometry Nodes: String manipulation nodes
This patch adds four new nodes to a new "Text" category:
 - String Length: Outputs length of a string
 - String Substring: Outputs part of a string
 - Value to String: Converts a value to a string
 - String Join: Concatenates multiple strings with a delimiter

The initial use case of these nodes is the upcoming string to curve
node. However, they could also be used to calculate dynamic attribute
names, or with string attributes in the future.

Differential Revision: https://developer.blender.org/D12532
2021-09-21 14:11:32 -05:00
Hans Goudey
4d51af68ad Geometry Nodes: Curve tangent node
This node outputs the direction vector, or tangent of a curve at every
control point. For poly splines this is simply the evaluated tangents,
so it all works very simply. For Bezier splines it uses the tangent at
the evaluated point corresponding to each control point, and NURBS
are interpereted as poly splines built from their control points.

Internally the node is called "Input Tangent" to simplify using it for
mesh tangents as well in the future like the "Normal" node.

Differential Revision: https://developer.blender.org/D12581
2021-09-21 13:11:39 -05:00
Hans Goudey
17021adcea Geometry Nodes: Curve Sample Node
This node allows sampling positions, tangents, and normals at any
arbitrary point along a curve. The curve can include multiple splines,
all are taken into account. The node does not yet support transferring
generic attributes like radius, because some more general tooling will
make that much more feasible and useful in different scenarios.

This is a field node, so it is evaluated in the context of a data-flow
node like "Set Position". One nice thing about that is it can easily
be used to move an entire geometry like the follow path constraint.

The point along the curve is chosen either with a factor of the total
length of the curve, or a length into the curve, the same choice used
in the curve trim node.

Differential Revision: https://developer.blender.org/D12565
2021-09-20 20:23:26 -05:00
Victor-Louis De Gusseme
05f3f11d55 Geometry Nodes: Attribute Statistic Node
This nodes evaluates a field on a geometry and outputs various
statistics about the entire data set, like min, max, or even
the standard deviation. It works for float and vector types currently,
though more types could be supported in the future.

 - All statistics are calculated element-wise for vectors.
 - "Product" was not added since the result could very easily overflow.
 - The "Size" output was not added since it isn't specific to an
   attribute and would fit better in another node.

The implementation shares work as much as possible when multiple
statistics are needed.

This node has been in development since the beginning of this year,
with additions from Johnny Matthews and Hans Goudey.

Differential Revision: https://developer.blender.org/D10202
2021-09-20 18:39:39 -05:00
Jacques Lucke
fc4f82d200 Geometry Nodes: support Noise Texture node
This makes the Noise Texture node available in geometry nodes.
It should behave the same as in shader node, with the exception
that it does not have an implicit position input yet. That will
be added separately.

Differential Revision: https://developer.blender.org/D12467
2021-09-20 13:12:25 +02:00
Jacques Lucke
7da9da2b27 Geometry Nodes: new Realize Instances node
This node has a simple geometry input and output.
If the input geometry contains instances, they will be realized
into actual geometry. When there are many instances, this can
be very slow and memory intensive. Generally, instances should
only be made real when necessary, e.g. when every instance
should be deformed independently.

Differential Revision: https://developer.blender.org/D12556
2021-09-20 12:37:52 +02:00
Jacques Lucke
6b0aa7ae15 Geometry Nodes: hide Attribute Remove node when fields are enabled 2021-09-17 16:21:20 +02:00
Hans Goudey
09f14b38f2 Geometry Nodes: Add fields version of material nodes
This commit moves the old material nodes to a "legacy" folder and adds
versions of the nodes that work with fields.

The "Select by Material" node is a field node now, so it doesn't have
a geometry output. This is an improvement because there are fewer links
to connect, and it's more easily usable in different situations.
It's also called "Material Selection", since it's more of an input
than an action now.

It's sometimes necessary to use the attribute capture node to get a
more predictable interpolation to mesh faces. This is because the
selection field input is always evaluated on the face domain, so
attribute inputs are interpolated before they are booleans, so they
cannot use the new interpolations from rB5841f8656d9580d7b9.

Differential Revision: https://developer.blender.org/D12456
2021-09-15 10:51:52 -05:00
Hans Goudey
e2f99c338b Geometry Nodes: Add versioning to change legacy node ID names
Recently we have decided to avoid fancier versioning for nodes with
string inputs for attribute names when updating the attribute workflow
for 3.0. In that case we would just duplicate any node that will
have an updated version to work with fields.

We want to be able to use the "proper" ID names for the new versions
of the nodes though, so this patch adds "Legacy" to the IDs of all
nodes that will be replaced in 3.0. This commit also removes the nodes
from the add menu when the fields experimental preference is enabled,
in order to make it clear what has been updated and what hasn't.

Nodes in the "Maybe" categories in versioning_300.c can be renamed
later if necessary. For now it's probably better to be conservative,
and to keep the list complete.

Differential Revision: https://developer.blender.org/D12420
2021-09-10 10:34:49 -05:00