Commit Graph

118724 Commits

Author SHA1 Message Date
Jacques Lucke
ea604b6b80 Fix: avoid crash when there is an unknown interface socket
This needs to be backported to fix #136949.
2025-04-04 11:26:36 +02:00
Omar Emara
56b0b709ea Compositor: Support GPU OIDN denoising
This patch supports GPU OIDN denoising in the compositor. A new
compositor performance option was added to allow choosing between CPU,
GPU, and Auto device selection. Auto will use whatever the compositor is
using for execution.

The code is two folds, first, denoising code was adapted to use buffers
as opposed to passing in pointers to filters directly, this is needed to
support GPU devices. Second, device creation is now a bit more involved,
it tries to choose the device is being used by the compositor for
execution.

Matching GPU devices is done by choosing the OIDN device that matches
the UUID or LUID of the active GPU platform. We need both UUID and LUID
because not all platforms support both. UUID is supported on all
platforms except MacOS Metal, while LUID is only supported on Window and
MacOS metal.

If there is no active GPU device or matching is unsuccessful, we let
OIDN choose the best device, which is typically the fastest.

To support this case, UUID and LUID identifiers were added to the
GPUPlatformGlobal and are initialized by the GPU backend if supported.
OpenGL now requires GL_EXT_memory_object and GL_EXT_memory_object_win32
to support this use case, but it should function without it.

Pull Request: https://projects.blender.org/blender/blender/pulls/136660
2025-04-04 11:17:08 +02:00
Falk David
f17148458d Fix #136844: Grease Pencil vertex colors can get corrupted
Currently, tools like the sculpt tools or vertex paint tools don't do
any viewport culling of points. Meaning that when the screen space
positions are calculated, points that are very far away off-screen,
don't get discarded.

This lead to an issue in `brush_point_influence` because the coordinates
 and the distance function were using 32-bit integers. When a point
was far enough away from the mouse position, this caused an overflow
to happen and the distance as well as the influence returned was negative.

To fix the immediate issue, do the distance calculation using floating
point to avoid the calculation from overflowing.

Note that we should still perform viewport culling of points to avoid
this computation alltogether.

Pull Request: https://projects.blender.org/blender/blender/pulls/136976
2025-04-04 11:14:05 +02:00
Eitan Traurig
a952f5dda6 UI: Rename "Hide Collection" operator to "Hide Other Collections"
The current naming of the Hide Collection operator is counterintuitive.
Hide collection implies that it hides the selected collection, but it hides
all the collections that are not selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/129682
2025-04-04 10:56:27 +02:00
Campbell Barton
620f9271e6 Refactor: use a more directly method of applying UV sticky selection
Replace use of the UvVertMap table with checks using the existing
connectivity data.

This has the advantage that it's simpler to extend to support
for other kinds of connectivity checks - such as flushing
the selection to edges.
2025-04-04 08:02:00 +00:00
Sean Kim
3d08408e73 Fix: Clay strips brush does nothing with 'Original Plane' set
Introduced in de1c911d49

As noted in the comments of this commit, early returning in the
calculation of the Clay Strips brush prior to the plane being calculated
causes the initial value to be unset, which causes the brush to have no
effect even in the initial radius.

Pull Request: https://projects.blender.org/blender/blender/pulls/136962
2025-04-04 07:11:48 +02:00
Campbell Barton
876d3d7522 Cleanup: minor simplification to UV selection check 2025-04-04 01:48:06 +00:00
Campbell Barton
4139d4a8f0 Cleanup: spelling in comments (make check_spelling_*) 2025-04-04 12:48:04 +11:00
Alaska
31633d14b5 Fix #136860: Build failure on big endian platforms
This commit fixes a issue where Blender would not compile
on big endian platforms due to a missing include.

Pull Request: https://projects.blender.org/blender/blender/pulls/136864
2025-04-04 03:13:52 +02:00
Campbell Barton
74900afa56 Cleanup: quiet unused warnings 2025-04-04 10:33:33 +11:00
nutti
eb3fb565bd PyDoc: correct formatting for GPUShaderCreateInfo.depth_write
Ref !136846
2025-04-04 10:18:34 +11:00
Campbell Barton
83135f2849 Cleanup: quiet warning for undefined variable use in CMake 2025-04-04 09:46:03 +11:00
Sean Kim
2307ce1722 Fix: Use math::is_zero instead of equality check for assert
Introduced in e41ed565ff

Pull Request: https://projects.blender.org/blender/blender/pulls/136959
2025-04-03 23:40:36 +02:00
Sean Kim
e41ed565ff Cleanup: Clarify brush plane calculation
* Remove comments that add noise
* Restructure code slightly
* Add asserts
* Switch to some new C++ math functions
* Extract bool for readability

Pull Request: https://projects.blender.org/blender/blender/pulls/136956
2025-04-03 22:38:23 +02:00
Jesse Yurkovich
778e96c033 Cleanup: USD: Remove duplicate implementation of get_unique_path
Put it in a common place.

Pull Request: https://projects.blender.org/blender/blender/pulls/136953
2025-04-03 21:27:15 +02:00
Sean Kim
0e840cf065 Refactor: Restructure paint BVH node gathering methods
This commit extracts the statements that calculate a brush's relevant
paint BVH node `IndexMask` into a dedicated method. A helper return
`struct` is introduced for the `optional` `plane_center` and
`plane_normal` values that are only relevant for the Plane brush
currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/136859
2025-04-03 20:03:51 +02:00
Clément Foucault
d4d5136da0 Fix #136850: HDRI Preview Flickering in Viewport Shading
This was caused by the manager being in sync phase only
between `begin_sync` an `end_sync`. The drawcalls sync
inside `begin_sync` like the lookdev sphere were given
bogus handles.

This also remove some uneeded functions wrappers.
2025-04-03 19:35:51 +02:00
Pratik Borhade
b2950de4a2 Fix #136645: Regression: Preview generation fails for multiple IDs
Fixes: #136842, #136645

Caused by 76d6d169ba
When multiple objects are selected to mark as assets, preview generation
job of previous ID in the for loop is cleared by `ED_preview_kill_jobs`
inside `generate_preview`. To fix this, check if `id->preview` exists then
clear the preview job if exists inside the new function
`ED_preview_kill_jobs_for_id`.
Solution proposed by @JulianEisel. I came up with idea to use `wm_job_find`

Pull Request: https://projects.blender.org/blender/blender/pulls/136918
2025-04-03 19:12:54 +02:00
Omar Emara
0b67bbc16a Fix #136812: Glitches in White Noise node in compositor
The White Noise node in the compositor glitches. That's because the
alpha channel in GPU code is uninitialized. So we simply initialize it
to 1.
2025-04-03 19:09:58 +02:00
Clément Foucault
d7359c8164 Fix #136883: DRW: Crash with empty point cloud
This was caused by an emtpy VBO being bound as
a texture. This is undefined behavior on some implementation.
2025-04-03 18:53:22 +02:00
Hans Goudey
c85b297aac Mesh: Parallelize face to point domain adaptation
Similar to eae60bc3e6.

The performance improvement depends on the attribute type, domain size,
and whether the cached vert to face map is used for something else like
vertex normal calculation during evaluation. In a simple test with a
large cube, I observed a 6.7x improvement in overall FPS for a 4x4
matrix attribute, a 1.12x improvement for a float attribute, and
roughly equivalent performance for booleans.

Pull Request: https://projects.blender.org/blender/blender/pulls/136941
2025-04-03 18:39:49 +02:00
Hans Goudey
7e4d50f1db Geometry Nodes: Align inputs and outputs in many nodes
In several nodes such as the capture attribute, bake, simulation, repeat,
and For Each nodes, we already use alignment of input and output sockets
to show when they correspond, make better use of space, and simplify
the UI. This PR extends that change to many more nodes. Sockets are
aligned when they have the same name and data propagates between
them. For now the various "sampling" nodes like Raycast and Sample
Nearest Surface are left out since their interface is a bit more complex.

Backward and forward compatibility aren't affected by this change;
it's just visual.

Pull Request: https://projects.blender.org/blender/blender/pulls/135876
2025-04-03 17:53:56 +02:00
Clément Foucault
0fdbeba2c3 Fix #136911: Overlay: 3D Cursor disappears when opening File Open dialogue
One of the push constant was not set and was thus
in the last state is was in. This is because
we are not using the Batch or IMM API to draw
the batch, and thus, this push constant has to be
set manually upfront.
2025-04-03 17:28:09 +02:00
Mattias Fredriksson
eae60bc3e6 Mesh: Parallelize corner to point domain adaptation
This commit parallelizes attribute domain interpolation for meshes from
the face corner to vertex domain. Parallel iteration is implemented
using the vertex to face topology map. The same map is used for mesh
normal computations and benefits from potential cost amortization in
its shared cache. This approach then tries to maximize cache usage
while minimizing potential memory consumption by avoiding caching
multiple topology maps.

The performance gain is dependent on the attribute type and domain size.
For a mesh with 16M vertices and 4x4 matrix attribute interpolation,
a 4.5x performance improvement was observed (from 10.7s to 2.38s).

Pull Request: https://projects.blender.org/blender/blender/pulls/135372
2025-04-03 17:01:41 +02:00
Clément Foucault
299a581b1b Grease Pencil: Accumulation Anti-aliasing
This adds a new more accurate antialiasing to the Grease Pencil
render engine. This is only available for render.

This Accumulation AA doesn't replace the SMAA. SMAA is still
used by the viewport and for removing aliasing from the
depth buffer. However, using both at the same time can lead
to overblurred result.

Here are some measurements for how much the render time
increases compared to the baseline with different (SSAA) sample
counts (using an example production file, rendered at 1080p,
results might vary depending on the scene complexity):
* 8 samples: +0.14 s
* 16 samples +0.36 s
* 32 samples: +0.58 s

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/136551
2025-04-03 16:52:05 +02:00
Clément Foucault
3064906eb7 Cleanup: GPU: Add ATTR_FALLTHROUGH for shader C++ compilation 2025-04-03 16:38:21 +02:00
Clément Foucault
d767317bd0 Cleanup: GPU: Remove unused geometry_source in create infos 2025-04-03 16:38:21 +02:00
Ben Beilharz
0eccadd452 Compositor: Expose interpolation in Scale node
This patch adds a new interpolation option to the Scale node to control
how pixels are sampled during scaling. For constant sizes, this stores
the interpolation for later realization, while for variable sizes, the
interpolation takes effect immediately.

Pull Request: https://projects.blender.org/blender/blender/pulls/135989
2025-04-03 15:50:57 +02:00
Jacques Lucke
8ec9c62d3e Geometry Nodes: add Closures and Bundles behind experimental feature flag
This implements bundles and closures which are described in more detail in this
blog post: https://code.blender.org/2024/11/geometry-nodes-workshop-october-2024/

tl;dr:
* Bundles are containers that allow storing multiple socket values in a single
  value. Each value in the bundle is identified by a name. Bundles can be
  nested.
* Closures are functions that are created with the Closure Zone and can be
  evaluated with the Evaluate Closure node.

To use the patch, the `Bundle and Closure Nodes` experimental feature has to be
enabled. This is necessary, because these features are not fully done yet and
still need iterations to improve the workflow before they can be officially
released. These iterations are easier to do in `main` than in a separate branch
though. That's because this patch is quite large and somewhat prone to merge
conflicts. Also other work we want to do, depends on this.

This adds the following new nodes:
* Combine Bundle: can pack multiple values into one.
* Separate Bundle: extracts values from a bundle.
* Closure Zone: outputs a closure zone for use in the `Evaluate Closure` node.
* Evaluate Closure: evaluates the passed in closure.

Things that will be added soon after this lands:
* Fields in bundles and closures. The way this is done changes with #134811, so
  I rather implement this once both are in `main`.
* UI features for keeping sockets in sync (right now there are warnings only).

One bigger issue is the limited support for lazyness. For example, all inputs of
a Combine Bundle node will be evaluated, even if they are not all needed. The
same is true for all captured values of a closure. This is a deeper limitation
that needs to be resolved at some point. This will likely be done after an
initial version of this patch is done.

Pull Request: https://projects.blender.org/blender/blender/pulls/128340
2025-04-03 15:44:06 +02:00
Andrej730
508fc4c8a8 Fix #136891: changed legacy enum names for some compositor nodes
Followup to b43e2168e3.

Pull Request: https://projects.blender.org/blender/blender/pulls/136928
2025-04-03 15:43:56 +02:00
Julian Eisel
5ea2ab3559 Fix: Adding Freestyle texture doesn't add texture tab in properties
Found while investigating #136359.

Steps to reproduce:
- Switch 3D View in Layout workspace to Texture Nodes Editor
- Set the Texture Type selector to Line Style
- Press New
- Notice how no Texture tab appears in the Properties, even though there
  is a texture user on the frestyle line set now.

Pull Request: https://projects.blender.org/blender/blender/pulls/136621
2025-04-03 15:06:37 +02:00
Clément Foucault
f8de6c31bc EEVEE: Move Object ID storage to gbuffer header layer
This allow to store the full object ID inside a `uint32`
buffer. This allows to get the per object data in deferred
passes and avoid to store object data inside the Gbuffer.

This data is only written if needed.

This had to modify the implementation of subpass input
for all backend to be able to bind layered texture.
This currently work because only the layer 0 is bound to the
framebuffer. This is fragile but I don't see a good builtin way
to fix it.

Rel #135935

#### Tasks
- [x] Replace light linking bits in Gbuffer
- [x] Replace Object ID in GBuffer for SSS
- [x] Conditional storage
- [x] Dummy storage if not needed

Pull Request: https://projects.blender.org/blender/blender/pulls/136428
2025-04-03 14:00:55 +02:00
Pratik Borhade
2cc5143ca6 UI: Curves and Grease Pencil dimensions in transform side panel
In edit mode, positions of selected points is not shown in transform
side panel. Following existing logic, now introduced
`TransformMedian_GreasePencil`, `TransformMedian_Curves` to track the
median of selected points of grease pencil and Curves respectively.

Resolves #136332

Pull Request: https://projects.blender.org/blender/blender/pulls/136592
2025-04-03 12:27:01 +02:00
Nathan Vegdahl
dc38872326 Fix #136887: collapsed channels not getting filtered properly
When the user filters channels by name, collapsed channel groups weren't getting
filtered properly.

For example, consider the following situation:
- You have a channel group "Transforms" with the F-Curve "X Location" under it.
- You use the name filtering feature with the string "Z".

The single F-Curve under the group will get filtered out by the string, and thus
should be hidden. That also means that the group, now with no visible f-curves,
should also no longer be displayed.

With this bug, if the channel was expanded then this filtering still proceeded
correctly, and both the f-curve and the group were hidden. However, if the group
was *collapsed* then the group would *not* get filtered out, which is incorrect.

The underlying cause is that an early-out "we found an un-filtered fcurve,
that's all the info we need with these flags!" clause in the f-curve filtering
code was happening too early, so it wasn't accounting for name-based filtering.
This PR fixes the issue by moving that early-out code to *after* the name-based
filtering so that it's properly accounted for.

Pull Request: https://projects.blender.org/blender/blender/pulls/136929
2025-04-03 12:26:30 +02:00
Christoph Lendenfeld
05aac73b45 Fix: FCurve noise modifier offset affected by scale
The issue was that the offset would offset by a different
amount depending on the scale property.
This is a regression from the legacy behavior,
and also harder to control in general.

The versioning code only touches FCurves that are not marked
as "legacy" because the legacy noise didn't have that issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/136502
2025-04-03 11:31:23 +02:00
Falk David
ac201c2d9a Fix: Grease Pencil: SVG export uniform width option
The `Use Uniform Width` option did not work the intended way.
Like the comment and the manual says it should "enforce uniform
stroke width by averaging radius".

Instead (as far as I understand) it was simply checking if the stroke had
radii that were all within some margin from one another and then
returning the first radius if that was the case.

There were two other issues:
1. The widths were not computed correctly, multiplying the pixel size
     instead of dividing it.
2. The epsilon to compare the radii was a bit too high (factoring in the
     first issue, this actually never returned a value).

This now computes the widths in screen space and then returns the mean.

Pull Request: https://projects.blender.org/blender/blender/pulls/136903
2025-04-03 10:43:32 +02:00
Pratik Borhade
4c9c9af2d6 Fix: Grease Pencil: Channel color versioning
When file with legacy GP is opened in newer version, dopesheet
channel color is not transferred, they appear dark instead. To
fix this, copy color value from legacy GP layers in versioning code.

Pull Request: https://projects.blender.org/blender/blender/pulls/136876
2025-04-03 10:17:20 +02:00
Sean Kim
67f3c017c1 Fix: Extra space at end of Tilt Strength description
Introduced in bb7e889888

Pull Request: https://projects.blender.org/blender/blender/pulls/136920
2025-04-03 07:57:25 +02:00
Campbell Barton
69a1feabe6 Cleanup: pass BMesh instead of BMEditMesh to UV slection functions
A mix of both argument types were being used, however in almost all
cases only the BMesh is needed
2025-04-03 16:05:43 +11:00
Campbell Barton
ef03889d5f Cleanup: format 2025-04-03 14:45:09 +11:00
Campbell Barton
4ecbada58d Cleanup: move calls to ensure UV selection into a utility function 2025-04-03 14:37:24 +11:00
Sean Kim
cd301e8ed1 Cleanup: Minor formatting changes for BKE_paint_bvh.hh
* Move inline function definition to bottom of file
* Remove `this->` for variables suffixed with "_"

Pull Request: https://projects.blender.org/blender/blender/pulls/136917
2025-04-03 05:06:36 +02:00
Sean Kim
b1ef28c170 Cleanup: Convert some Paint BVH functions to Node member functions
Turns both `bounds_` and `bounds_orig_` accessor functions to be
const `inline` functions that return `const` references.

Pull Request: https://projects.blender.org/blender/blender/pulls/136861
2025-04-03 05:06:07 +02:00
Mukhesh
ae40ee047c VSE: Fixing channel lock when a strip is duplicated from preview
When a strip is duplicated in the preview, it is not being locked.

Unset flag `SEQ_IGNORE_CHANNEL_LOCK` for the duplicated strips.

Pull Request: https://projects.blender.org/blender/blender/pulls/136848
2025-04-03 04:49:16 +02:00
Sean Kim
795e63a4c7 Weight Paint: Remove partial redraw calculations
Partial redrawing of the 3d viewport has not worked since the transition
to 2.8. Despite this, we still calculate the paint BVH bounds of the
affected area.

To avoid this wasted work and simplify the code, we remove the related
functions. Further work to enable partial redraws would not necessarily
be integrated in the same way. Additionally, a minor speedup of 1.05x
(1.00ms to 0.95ms) can be observed with this commit when performing
weight painting on a mesh with 2 million elements.

Similar to #136471

Pull Request: https://projects.blender.org/blender/blender/pulls/136912
2025-04-03 03:13:41 +02:00
quackarooni
8a869c20e9 Geometry Nodes: Match String node
Adds "Starts With", "Ends With", and "Compare" string operations as a
standalone node.

Pull Request: https://projects.blender.org/blender/blender/pulls/136021
2025-04-03 02:57:39 +02:00
Nicola
d001e143a9 Sculpt: Avoid use of BKE_pbvh_redraw_BB
When sculpting high-res meshes, the total number of nodes in the BVH
tree can get quite high and — especially when the brush radius is low —
comparable to the number of vertices influenced by the brush. Under
these conditions, algorithms that run on each node of the BVH,
especially if single-threaded, can become a bottleneck. This issue is
particularly prominent in multires, where the leaf limit is 2500.

The main culprit is `BKE_pbvh_redraw_BB`, which is used when flushing an
update to calculate the redraw bounds. Because partial drawing is
currently broken, and because a future reimplementation of partial
drawing is unlikely to adopt the existing approach, this PR removes the
partial drawing logic from `flush_update_step`.

This patch provides a speedup ranging from 1.25x to 1.45x, depending on
the brush size, when sculpting a small portion of a multires mesh with
roughly 8.1 million faces and 12.6 million vertices using the draw
brush.

Pull Request: https://projects.blender.org/blender/blender/pulls/136471
2025-04-03 00:14:41 +02:00
Sean Kim
bb7e889888 Sculpt: Allow negative values for tilt_strength_factor
Part of #82877

* Adds to description to indicate new functionality.

Pull Request: https://projects.blender.org/blender/blender/pulls/136856
2025-04-02 21:39:54 +02:00
Sean Kim
5546fe9848 Cleanup: Various non-functional pbvh_bmesh.cc changes
* Change #define constant value to static constexpr
* Adds const where possible
* Uses reference instead of pointer where possible
* Uses `float3` instead of raw float array where possible
* Uses std::optional to indicate value that may be null
* Reduces scope of variables where possible
* Uses `std::array` instead of raw arrays where possible
* Combines assignment and declaration where possible
* Lengthens some names from single letters

Pull Request: https://projects.blender.org/blender/blender/pulls/135486
2025-04-02 21:28:19 +02:00
Harley Acheson
3cb1749c31 UI: Status Bar Feedback at Corner Zone While Still
Changes only noticeable to pen users, this PR changes the status bar
information while pressing down on the corner zones but before moving
more than the threshold to start. Split-specific is not shown until
the threshold is met. Most mouse users are dead-still at this point,
but pen users have more movement which currently causes a status bar
change.

Pull Request: https://projects.blender.org/blender/blender/pulls/136900
2025-04-02 21:22:51 +02:00