Commit Graph

4590 Commits

Author SHA1 Message Date
Omar Emara 79ca9e5afe Fix: File Output node always has inputs of type Color
The File Output node always has inputs of type Color regardless of the
type of the connected socket. This is because the socket type update
mechanism no longer works, so the default socket type persisted.

This is a regression due to 4a4916db45, where the RNA set function no
longer allows editing socket types for built-in nodes, and the File
Output node utilized the RNA set function. To fix this, we avoid the RNA
route and set the type directly.

This fix is related to #120175 and partially fixes it, though another
fix is still necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/120199
2024-04-04 09:01:20 +02:00
Hans Goudey e7339bdd5f Geometry: Use implicit sharing for deformed positions
Avoid copying the positions array into the evaluated edit hints array
that's used to support editing with deformed positions when there is
a topology-changing procedural operation. In a simple test in sculpt
mode with 706k curve points, memory usage went from 78 to 70 MB.

This adds more duplication would be ideal, mainly because retrieving
the data with write access and making implicit sharing info for arbitrary
arrays aren't abstracted by implicit sharing utilities. It may be possible
to improve both of those aspects, either now or in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/120146
2024-04-03 14:14:34 +02:00
Jacques Lucke 77a34791a3 Fix #119938: performance regression when adding output attribute
Avoid calling `modify_geometry_sets` because this can potentially result in
additional data copies when the geometry references the final mesh of other objects.

For more details, see https://projects.blender.org/blender/blender/issues/119938#issuecomment-1155109.

This implements a special case to avoid the regression until e.g. #119968 is done.

Pull Request: https://projects.blender.org/blender/blender/pulls/120177
2024-04-02 17:48:03 +02:00
Omar Emara 2d6aae8011 Fix: Vector Blur node produce wrong output sometimes
The Vector Blur node sometimes produces wrong output. That's because no
proper memory barriers existed for the SSBO written to by the velocity
dilation pass, so ensure a proper barrier exist.
2024-04-01 16:04:49 +02:00
Omar Emara 62b39c14a3 Fix: Vector Blur node has blocky artifacts
The Vector Blur node has blocky artifacts. That's because one of the
buffers used in the velocity dilation pass was not zero initialized,
while it was written to using atomic max operations, so make sure it is
zero initialized.
2024-04-01 16:01:53 +02:00
Omar Emara 3fe4665b6d Fix: Memory leak Vector Blur node
The Vector Blur node has a memory leak. An output for the velocity
dilation pass was allocated but was never used or release, so we just
remove it.
2024-04-01 15:59:52 +02:00
Omar Emara db13fc01ad Compositor: Unify Defocus node between CPU and GPU
This patch unifies the Defocus node between the CPU and GPU compositors.
Both nodes now use a variable sized bokeh kernel which is always odd
sized for a center pixel guarantee. Further the CPU implementation now
properly handles half pixel offsets when doing interpolation, and always
sets the threshold to zero similar to the GPU implementation.
2024-03-28 14:35:13 +02:00
Omar Emara b115557883 Fix: Compositor Defocus maximum size has no effect
The Defocus node maximum size option has no effect if Z Depth is not
enabled. That's because the code incorrectly uses the maximum CoC radius
even though it is not relevant if Z Depth is disabled. To fix this, use
the maximum size option directly in case of no Z Depth.
2024-03-28 14:11:51 +02:00
Campbell Barton 686605a6dd Cleanup: declare arrays as const where possible 2024-03-28 22:57:57 +11:00
Omar Emara 5ae5614d1e Fix: Chroma Key differs from reference implementation
The GPU compositor Chroma Key node differs from the reference
implementation. This is caused by a typo, where the acceptance angle was
halved after computing tangent instead of before computing it.
2024-03-27 11:10:49 +02:00
Hans Goudey 0cdd429b44 Cleanup: Use newer API for creating IDProperties in most places
There are still a few places that are more complicated where the replacement
to `IDP_New` isn't obvious, but this commit replaces most uses of the ugly
`IDPropertyTemplate` usage.
2024-03-26 15:39:39 -04:00
Hans Goudey efee753e8f Cleanup: Move BKE_idprop.h to C++ 2024-03-26 13:07:04 -04:00
Hans Goudey f41ab9abc1 Cleanup: Combine BKE_idprop C and C++ headers
In preparation for moving the whole BKE_idprop.h to C++.
To keep the git history intact we remove the newer smaller file.
2024-03-26 13:07:04 -04:00
Hans Goudey fc0d8ba012 Cleanup: Remove C++ ifdef checks in C++ headers
Pull Request: https://projects.blender.org/blender/blender/pulls/119900
2024-03-26 04:56:03 +01:00
Hans Goudey 1681e55114 Geometry Nodes: Add 8-bit integer attribute type to store attribute node
We already expose two other types that don't have a directly
corresponding socket type-- float2 and byte colors. This also solves
the inability to write to the nurbs_order attribute in geometry nodes.

Fixes #119843

Pull Request: https://projects.blender.org/blender/blender/pulls/119879
2024-03-25 23:04:11 +01:00
Hans Goudey ccb416322c UI: Add XYZ labels to Set Curve Normal node vector input 2024-03-25 16:58:29 -04:00
Hans Goudey 8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
Hans Goudey c61ecf1f40 Cleanup: Move Mesh edit_mesh pointer to runtime data
The edit mesh is never saved to files, so it should be in the runtime struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/119766
2024-03-21 23:18:49 +01:00
Hans Goudey 575a5c0502 Fix #119744: Regression: Geometry Nodes: Default input not working
Caused by 25a10c211f.

The socket_type field for socket declarations wasn't set for declarations
created from the node group interface DNA tree structure. Arguably the
socket types should be set by the constructors, but setting it in one more
place isn't bad either, and is a simple fix for now.
2024-03-21 13:18:43 -04:00
JonasDichelle 8812be59a4 Compositor: Make Hue Correct node wrap
Compositor: Make Hue Correct node wrap

This patch makes the Hue Correct node as well as the Hue Correct VSE
modifiers to wrap, such that no discontinuities occur for the red hue.
Since it now wraps, the default curve preset now exempts the last point
of the curve.

A new CUMA_USE_WRAPPING flag was added to specify wrapping for curve
maps. The implementation works by adding two virtual points before and
after the terminal points in the curve map, such that their handles
match, and would then produce a continues curve.

This is a breaking change, since existing curves were also adjusted
using versioning. However, the change will not be significant, since in
most realistic cases, the terminal points will be close to each other,
and even with wrapping, the connection will be very sharp, almost
matching the old behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/117114
2024-03-21 15:35:02 +01:00
Jacques Lucke 1fadf2251f Nodes: align functions to check if socket type supports fields or grids 2024-03-20 12:55:49 +01:00
Jacques Lucke 25a10c211f Nodes: support accessing socket type directly from declaration
Previously, we haven't added this because there were plans to use these
declarations at a higher abstraction level where one declaration potentially
contains more than one socket. This hasn't happened yet, and we are also using
other ways to achieve dynamic socket amounts (using dynamic declarations).
Therefore, it is reasonable to simplify the code by storing the integer socket
type in the declaration directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/119691
2024-03-20 12:37:37 +01:00
Jacques Lucke 82f434f444 Nodes: cleanup node declaration finalization
* Extract function for building anonymous attribute references.
* Use is-function-node state directly during building instead of during finalization.

Pull Request: https://projects.blender.org/blender/blender/pulls/119677
2024-03-19 19:54:27 +01:00
Iliya Katueshenock 5319e6af7b Fix: Geometry Nodes: Separate Transform node
Fix of wrong destination for scale and non-normalized rotation matrix.

Pull Request: https://projects.blender.org/blender/blender/pulls/119602
2024-03-19 05:29:38 +01:00
Jacques Lucke 42093bbe3d Nodes: have either input or output socket in declaration
Support for having an input and output socket in the same socket declaration
builder was added for the original node panels to be able to support inline
sockets. However, those were generally disabled for now. As can be seen in the
simulation and repeat zone, inline sockets can work differently too. Having an
input and output in the same socket declaration builder builder makes some
things simpler but makes other things much harder. For example, the current
design wouldn't work all that well if the input and output socket has different
types. This is easier to do with the `align_with_previous_socket` approach.

I'm not yet entirely sure whether we want to use the same approach for
corresponding sockets in the node tree interface, but that can be tried and
decided separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/119599
2024-03-18 14:36:03 +01:00
Jacques Lucke 5da0363013 Fix #119617: crash because node sockets depend on experimental feature flag
This was caused by 62bd0ea5fd. Now the socket is
always created but made unavailable if the feature is disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/119620
2024-03-18 13:57:16 +01:00
Jacques Lucke e4e4b51c83 Fix: add missing socket type in forward declaration list
Not quite sure how I missed this before. It's quite unfortunate that this
causes issues like #119179 in Blender 4.0.
2024-03-17 19:08:40 +01:00
Brecht Van Lommel b8ea467475 Merge branch 'blender-v4.1-release' 2024-03-16 19:45:51 +01:00
Iliya Katueshenock 62bd0ea5fd Fix: Geometry Nodes: GPv3 component is always in Separate Component node
Makes sure the GPv3 component doesn't show up unless the experimental
flag is set.

Pull Request: https://projects.blender.org/blender/blender/pulls/118915
2024-03-16 14:03:13 +01:00
Hans Goudey 972c52feb9 Cleanup: Use enum class for boolean operation
Similar to the recently introduced `Solver` enum. This is just friendlier
and doesn't require including `DNA_node_types.h` in the geometry
module header. There's no strong benefit to declaring these enums in
DNA in practice.
2024-03-14 17:24:27 -04:00
Howard Trickey e3f030cce6 Geometry Nodes: Add float solver to mesh boolean node
This adds a "Solver" option to the geo boolean node, with the options
Exact and Float.
The current geo boolean node only uses the Exact solver.
This adds the ability to use the faster original floating point boolean solver.
The float solver has issues with coplanar and other coincident geometry,
but is generally much faster than the Exact solver, and users have asked
for this option (which is available in the Boolean Modifier and edit mode
boolean tool).

Like the modifier, the Float solver needs to convert the Mesh to BMesh,
do the operation, and then convert back to Mesh. It also has to do it
iteratively if more than two operands are supplied.

This is the first of a planned series of commits that will add a
new exact boolean solver, based on the Ember paper, as a solver option.
Ember will be much faster than the current exact solver, but may still not
be as fast as float, and also will not handle some non-volume-enclosing
inputs as well as Float, so it is likely that the Float solver will always remain.
We may eventually retire the old Exact Solver, however.

This commit also prepares for more sensible code in the future by
changing the internal enum names for the solvers to better reflect the
algorithms used: Fast -> Float, and Exact -> Mesh_Arr (which means
"Mesh Arrangments, the name of the paper upon which the current
exact solver is based).

Co-authored-by: Howard Trickey <trickey@google.com>
Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119294
2024-03-14 20:49:57 +01:00
Omar Emara a3587ee078 Fix: Anti-Aliasing node contrast limit has no effect
The Anti-Aliasing node contrast limit has no effect. This is due to a
typo in the code, where the threshold was used internally as the
contrast limit instead.
2024-03-14 11:53:43 +02:00
Iliya Katueshenock d562a9ce43 Fix #118883: Face Corner component shows in Delete Geometry node
Pull Request: https://projects.blender.org/blender/blender/pulls/118917
2024-03-13 15:38:44 -04:00
Hans Goudey 51c738da1b Cleanup: Mesh: Use updated "corner" name for variables 2024-03-12 14:55:58 -04:00
Hans Goudey 9d76f93451 Merge branch 'blender-v4.1-release' 2024-03-12 11:43:07 -04:00
Iliya Katueshenock 9ee45646b4 Fix #119239: Use attribute names after free
Fix of error introduced in c31718649d. Attribute names will
be freed on domain resizing. This mean, ref-names which is attribute
ids is will be invalid. To avoid this, make sure names will be gathered
only after resize. To avoid unnecessary topology map computation before
mesh resize, check if attributes on required domain exists, instead
of gathering them and check if span is not empty.

Pull Request: https://projects.blender.org/blender/blender/pulls/119242
2024-03-12 16:42:16 +01:00
Falk David 986577f4ce Merge branch 'blender-v4.1-release' 2024-03-12 14:59:23 +01:00
Iliya Katueshenock 29ff84352f Fix #118905: Geometry Nodes: GP3 component and face corner in separate geometry node
Pull Request: https://projects.blender.org/blender/blender/pulls/118916
2024-03-12 14:41:23 +01:00
Jacques Lucke 03dcc6c211 Merge branch 'blender-v4.1-release' 2024-03-12 14:11:27 +01:00
Iliya Katushenock 7c74a042f2 Fix #119364: capturing attributes on output object instances lose object visibility settings
The regression happened because object instances were turned into normal geometry
instances which don't have object-level visibility settings. Long term, this may not be
something we can support, but it's also not something we should break unnecessarily
and accidentally.

Pull Request: https://projects.blender.org/blender/blender/pulls/119370
2024-03-12 14:10:18 +01:00
Howard Trickey 17b2ff6119 Refactor: rename files mesh_boolean_convert to mesh_boolean.
A follow-up to previous commit that moved these files to geometry.
The _convert suffix made sense at one point but is now just confusing.
2024-03-12 07:00:33 -04:00
Jacques Lucke b4e3a00cd3 Merge branch 'blender-v4.1-release' 2024-03-11 19:35:26 +01:00
Hans Goudey dc9249c97f Fix #110562: Crash animating node property affecting socket visibility
For various reasons, the animation system can't properly update the node tree
so that the socket availability caused by changing node enum properties
propagates completely. So animating node properties that affect
socket visibility to change isn't possible without issues like crashes.
Unfortunately that wasn't disallowed before. In this commit there is
a balance of disabling animation on sockets that could reasonably expected
to affect socket visibility, and minimizing breaking changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119221
2024-03-11 19:26:58 +01:00
Howard Trickey 70fa3becad Refactor: Move mesh_boolean_convert from blenkernel to geometry.
Header file is renamed to GEO_mesh_boolean_convert.cc and
files that included it are updated to use that path.
This is in preparation for bigger changes to the internal
boolean API, which make more sense as a "geometry" API
than a kernel API.

Pull Request: https://projects.blender.org/blender/blender/pulls/119336
2024-03-11 18:17:57 +01:00
Jacques Lucke deb332601c Fix #113090, #111450, #104909: node rna properties collide with built-in names
This fixes the following name collisions:
* Compositor Box/Ellipse Mask node: `width` -> `mask_width`
  (also renamed the `height` property accordingly)
* Shader AOV Output node: `name` -> `aov_name`
* Geometry Color node: `color` -> `value`.

Those are breaking changes unfortunately, because looking up those property
names yielded the node-specific and not the common property. Therefore, this is
targeted at `main` instead of `4.1`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119284
2024-03-11 15:57:30 +01:00
Bartosz Kosiorek 0a1dd4be05 UI: Add and improve more shader node descriptions
Pull Request: https://projects.blender.org/blender/blender/pulls/119169
2024-03-11 13:19:17 +01:00
Omar Emara f4f22b64eb Compositor: Add Bloom option to Glare node
This patch implements the GPU Bloom glare for the CPU compositor, and
adds a new option for it, leaving the Fog Glow option unimplemented once
again for the GPU compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/119128
2024-03-11 08:43:52 +01:00
Jacques Lucke 2c5f51e683 Merge branch 'blender-v4.1-release' 2024-03-10 14:04:35 +01:00
Jacques Lucke b020173984 Fix #114120: support output attributes on instanced geometry in geometry nodes modifier
Pull Request: https://projects.blender.org/blender/blender/pulls/119016
2024-03-10 13:02:56 +01:00
Hans Goudey 01941e2b50 Geometry Nodes: Use boolean type for "use attribute" inputs
When the "use_attribute" properties were added, boolean IDProperties
didn't exist. Then we didn't change it for a while because of forward
compatibility concerns. But currently we always convert boolean
properties to integer properties when saving anyway (since
2ea47e0def, so there is no issue with compatibility.
Using booleans makes working with the properties in the Python API
a bit friendlier.

Pull Request: https://projects.blender.org/blender/blender/pulls/119129
2024-03-08 17:49:09 +01:00