Commit Graph

4590 Commits

Author SHA1 Message Date
Hans Goudey 456c34da1a Cleanup: Use higher level APIs for "set attribute" geometry nodes
Similar changes to a2726a3d7f
Also tweak variable names and the access of geometry set grease pencil data.
2024-03-08 10:50:42 -05:00
Omar Emara f25983f69b Merge branch 'blender-v4.1-release' 2024-03-08 11:57:37 +02:00
Omar Emara 8cf8b54332 Fix: Viewport Compositor depth has low precision
The depth pass of the Viewport Compositor has low precision if the
precision of the node tree is set to Auto. To fix this, we always
expose the depth pass in full precision.
2024-03-08 11:55:23 +02:00
Hans Goudey 744f3b2823 Cleanup: Grammar in comments: Fix uses of "own"
"Own" (the adjective) cannot be used on its own. It should be combined
with something like "its own", "our own",  "her own", or "the object's own".
It also isn't used separately to mean something like "separate".

Also, "its own" is correct instead of "it's own" which is a misues of the verb.
2024-03-07 16:23:35 -05:00
Hans Goudey 1e1d7034ec Cleanup: Move GPU_uniform_buffer.h to C++ 2024-03-06 21:54:28 -05:00
Campbell Barton 9796805bb8 Cleanup: sort CMake source files 2024-03-07 13:29:09 +11:00
Bartosz Kosiorek bfee43a5c9 UI: Add input descriptions for Principled BSDF parameters
Pull Request: https://projects.blender.org/blender/blender/pulls/119131
2024-03-06 18:24:23 +01:00
Brecht Van Lommel b3d55b37bc Merge branch 'blender-v4.1-release' 2024-03-06 16:52:54 +01:00
Hoshinova bbb14b95bb Fix: Crash when creating Noise Texture node with link-drag-search
Fix crash when creating a Noise Texture through dragging and releasing
another output and connecting it to the "Gain" or "Offset" sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/119097
2024-03-06 15:42:22 +01:00
Hans Goudey 8d26692912 Merge branch 'blender-v4.1-release' 2024-03-05 14:26:04 -05:00
Hans Goudey 90fb838416 Fix: Geometry Nodes Sort Elements node crash with nested instances
Typically nodes that edit instances only change the top level of
instances. As an oversight, that wasn't done in the sort elements node.
This causes problems as the top level of instances are reordered and
nested instances are edited. As the top-level is replaced, its
contained geometry sets (the nested instances) are deleted.

To fix, only reoder the top-level instances in this node.
2024-03-05 14:18:29 -05:00
Omar Emara d6b1d00a0f Cleanup: Use enums instead of numbers for Glare node 2024-03-05 11:51:52 +02:00
Campbell Barton 5fdd684550 Merge branch 'blender-v4.1-release' 2024-03-05 10:20:52 +11:00
Iliya Katueshenock fa229c5753 Fix #119019: Geometry Nodes: Split to Instances wrong field interface
Input fields should propagated on input geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/119032
2024-03-04 16:57:28 +01:00
Hans Goudey 0673cd873d Fix: Incorrect viewer preferred domain for some curve fields
Mentioned by https://pvs-studio.com/en/blog/posts/cpp/1106/
2024-03-04 10:11:37 -05:00
Omar Emara 983643c78c Fix: Flat filter in Blur node is wrong in bokeh mode
The Flat filter was wrongly assumed to be separable, white it is in fact
not. So compute it as a 2D filter in bokeh mode to fix this.
2024-03-04 10:07:25 +02:00
Jacques Lucke 62bb346af9 Merge branch 'blender-v4.1-release' 2024-03-03 00:40:47 +01:00
Pratik Borhade 5f70bd0e46 Fix #116435: Rotate Vector node on a link connects wrong sockets
`sock_rotation` has higher priority (6) than the vector socket (4).
Hence inserting node between vector-vector link joins thorugh "rotation"
socket (`get_main_socket()` / `get_main_socket_priority()`).
This can be fixed by making "vector" input socket as default for link.

But this will break the link creation when node is inserted between
rotation-rotation link. It seems rotation is converted to vectors so
perhaps make sense to make "vector" as default socket for link.

Pull Request: https://projects.blender.org/blender/blender/pulls/116550
2024-03-03 00:38:34 +01:00
Jacques Lucke 10b5fe8897 Merge branch 'blender-v4.1-release' 2024-03-03 00:00:48 +01:00
Jacques Lucke e72bf54791 Fix #118926: missing transform relation when using Object/Collection Info node
This was probably accidentally broken when we moved the rna code into node files.

Pull Request: https://projects.blender.org/blender/blender/pulls/119017
2024-03-02 23:59:48 +01:00
Hans Goudey 6db0bee685 Cleanup: Add utility for volume grid nodes search items 2024-03-02 15:06:32 -05:00
Jacques Lucke fae16e7454 Merge branch 'blender-v4.1-release' 2024-03-02 01:25:04 +01:00
Jacques Lucke 4a81fe8180 Fix #115755: rename enum from type to rotation_type to resolve name collision
`type` is a built-in property already.

Pull Request: https://projects.blender.org/blender/blender/pulls/118990
2024-03-01 23:57:33 +01:00
Hans Goudey 95fb695195 Fix: Missing experimental option check for volume grid nodes search 2024-03-01 15:53:55 -05:00
Iliya Katueshenock fd207d9b29 Fix #118883: Face Corner component shows in Delete Geometry node
Pull Request: https://projects.blender.org/blender/blender/pulls/118917
2024-02-29 18:01:08 +01:00
Hans Goudey a2726a3d7f Fix: Use after free in set position node
Alternative to #118820 and #118815.

The current optimization to skip work when the offsets are zero
or the positions are the original positions is error prone and overly
specific. Such optimizations should be applied to field evaluation
and attribute capturing in general.

This PR significantly simplifies the set position node to compose
fields with the addition function instead of implementing it directly
in the node. Then the position is saved to the geometry with the
generic utility for capturing attributes on geometry.

The most significant lost optimization is for when the positions are
original and the offset is zero. That could still be added back here
directly if we wanted. Or it could be done later in a more general
way that would also help in other places.

Pull Request: https://projects.blender.org/blender/blender/pulls/118857
2024-02-29 16:50:29 +01:00
Omar Emara 1bff17cc99 Compositor: Unify plane anti-aliasing between CPU and GPU
This patch unifies the anti-aliasing of plane deforms between the CPU
and GPU compositors. The CPU used a multi-sample approach, where the
mask was computed 8 times with a jitter, then averaged to get smooth
edges. The GPU relied on the anisotropic filtering with zero boundaries
to smooth the edges.

Furthermore, the CPU implementation ignored the anti-aliasing for the
deformed image and also relied anisotropic filtering like the GPU, so
its outputs were different.

To unify both implementation, we use the existing SMAA anti-aliasing
algorithm instead, and use the anti-aliased mask for the image output as
well. This affects both the Corner Pin and Plane Deform nodes.

A consequence of this change for the Plane Deform node is that motion
blur will appear to have less samples, that's because it was sampled
8-times more in the previous implementation. But users can just increase
the samples in the node to account for that.

Pull Request: https://projects.blender.org/blender/blender/pulls/118853
2024-02-29 12:30:16 +01:00
Aras Pranckevicius 8703173487 Fix: Compile error when WITH_UNITY_BUILD=OFF 2024-02-29 11:10:21 +02:00
Hans Goudey 860f3ed794 Geometry Nodes: Add volume grid conversion nodes
Adds two nodes as "grid" equivalents to the existing volume nodes:
- **Grid to Mesh**
- **Distribute Points in Grid**

The code for the latter is just duplicated for now. In a later step
old node can be replaced by versioning with two new nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/118830
2024-02-29 01:20:27 +01:00
Jacques Lucke fe2a47b5a7 BLI: add chunked list data structure that uses linear allocator
This adds a new special purpose container data structure that can be
used to gather many elements into many (potentially small) lists efficiently.

I originally worked on this data structure because I might want to use it
in #118772. However, also it's useful in the geometry nodes logger already.
I'm measuring a 10-20% speed improvement in my many-math-nodes file
when I enable logging for all sockets (not just the ones that are currently visible).

Pull Request: https://projects.blender.org/blender/blender/pulls/118774
2024-02-28 22:22:21 +01:00
Hans Goudey bea33a6be9 Geometry Nodes: Add volume grid creation nodes
Add three nodes to the currently experimental volume grid nodes:
- **Mesh to Density Grid**
- **Mesh to SDF Grid**
- **Points to SDF Grid**

These nodes are just wrappers over basic OpenVDB utilities.
The difference from existing volume nodes is that they output
a grid directly instead of a geometry set.

See the design here: https://devtalk.blender.org/t/volumes-in-geometry-nodes-proposal/31917

Pull Request: https://projects.blender.org/blender/blender/pulls/118761
2024-02-28 22:15:10 +01:00
Iliya Katueshenock 6872963e4f Fix #118748: Geometry Nodes: Skip any processing of string attributes
String attributes are not handled correctly (or at all) by geometry nodes
currently because their storage is very inefficient and will likely have to
change in the future anyway. Elsewhere processing string attributes was
explicitly disabled. That was missing in these cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/118802
2024-02-27 23:33:04 +01:00
Jacques Lucke 086b808671 Merge branch 'blender-v4.1-release' 2024-02-27 20:40:29 +01:00
Jacques Lucke 64febcf155 Fix #116820: make sure that simulation runs when it contains an active viewer
Previously, the viewer node would work, but since the simulation output node
was never evaluated, the new simulation state was never stored. Now make
sure that the simulation output node is executed when there is an active viewer
inside the simulation.

Pull Request: https://projects.blender.org/blender/blender/pulls/118804
2024-02-27 20:37:52 +01:00
Jacques Lucke c96e0a24bf Fix #116598: disable color overlay for rotation values
Currently, we don't support this. Depending on the geometry type, the rotations
are either displayed as black, magenta or there is a crash. Better disable this for
now until we have a proper implementation. It's not quite obvious how rotation
values should be converted to a color, so this also needs some design work.

Pull Request: https://projects.blender.org/blender/blender/pulls/118808
2024-02-27 20:30:01 +01:00
Lukas Tönne ffcdf8b4dc Cleanup: Remove unused lambda capture. 2024-02-27 09:46:49 +01:00
Campbell Barton 9795c432e1 Cleanup: avoid redundant copy-by-value for 4x4 matrices & float3 2024-02-27 17:57:50 +11:00
Hans Goudey 2697413fc7 Cleanup: Remove unused code in points to volume node 2024-02-26 15:04:29 -05:00
Hans Goudey 0f9ee1194f Geometry Nodes: Add link drag search items to store named grid node 2024-02-26 15:04:29 -05:00
Hans Goudey 9d349896a7 Cleanup: Remove BKE_mesh.hh include from mesh_to_volume.cc
Avoid rebuilding this file when changing BKE_mesh.hh, since it's very slow.
Instead pass the necessary data directly as spans.
2024-02-26 15:04:28 -05:00
Hans Goudey 291a3c681f Cleanup: Sort node definitions alphabetically 2024-02-26 15:04:28 -05:00
Jacques Lucke 9a3ceb79de BLI: add weighted parallel for function
The standard `threading::parallel_for` function tries to split the range into
uniformly sized subranges. This is great if each element takes approximately
the same amount of time to compute.

However, there are also situations where the time required to do the work for
a single index differs significantly between different indices. In such a case,
it's better to split the tasks into segments while taking the size of each task into
account.

This patch implements `threading::parallel_for_weighted` which allows passing
in an additional callback that returns the size of each task.

Pull Request: https://projects.blender.org/blender/blender/pulls/118348
2024-02-25 15:01:05 +01:00
Hans Goudey eaea3b846f Cleanup: Small tweaks to sample grid node
- Remove unnecessary includes
- Correct muli-function debug name
- Remove unnecessary variable
2024-02-23 16:53:29 -05:00
Hans Goudey 77cba3d551 Geometry Nodes: Sample grid node
This simple node finds the values of a volume grid at
positions in the local space used in geometry nodes
evaluation. There are three interpolation modes to
choose how to mix values between neighboring voxels.

For the implementation, first the values are sampled
with the grid's type directly, then implicit type conversions
are used to get the final type. This makes gives us flexibility
in case there aren't exact matches in support between grid
types and Blender types.

Pull Request: https://projects.blender.org/blender/blender/pulls/118397
2024-02-22 17:58:09 +01:00
Hans Goudey 6099252dd4 Instances: Move transforms to attribute
Similar to 2e6223d90f, but potentially 16 times more effective.
The new attribute is named "instance_transform". It isn't displayed in the
spreadsheet since that wouldn't really be useful. This simplifies a lot of
code since it doesn't have to handle transforms specially anymore. But
complexity is added in the store named attribute node and attribute input
node to keep the old "position" attribute working for compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/118531
2024-02-22 17:57:09 +01:00
Omar Emara 2bd80f4b7a Realtime Compositor: Implement Legacy Cryptomatte
This patch implements the Legacy Cryptomatte node for the Realtime
Compositor. The only difference in logic between the new and legacy
Cryptomatte nodes is the source of the layers, so we share the same code
using a base class and specialize layer retrieval as needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/118570
2024-02-22 07:39:42 +01:00
Hans Goudey f8cf609526 Cleanup: Use C++ Math functions 2024-02-21 07:57:56 -05:00
Hans Goudey de8d302e8b Cleanup: Use utility for finding index masks from group IDs
148cad93e3
2024-02-20 13:26:56 -05:00
Jacques Lucke 0494605e7e Geometry Nodes: support group ids in Geometry Proximity node
This is the same 75e9056cac but for the Geometry Proximity node.

Pull Request: https://projects.blender.org/blender/blender/pulls/118467
2024-02-20 17:15:23 +01:00
Jacques Lucke 148cad93e3 BLI: simplify creating index masks from group ids
Pull Request: https://projects.blender.org/blender/blender/pulls/118498
2024-02-20 13:18:16 +01:00
Omar Emara db8b7a31f5 Fix #118461: Compositor backdrop is only updated partially
The compositor backdrop is only updated partially for the GPU compositor
when the render percentage is less than 100. That's because the viewer
node wrongly considered the compositing space, while its space is only
affected by its input. So this patch fixes that by ignoring the
compositing space for viewer nodes.
2024-02-20 09:19:48 +02:00
Jacques Lucke 6c46178a7f Geometry Nodes: support wildcard in Remove Named Attribute node
This adds support for removing multiple named attributes from a geometry at once
using a string pattern that can contain a single wildcard character (`*`).

Using the pattern `sim_*` removes all attributes with the `sim_` prefix for example.

The most difficult design issue here is the decision of what pattern matching language
to use. In the end we only settled on the lowest common denominator for now. This
is already very useful and does not limit us much in the future if we want to support
more complex pattern matching. Once we support lists, some of the use-cases can
also be solved more generally without extra functionality in the Remove Named Attribute
node.

Different pattern matching languages have been discussed before:
https://devtalk.blender.org/t/string-pattern-matching-language-in-blender-and-geometry-nodes/27410

Pull Request: https://projects.blender.org/blender/blender/pulls/118258
2024-02-19 21:21:18 +01:00
Brecht Van Lommel 0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
2024-02-19 15:59:59 +01:00
Iliya Katueshenock 9e12a675b5 Cleanup: Merge BKE_node.h into BKE_node.hh
Trivial change, just move all the code from `BKE_node.h` to `BKE_node.hh` header top.
No mixing code from different headers or namespace changes. Part of #117773

Pull Request: https://projects.blender.org/blender/blender/pulls/118407
2024-02-19 15:26:10 +01:00
Jacques Lucke 1f30f41af8 Geometry Nodes: align input and output sockets in simulation and repeat zone nodes
This changes the drawing of the zone nodes to align corresponding input
and output sockets. The resulting nodes are smaller and it's easier to see
how data is passed through them.

Drawing aligned sockets is already technically supported for quite a while
already, but we haven't used it so far. Using them for zone nodes seems to
provide benefits only. How we use aligned sockets in other nodes still has
to be discussed more.

This patch only changes run-time data. It doesn't affect what is written to
.blend files.

In the node declaration, aligned sockets are created by tagging a socket
so that it is aligned with the previous socket. This is a bit different from
what we had before where a single socket declaration would be used for
an input and output socket. I think the approach used here works better,
especially in a potential future scenario where the input and output socket
has a different type.

Pull Request: https://projects.blender.org/blender/blender/pulls/118335
2024-02-19 13:32:01 +01:00
Iliya Katushenock c2b56ca468 Cleanup: prevent unnecessary copy of VArray
Pull Request: https://projects.blender.org/blender/blender/pulls/118349
2024-02-17 21:44:21 +01:00
Hans Goudey c4bdfba15d Cleanup: Sort geomery node static definitions 2024-02-16 14:43:36 -05:00
Omar Emara 7683449877 Cleanup: Unused function warning in Denoise node
The warning happens when OIDN is disabled as a build option.
2024-02-16 14:10:11 +02:00
Omar Emara e7ffe74920 Realtime Compositor: Support canceling evaluation
This patch adds support for canceling compositor evaluations for the
realtime compositor. Only the canceling of the Denoise operation is
supported for now. That's because inter-operation canceling is not
feasible since all work will have been submitted to the GPU driver
before the user is able to cancel. So some kind of blocking operations
would need to used to actually allow canceling, which is not something
we are going to investigate as part of this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/117725
2024-02-16 08:32:03 +01:00
Jacques Lucke 75e9056cac Geometry Nodes: support group ids in Sample Nearest Surface node
This adds group ids to the `Sample Nearest Surface` node. This allows e.g. finding
the closest point on a specific mesh island.

Three new sockets are added:
* `Group ID`: Is evaluated on the face domain and splits the input mesh into  multiple
  parts, each with its own id.
* `Sample Group ID`: Determines in which group the closest nearest surface is detected.
* `Is Valid`: Outputs true if a nearest surface was found, it's false if the group is empty.

Pull Request: https://projects.blender.org/blender/blender/pulls/118150
2024-02-15 20:35:02 +01:00
Miguel Pozo 50a3a0253d Revert "EEVEE: Remove Thickness output"
This reverts commit 91b727028a.
The change was only meant for 4.1.
Thickness output is required for EEVEE-Next.
2024-02-15 18:04:30 +01:00
Miguel Pozo 5eac9e6095 Merge branch 'blender-v4.1-release' 2024-02-15 17:59:44 +01:00
Miguel Pozo 91b727028a EEVEE: Remove Thickness output 2024-02-15 17:57:20 +01:00
Hans Goudey af9709089e Cleanup: Remove unnecessary set curve type optimization
Now that attributes use implicit sharing, copying CurvesGeometry
is relatively cheap, and the complexity of this function isn't worth
the remaining optimization of avoiding user count updates.
2024-02-15 11:35:33 -05:00
Omar Emara 49faea5f36 Fix #111345: Compositor uses entire viewport in camera view
The compositor assumes the entire viewport as its compositing space even
in camera view. The current design decision was to limit the compositing
space by the camera region only if the camera passepartout is opaque,
that is, areas outside of the camera are not visible.

This patch changes that behavior to always limit the compositing space
by the camera region. The downside is that areas outside of the camera
will be left uncomposited.

This is useful to match viewport compositing to final render compositing
in terms of maintaining the same space, but not necessarily the same
resolution. However, this still has the limitation that space will be
different when the camera region intersects the viewport, since we only
composite their intersection in that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/118241
2024-02-15 15:46:34 +01:00
Campbell Barton 3dde1e9df7 Merge branch 'blender-v4.1-release' 2024-02-15 11:03:45 +11:00
Iliya Katueshenock 85b93772db Fix #118104: Menu Switch shows menu socket in input link-drag-search
The node currently doesn't support outputting the menu socket type.

Pull Request: https://projects.blender.org/blender/blender/pulls/118110
2024-02-14 16:49:07 +01:00
Hans Goudey 1c0f374ec3 Object: Move transform matrices to runtime struct
The `object_to_world` and `world_to_object` matrices are set during
depsgraph evaluation, calculated from the object's animated location,
rotation, scale, parenting, and constraints. It's confusing and
unnecessary to store them with the original data in DNA.

This commit moves them to `ObjectRuntime` and moves the matrices to
use the C++ `float4x4` type, giving the potential for simplified code
using the C++ abstractions. The matrices are accessible with functions
on `Object` directly since they are used so commonly. Though for write
access, directly using the runtime struct is necessary.

The inverse `world_to_object` matrix is often calculated before it's
used, even though it's calculated as part of depsgraph evaluation.
Long term we might not want to store this in `ObjectRuntime` at all,
and just calculate it on demand. Or at least we should remove the
redundant calculations. That should be done separately though.

Pull Request: https://projects.blender.org/blender/blender/pulls/118210
2024-02-14 16:14:49 +01:00
Campbell Barton 5a86067ff0 Fix build error from duplicate include 2024-02-14 14:27:58 +11:00
Hans Goudey 1cfe9dd08c Geometry Nodes: Matrix socket type, attribute type, and initial nodes
Implements the design from #116067.
The socket type is called "Matrix" but it is often referred to as "Transform"
when that's what it is semantically. The attribute type is "4x4 Matrix" since
that's a lower level choice. Currently matrix sockets are always passed
around internally as `float4x4`, but that can be optimized in the future
when smaller types would give the same behavior.

A new "Matrix" utilities category has the following set of initial nodes"
- **Combine Transform**
- **Separate Transform**
- **Multiply Matrices**
- **Transform Direction**
- **Transform Vector**
- **Invert Matrix**
- **Transpose Matrix**

The nodes and socket type are behind an experimental flag for now,
which will give us time to make sure it's the right set of initial nodes.
The viewer node overlay doesn't support matrices-- they aren't supported
for rendering in general. They also aren't supported in the modifier interface
currently. But they are supported in the spreadsheet, where the value is
displayed in a tooltip.

Pull Request: https://projects.blender.org/blender/blender/pulls/116166
2024-02-13 18:59:36 +01:00
Philipp Oeser cb37fe751b Fix #118184: crash deleting a material output node
Caused by 7e8fd2cc2c

Code added in above commit didnt take into account that we might have no
output node in the tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/118202
2024-02-13 13:07:27 +01:00
Campbell Barton 1a3b5452c4 Cleanup: unused includes in source/blender/nodes
Remove 166 includes.
2024-02-13 13:23:35 +11:00
Campbell Barton ee0c5e28ad Cleanup: resolve missing declaration warning 2024-02-12 23:26:39 +11:00
Bastien Montagne 5aaadebbe4 Cleanup: Make `BKE_scene.h` a full Cpp header. 2024-02-10 19:16:25 +01:00
Bastien Montagne 54618dbae3 Cleanup: Make `BKE_global.h` a Cpp header. 2024-02-10 18:25:14 +01:00
Thomas Dinges eaeaf8322c BLI: Bump SSE check from 4.1 to 4.2
This will be the new minimum for Blender 4.2, so check for the SSE4.2 flag and update the function name.

Pull Request: https://projects.blender.org/blender/blender/pulls/118058
2024-02-09 20:28:46 +01:00
Bastien Montagne e71ae3b16c Cleanup: Move `BKE_collection.h` to CPP header. 2024-02-09 19:42:38 +01:00
Bastien Montagne 45e7827898 Clenup: Move BLT headers to Cpp.
Noisy but fairly straight forward.
2024-02-09 18:59:42 +01:00
Omar Emara 9743d6992c Compositor: Unify Variable Size Bokeh Blur node
This patch adjusts the Variable Size Bokeh Blur node such that it
matches between CPU and GPU. The GPU implementation is mostly followed
for the reasons stated below.

The first difference is a bug in the CPU implementation, where the upper
limit of the blur window is not considered, but the lower limit is.

The second difference is due to CPU ignoring outside pixels instead of
clamping them to border, which is done until an option is added to the
node to control the boundary condition.

The third difference is due to CPU ignoring the bounding box input.

The fourth difference is that CPU doesn't allow zero maximum blur
radius, which is a valid option.

The fifth difference is that the threshold option, which is only used
for the Defocus node, was considered in a greater than manner, while it
should be greater than or equal. Since the default threshold of one
should allow a blur size of one.

The GPU implementation now considers the maximum size of its input,
following the CPU implementation.

Pull Request: https://projects.blender.org/blender/blender/pulls/117947
2024-02-09 11:52:41 +01:00
Sergey Sharybin 467a132166 Compositor: Implement per-node execution time report
Visually it is the same as the execution time implemented for the
geometry nodes, and it is to be enabled in the overlay popover.

The implementation is separate from the geometry nodes, as it is
not easy or practical to re-use the geometry nodes implementation.

The execution time is stored in a run-time hash, indexed by a node
instance key. This is similar to the storage of the mode preview
images, but is stored on the scene runtime data and not on the node
tree. Indexing the storage by key allows to easily copy execution
statistics from localized tree to its original version.

The time is only implemented for full-frame compositor, as for the
tiled compositor it could be tricky to calculate reliable time for
pixel processing nodes which process one pixel at a time.

Pull Request: https://projects.blender.org/blender/blender/pulls/117885
2024-02-09 10:19:24 +01:00
Miguel Pozo ca259f751d Cleanup: Remove unused parameter 2024-02-08 21:13:14 +01:00
Hans Goudey b2d9f08d5c Merge branch 'blender-v4.1-release' 2024-02-08 14:56:18 -05:00
Hans Goudey 2e6223d90f Geometry Nodes: Move instance reference indices to a builtin attribute
This means the array can be shared between geometries when unchanged,
reducing memory usage and increasing performance. It also means that
handling the data can be done more generically using the attribute
system. In the future the transforms can become attributes too.

Two other changes are related here:
- The "almost unique ids" are cached with a shared cache so they
  are shared too.
- The reference indices are baked as an attribute now, making the process
  more generic and potentially easier to optimize in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/117951
2024-02-08 20:55:34 +01:00
Miguel Pozo 7e8fd2cc2c Fix: GPU: Fix closure evaluation order
EEVEE-Next can only store data for a single (global) closure at a time,
which, when combined with ShaderToRGB nodes, requires extra care in the
order that closures are evaluated.
For example:
![image](/attachments/0c56613f-3515-40a2-bf0e-282a8a99d64e)
Here, after `ntree_shader_shader_to_rgba_branch` there will be 2 Diffuse
nodes (the original and a copy for the ShaderToRGB branch).
However, the generated code order will be something like this:
```
Diffuse (original)
Diffuse (copy)
ShaderToRGB // This resets closures
Mix
```
So while the original node is technically "evaluated", the closure data
is reset after ShaderToRGB.
This patch updates the code generation to ensure closure evaluation is
ordered taking ShaderToRGB branches into account, so the generated code
looks like this:
```
Diffuse (copy)
ShaderToRGB // This resets closures
Diffuse (original)
Mix
```
This also fixes ShaderToRGB support for AOVs, removes unused code, and
fixes several bugs that I've found along the way that were harmless for
EEVEE but broke EEVEE Next.

Pull Request: https://projects.blender.org/blender/blender/pulls/117767
2024-02-08 20:43:50 +01:00
Jacques Lucke e1ee422d12 Nodes: improve handling of deprecated nodes
In 4.1 we deprecate the `Rotate Euler` node in favor of the `Rotate Rotation`
node which uses the new rotation socket type. The node is not removed
(for now) because that would come with compatibility issues. More generally,
we'll likely run into the situation where nodes are deprecated more often in the
future, without actually removing them to keep compatibility. This patch improves
how such nodes are handled in the UI.

The patch does three things:
* Adds a new `Utilities > Deprecated` entry in the add node menu in geometry nodes.
* Moves search items which are deprecated to the bottom in the search results
  (currently, this only works in English, can be fixed in bcon3).
* Adds a new `bNodeType->deprecation_notice` that will result in a deprecation
  warning when the node is used.

Pull Request: https://projects.blender.org/blender/blender/pulls/117905
2024-02-06 19:08:01 +01:00
Jacques Lucke 0ecb20df47 Geometry Nodes: improve socket naming in Sample nodes
This makes the socket names in the sample nodes a bit more aligned.
Specifically, the following names are changed:
* Geometry Proximity: `Target > Geometry`, `Source Position > Sample Position`
* Sample UV Surface: `Source UV Map > UV Map`

Pull Request: https://projects.blender.org/blender/blender/pulls/117908
2024-02-06 18:25:03 +01:00
Hans Goudey 6b6e57c98c Geometry Nodes: Add local/global toggle to Rotate Rotation node
All the option does internally is reverse the order of the rotations,
but this is the same as old "Rotate Euler" node, and it's a bit more
intuitive this way. Also use the same socket names, "Rotation" and
"Rotate By" which are much more intuitive.

Technically it would be better to not have to duplicate the multi-
function just to switch the order of the arguments. But the
evaluator assumes that the order always matches the socket
order currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/117899
2024-02-06 16:23:26 +01:00
Omar Emara 0bd831b087 Fix #117859: Viewport compositor crash for empty camera region
The viewport compositor crashes when in camera view, passepartout is
opaque, and camera region is empty, that is, out of view. That's because
operations didn't handle zero sized compositing regions.

This patch fixes that by allocating invalid results for relevant
operations when the compositing region is invalid.
2024-02-06 13:01:59 +02:00
Damien Picard fa77e9142d UI: fix and improve a few messages
- "can not" -> "cannot" in many places (ambiguous, also see
  Writing Style guide).
- "Bezier" -> "Bézier": proper spelling of the eponym.
- Tool keymaps: make "Uv" all caps.
- "FFMPEG" -> "FFmpeg" (official spelling)
- Use MULTIPLICATION SIGN U+00D7 instead of MULTIPLICATION X U+2715.
- "LClick" -> "LMB", "RClick" -> "RMB": this convention is used
  everywhere else.
- "Save rendered the image..." -> "Save the rendered image...": typo.
- "Preserve Current retiming": title case for property.
- Bend status message: punctuation.
- "... class used to define the panel" -> "header": copy-paste error.
- "... class used to define the menu" -> "asset": copy-paste error.
- "Lights user to display objects..." -> "Lights used...": typo.
- "-setaudio require one argument" -> "requires": typo.

Some issues reported by Joan Pujolar and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/117856
2024-02-05 17:08:17 +01:00
Pablo Delgado Krämer e5b7768830 MaterialX: Add remaining float/vector math operations
Ref #112864

Pull Request: https://projects.blender.org/blender/blender/pulls/117764
2024-02-05 12:28:22 +01:00
Pablo Delgado Krämer 6f0e27abad MaterialX: Enable blackbody and randomfloat nodes
These are supported now with MaterialX 1.38.8 in Blender 4.1.

Pull Request: https://projects.blender.org/blender/blender/pulls/117762
2024-02-05 11:42:22 +01:00
Pablo Delgado Krämer a669fd870e Fix: MaterialX export of less than math node slightly off
Pull Request: https://projects.blender.org/blender/blender/pulls/117763
2024-02-05 11:39:51 +01:00
Jacques Lucke 442429a97c BLI: support formatting StringRef with the fmt library
People were manually converting it to `std::string_view` in many places already.
It's easy enough to allow using `StringRef` directly by providing a `format_as` function.

Also see https://fmt.dev/latest/api.html#udt.

Pull Request: https://projects.blender.org/blender/blender/pulls/117788
2024-02-03 19:14:51 +01:00
Ray Molenkamp fc409e4388 Cleanup: CMake: Modernize extern_fmtlib dependencies
Pretty straightforward

- Remove any fmtlib paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/117787
2024-02-03 18:55:09 +01:00
Jacques Lucke 319b911784 Cleanup: move hash and ghash utils to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/117761
2024-02-02 19:55:06 +01:00
Omar Emara ce2a945dff Cleanup: Correctly name bokeh blur shaders
The bokeh blur shaders are incorrectly named as standard blur shaders,
while this isn't the case. Rename them to include the bokeh keyword.
2024-02-02 13:15:59 +02:00
Philipp Oeser 79a7bdf33e Cleanup: remove empty statements 2024-02-02 11:57:51 +01:00
Jacques Lucke 7d3003be4d Geometry Nodes: store bake item names on disk
Bake items are generally identified by their (generated) identifier.
This allows changing the name and reordering sockets without breaking
baked data.

In the future we want to have some kind of Import Bake node that
ideally automatically creates its output sockets and names them correctly.
For that to work, the baked data has to contain the user-defined names
for each socket. Those names are not used yet.
2024-02-02 10:02:25 +01:00
Hans Goudey dccf0e8699 Cleanup: Move GPU_material.h to C++ 2024-02-01 10:40:30 -05:00
Jacques Lucke 153caeff4d Geometry Nodes: simplify default label in zone nodes
This removes the "Input" and "Output" part of the default label in the
simulation and repeat zone. The outline already makes it very obvious
which one is the input and which one the output. Simplifying the label
makes the zone look prettier. It might also simplify naming other zones
(like for-each zone) in the future, because the name is shorter.

Pull Request: https://projects.blender.org/blender/blender/pulls/117724
2024-02-01 15:20:05 +01:00