149 Commits

Author SHA1 Message Date
Jacques Lucke
c4c195672d Cleanup: remove unexposed nodes
Those nodes are leftovers from my work on particle nodes and are not needed currently.
They can be added back easily if they become necessary.
2021-03-22 12:23:25 +01:00
Hans Goudey
a41d3c0ebe Geometry Nodes: Rename "Subdivide Smooth" back to "Subdivision Surface"
Following concerns raised in the commit that changed the name initially,
rB2e19509e60b39837, it makes more sense to keep the "Surface" name for
this node because it has a specific meaning that should not be confused
with other types of subdivision.
2021-03-17 14:40:38 -04:00
Hans Goudey
9a56a3865c Geometry Nodes: Add initial version of mesh primitives
This commit includes nodes to build the following primitives:
 - Cone
 - Cylinder
 - Circle
 - Cube
 - UV Sphere
 - Ico Sphere
 - Line
 - Plane/Grid

In general the inputs are the same as the corresponding operators
in the 3D view.

**Line Primitive**
The line primitive has two modes-- adding vertices between two end
points, or adding vertices each at an offset from the start point.
For the former mode, there is a choice between a vertex count
and a distance between each point.

**Plane Primitive**
This commit includes the "Plane" and "Grid" primitives as one node.
Generally primitives are named after the simpler form of the shape they
create (i.e. "Cone" can make some more complex shapes). Also, generally
you want to tweak the number of subdivisions anyway, so defaulting to
plane is not an inconvenience. And generally having fewer redundant
base primitives is better.

**Future Improvements**
A following patch proposes to improve the speed of the cylinder, cone,
and sphere primitives: D10730. Additional possible future improvements
would be adding subdivisions to the cube node and rings to the cone
and cylinder nodes.

Differential Revision: https://developer.blender.org/D10715
2021-03-16 17:35:36 -04:00
Jeroen Bakker
d49e7b82da Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.

This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.

With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.

Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.

Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.

In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.

Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:43:17 +01:00
Hans Goudey
2c216413d5 Nodes: Move group input and output to a consistent menu location
Currently (in geometry nodes) you can delete the group input or group
output nodes with no way to get them back without copy and paste. This
adds them to the "Group" submenu of the add menu so at least there is
a way to add them back.

Additionally, these nodes are moved to the "Group" submenu for all node
editors. This makes sense since they are not like the other input or
output nodes, they really just relate to how groups are organized.

Differential Revision: https://developer.blender.org/D10241
2021-03-13 16:00:56 -05:00
Charlie Jolly
670453d1ec Geometry Nodes: Add Attribute Convert node
The Attribute Convert node provides functionality to change attributes
between different domains and data types. Before it was impossible to
write to a UV Map attribute with the attribute math nodes since they
did not output a 2D vector type. This makes it possible to
"convert into" a UV map attribute.

The data type conversion uses the implicit conversions provided by
`\nodes\intern\node_tree_multi_function.cc`.

The `Auto` domain mode chooses the domain based on the following rules:
1. If the result attribute already exists, use that domain.
2. If the result attribute doesn't exist, use the source attribute domain.
3. Otherwise use the default domain (points).

See {T85700}

Differential Revision: https://developer.blender.org/D10624
2021-03-13 11:49:56 -05:00
Fabian Schempp
60f7275f7f Nodes: Add Attribute Remove Node
This patch adds a node, that removes an attribute if possible,
otherwise it adds an error message.

Differential Revision: https://developer.blender.org/D10697
2021-03-11 23:06:16 +01:00
Hans Goudey
2e19509e60 Geometry Nodes: Rename subdivision nodes
This makes the following changes to the name of the two
geometry nodes subvision nodes:
 - `Subdivision Surface` -> `Subdivide Smooth`
 - `Subdivision Surface Simple` -> `Subdivide`
Most of the benefit is that the names are shorter, but it also better
mirrors the naming of operations in edit mode, and phrases the names
more like actions. This was discussed with the geometry nodes team.
2021-03-08 13:37:49 -05:00
Leon Leno
e12ad2bce0 Geometry Nodes: support Vector Rotate node
Differential Revision: https://developer.blender.org/D10410
2021-03-08 11:37:37 +01:00
Edgar Roman Cervantes
a961a2189c Geometry Nodes: Add string input node
This commit adds a simple string input node, intended for use in the
attribute workflow to make using the same attribute name in multiple
places easier. The node is function node similar to the existing vector
input node.

Ref T84971

Differential Revision: https://developer.blender.org/D10316
2021-02-19 16:03:14 -06:00
Eitan
4891d4b3d1 Geometry Nodes: Add simple subdivision surface node
Add the Simple subdivision option to Geometry nodes, as a new node
instead of part of the existing subdivision node because of future
backend changes to the Simple option. (See T85584)

https://developer.blender.org/D10409
2021-02-19 13:20:04 -06:00
Wannes Malfait
a2ba37e5b6 Geometry Nodes: Add Combine and Separate XYZ nodes for attributes
These are similar to the regular "Combine XYZ" and "Separate XYZ" nodes,
but they work on attributes. They will make it easier to switch between
vector attributes and float attributes.

Differential Revision: https://developer.blender.org/D10308
2021-02-09 11:12:24 -06:00
Jacques Lucke
16abe9343a Geometry Nodes: add Volume to Mesh node
This node takes a volume and generates a mesh on it's "surface".
The surface is defined by a threshold value.

Currently, the node only works on volumes generated by the
Points to Volume node. This limitation will be resolved soonish.

Ref T84605.

Differential Revision: https://developer.blender.org/D10243
2021-02-05 16:20:14 +01:00
Victor-Louis De Gusseme
4d39a0f8eb Geometry Nodes: Add Attribute Proximity Node
This node calculates a distance from each point to the closest position
on a target geometry, similar to the vertex weight proximity modifier.
Mapping the output distance to a different range can be done with an
attribute math node after this node.

A drop-down changes whether to calculate distances from points,
edges, or faces. In points mode, the node also calculates distances
from point cloud points.

Design task and use cases: T84842

Differential Revision: https://developer.blender.org/D10154
2021-02-05 08:28:31 -06:00
Jacques Lucke
e7af04db07 Geometry Nodes: new Is Viewport node
This node outputs true when geometry nodes is currently evaluated
for the viewport and false for final renders.

Ref T85277.

Differential Revision: https://developer.blender.org/D10302
2021-02-04 16:36:34 +01:00
Sebastian Parborg
894cc9c915 Geometry Nodes: Add Collection Info Node
Implements a node to get collection objects.
These objects are then passed along as instances in the node tree.

Follow up tasks:
Multiple nodes does not support instancing yet: T85159
Changing collection offset does not trigger a refresh: T85274

Reviewed By: Jacques, Dalai, Hans

Differential Revision: http://developer.blender.org/D10151
2021-02-03 17:54:33 +01:00
Jacques Lucke
ff7a557c67 Geometry Nodes: new Points to Volume node
This implements a new geometry node based on T84606.
It is the first node that generates a `VolumeComponent`.

Differential Revision: https://developer.blender.org/D10169
2021-01-26 17:37:58 +01:00
Jacques Lucke
425e706921 Geometry Nodes: new Attribute Sample Texture node
This node allows sampling a texture for every vertex based on some
mapping attribute. Typical attribute names are the name of a uv map
(e.g. "UVMap") and "position". However, every attribute that can be
converted to a vector implicitly is supported.

It should be noted that as of right now, uv map attributes can only be
accessed after a Point Distribute node.

Ref T82584.

Differential Revision: https://developer.blender.org/D10121
2021-01-21 16:49:06 +01:00
Hans Goudey
1f4c1c5fc7 Geometry Nodes: Add "Point Translate" and "Point Scale" nodes
The translate node moves every point in the geometry, and the scale
node multiplies the "scale" attribute of the input geometry by its input.
While these operations are already possible with the "Attribute" nodes,
these new nodes fit nicely with the nodes specifically for changing the
"rotation" attribute that already exist, and they provide a simpler way
to do the same thing.

Differential Revision: https://developer.blender.org/D10100
2021-01-13 10:32:06 -06:00
Jacques Lucke
3b77bd48f9 Geometry Nodes: new Align Rotation to Vector node
This adds a new Align Rotation to Vector node based on the mockup
in T83669.

Reviewers: HooglyBoogly, simonthommes

Differential Revision: https://developer.blender.org/D10081
2021-01-12 12:55:14 +01:00
Hans Goudey
ecdbd83a8d Geometry Nodes: Attribute Vector Math Node
This patch implements the same operations and interface as the regular
vector math node, but it runs for every element of the attribute. This
should expand what's possible with geometry nodes quite a bit.

Differential Revision: https://developer.blender.org/D9914
2021-01-11 12:06:52 -06:00
Jacques Lucke
98268e5c68 Cleanup: remove trailing whitespace 2021-01-11 15:49:42 +01:00
Jacques Lucke
d8dc4c5b32 Geometry Nodes: new Rotate Points node
This node updates the "rotation" attribute on points.
Multiple ways to specify the rotation are supported.

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

Ref T83668.
2020-12-23 16:37:47 +01:00
Aaron Carlisle
6538f1e600 Compositor: New Exposure Node
This new node increases the radiance of an image by a scalar value.
Previously, the only way to adjust the the exposure of an image was with
math node or using the scene's color management.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D9677
2020-12-19 14:41:14 -05:00
Jacques Lucke
e5764013b0 Geometry Nodes: move Boolean node to mesh category
This node works on meshes specifically.
2020-12-18 13:33:24 +01:00
Dalai Felinto
f43561eae6 Function Nodes: Input Vector
Ref: T82651

Normally people use "Combine XYZ" to input a vector, but it is more
interesting to have an explicit vector input.

So this is basically "Combine XYZ" without any input sockets, the values
are stored in the node itself.

Differential Revision: https://developer.blender.org/D9885
2020-12-18 13:03:27 +01:00
Hans Goudey
48ddb94a26 Geometry Nodes: Point separate and attribute compare nodes
This patch adds two related nodes, a node for separating points
and mesh vertices based on a boolean attribute input, and a node
for creating boolean attributes with comparisons.

See the differential for an example file and video.

Point Separate (T83059)
The output in both geometries is just point data, contained in the mesh
and point cloud components, depending which components had data in the
input geometry. Any points with the mask attribute set to true will be
moved from the first geometry output to the second. This means that
for meshes, all edge and face data will be removed. Any point domain
attributes are moved to the correct output geometry as well.

Attribute Compare (T83057)
The attribute compare does the "Equal" and "Not Equal" operations by
comparing vectors and colors based on their distance from each other.
For other operations, the comparison is between the lengths of the
vector inputs. In general, the highest complexity data type is used
for the operation, and a new function to determine that is added.

Differential Revision: https://developer.blender.org/D9876
2020-12-17 12:22:47 -06:00
Jacques Lucke
0eedba328d Geometry Nodes: add Attribute Color Ramp node
Differential Revision: https://developer.blender.org/D9861

Ref T82585.
2020-12-17 11:56:18 +01:00
Jacques Lucke
4c26dd430d Geometry Nodes: rename node to Attribute Randomize
Previously, the node was called Random Attribute. For consistency reasons,
we move the "Attribute" part of the name to the front.
2020-12-16 13:31:56 +01:00
Jacques Lucke
d72ec16e70 Geometry Nodes: add Attribute Mix node
This node can be used to mix two attributes in various ways.
The blend modes are the same as in the MixRGB shader node.

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

Ref T82374.
2020-12-11 12:00:48 +01:00
Hans Goudey
348bd319d5 Geometry Nodes: Attribute Fill Node
This commit adds a node that fills every element of an attribute
with the same value. Currently it supports float, vector, and color
attributes. An immediate use case is for "billboard" scattering.

Currently people are using the same input to a Random Attribute node's
min and max input to fill every element of a vector with the same value,
which is an unintuitive way to accomplish the same thing.

Differential Revision: https://developer.blender.org/D9790
2020-12-10 07:58:45 -06:00
Jeroen Bakker
2bae11d5c0 EEVEE: Arbitrary Output Variables
This patch adds support for AOVs in EEVEE. AOV Outputs can be defined in the
render pass tab and used in shader materials. Both Object and World based
shaders are supported. The AOV can be previewed in the viewport using the
renderpass selector in the shading popover.

AOV names that conflict with other AOVs are automatically corrected. AOV
conflicts with render passes get a warning icon. The reason behind this is that
changing render engines/passes can change the conflict, but you might not notice
it. Changing this automatically would also make the materials incorrect, so best
to leave this to the user.

**Implementation**

The patch adds a copies the AOV structures of Cycles into Blender. The goal is
that the Cycles will use Blenders AOV defintions. In the Blender kernel
(`layer.c`) the logic of these structures are implemented.

The GLSL shader of any GPUMaterial can hold multiple outputs (the main output
and the AOV outputs) based on the renderPassUBO the right output is selected.
This selection uses an hash that encodes the AOV structure. The full AOV needed
to be encoded when actually drawing the material pass as the AOV type changes
the behavior of the AOV. This isn't known yet when the GLSL is compiled.

**Future Developments**

* The AOV definitions in the render layer panel isn't shared with Cycles.
  Cycles should be migrated to use the same viewlayer aovs. During a previous
  attempt this failed as the AOV validation in cycles and in Blender have
  implementation differences what made it crash when an aov name was invalid.
  This could be fixed by extending the external render engine API.
* Add support to Cycles to render AOVs in the 3d viewport.
* Use a drop down list for selecting AOVs in the AOV Output node.
* Give user feedback when multiple AOV output nodes with the same AOV name
  exists in the same shader.
* Fix viewing single channel images in the image editor [T83314]
* Reduce viewport render time by only render needed draw passes. [T83316]

Reviewed By: Brecht van Lommel, Clément Foucault

Differential Revision: https://developer.blender.org/D7010
2020-12-04 08:14:07 +01:00
Jacques Lucke
6be56c13e9 Geometry Nodes: initial scattering and geometry nodes
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
2020-12-02 15:38:47 +01:00
Jacques Lucke
6ced026ae1 Simulation: remove particle nodes with outdated design
The design for how we approach the "Everything Nodes" project
has changed. We will focus on a different part of the project initially.

While future me will likely refer back to some of the code I remove here,
there is no point in keeping this code around in master currently.
It would just confuse other developers working on the project.

This does not remove the simulation modifier and data block. Those are
just cleaned up, so that the boilerplate code can be reused in the future.
2020-10-20 12:07:42 +02:00
Campbell Barton
bab9de2a52 Cleanup: pep8, blank lines 2020-10-02 11:59:16 +10:00
Campbell Barton
c00707c18d Cleanup: remove f-string use 2020-08-22 00:10:52 +10:00
Jacques Lucke
396d0b5cd0 Particles: new Age Reached Event, Kill Particle and Random Float node
The hardcoded age limit is now gone. The behavior can be implemented
with an Age Reached Event and Kill Particle node. Other utility nodes
to handle age limits of particles can be added later. Adding an
Age Limit attribute to particles on birth will be useful for some effects,
e.g. when you want to control the color or size of a particle over its
life time.

The Random Float node takes a seed currently. Different nodes will
produce different values even with the same seed. However, the same
node will generate the same random number for the same seed every
time. The "Hash" of a particle can be used as seed. Later, we'd want
to have more modes in the node to make it more user friendly.
Modes could be: Per Particle, Per Time, Per Particle Per Time,
Per Node Instance, ...
Also a Random Vector node will be useful, as it currently has to be
build using three Random Float nodes.
2020-08-02 22:10:47 +02:00
Jacques Lucke
3b9e16a4f7 Particles: initial support for the Time input node 2020-07-28 12:10:37 +02:00
Jacques Lucke
9a53d4a882 Particles: support Clamp node 2020-07-27 17:12:15 +02:00
Jacques Lucke
38e65331a8 Particles: initial support for events and actions
The following nodes work now (although things can still be improved of course):
Particle Birth Event, Praticle Time Step Event, Set Particle Attribute and Execute Condition.

Multiple Set Particle Attribute nodes can be chained using the "Execute" sockets.
They will be executed from left to right.
2020-07-27 16:26:43 +02:00
Jacques Lucke
fd7e31b3e5 Particles: don't mark Particle Attribute node as mockup
It is actually doing something already.
2020-07-26 12:32:28 +02:00
Jacques Lucke
13abacaaf3 Particles: show which nodes are only mockups in the Add menu
More nodes will be implemented step by step. I don't remove/disable these nodes,
so that it is still possible to add them.
2020-07-25 21:01:57 +02:00
Jacques Lucke
8369adabc0 Particles: initial object socket and emitter node support
Object sockets work now, but only the new Object Transforms and the
Particle Mesh Emitter node use it. The emitter does not actually
use the mesh surface yet. Instead, new particles are just emitted around
the origin of the object.

Internally, handles to object data blocks are passed around in the network,
instead of raw object pointers. Using handles has a couple of benefits:
* The caller of the function has control over which handles can be resolved
  and therefore limit access to specific data. The set of data blocks that
  is accessed by a node tree should be known statically. This is necessary
  for a proper integration with the dependency graph.
* When the pointer to an object changes (e.g. after restarting Blender),
  all handles are still valid.
* When an object is deleted, the handle is invalidated without causing crashes.
* The handle is just an integer that can be stored per particle and can be cached easily.

The mapping between handles and their corresponding data blocks is
stored in the Simulation data block.
2020-07-21 17:35:09 +02:00
Jacques Lucke
8fae58ce0b Nodes: support Value node in simulation node tree 2020-07-11 16:39:17 +02:00
Jacques Lucke
838e1f248d Nodes: add Combine Strings and Group Instance ID node UIs
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7494
2020-05-04 12:49:25 +02:00
Jacques Lucke
dfe22c2900 Cleanup: comment and semicolons 2020-04-22 14:17:19 +02:00
Jacques Lucke
8dbbac43bb Simulations: Add Boolean Math, Switch and Float Compare node UI
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7424
2020-04-20 15:27:58 +02:00
Jacques Lucke
b78f2675d7 Simulations: Use some shader nodes in simulation node trees
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7422
2020-04-20 15:17:36 +02:00
Jacques Lucke
9f7bea6e83 Simulations: UI for core particle nodes
This commit adds the initial set of particles nodes. These are fairly
low level and are expected to be put into groups that we ship with Blender.

See D7384 for a description of the individual nodes.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7384
2020-04-20 14:47:13 +02:00
Jacques Lucke
2b2d3c14fe Simulations: Embed simulation node tree in simulation data block
This adds an embedded node tree to the simulation data block dna.
The UI in the `Simulation Editor` has been updated to show a list
of simulation data blocks, instead of individual node trees.

The new `SpaceNodeEditor.simulation` property wraps the existing
`SpaceNodeEditor.id` property. It allows scripts to get and set
the simulation data block that is being edited.

Reviewers: brecht, mont29

Differential Revision: https://developer.blender.org/D7301
2020-04-20 12:56:16 +02:00