Commit Graph

2107 Commits

Author SHA1 Message Date
Hans Goudey
325ceabb09 Fix #141721: Adding curve attributes doesn't invalidate caches
In this report, adding the "resolution" attribute didn't clear the
evaluated positions cache. In some cases capturing an attribute on
the mesh might just add the mesh rather than using an attribute
writer.
2025-07-10 10:02:25 -04:00
Lukas Stockner
eaa5f63ba2 Cycles: Replace thin-film basis function approximation with accurate LUTs
Previously, we used precomputed Gaussian fits to the XYZ CMFs, performed
the spectral integration in that space, and then converted the result
to the RGB working space.

That worked because we're only supporting dielectric base layers for
the thin film code, so the inputs to the spectral integration
(reflectivity and phase) are both constant w.r.t. wavelength.

However, this will no longer work for conductive base layers.
We could handle reflectivity by converting to XYZ, but that won't work
for phase since its effect on the output is nonlinear.

Therefore, it's time to do this properly by performing the spectral
integration directly in the RGB primaries. To do this, we need to:
- Compute the RGB CMFs from the XYZ CMFs and XYZ-to-RGB matrix
- Resample the RGB CMFs to be parametrized by frequency instead of wavelength
- Compute the FFT of the CMFs
- Store it as a LUT to be used by the kernel code

However, there's two optimizations we can make:
- Both the resampling and the FFT are linear operations, as is the
  XYZ-to-RGB conversion. Therefore, we can resample and Fourier-transform
  the XYZ CMFs once, store the result in a precomputed table, and then just
  multiply the entries by the XYZ-to-RGB matrix at runtime.
  - I've included the Python script used to compute the table under
    `intern/cycles/doc/precompute`.
- The reference implementation by the paper authors [1] simply stores the
  real and imaginary parts in the LUT, and then computes
  `cos(shift)*real + sin(shift)*imag`. However, the real and imaginary parts
  are oscillating, so the LUT with linear interpolation is not particularly
  good at representing them. Instead, we can convert the table to
  Magnitude/Phase representation, which is much smoother, and do
  `mag * cos(phase - shift)` in the kernel.
  - Phase needs to be unwrapped to handle the interpolation decently,
    but that's easy.
  - This requires an extra trig operation in the kernel in the dielectric case,
    but for the conductive case we'll actually save three.

Rendered output is mostly the same, just slightly different because we're
no longer using the Gaussian approximation.

[1] "A Practical Extension to Microfacet Theory for the Modeling of
    Varying Iridescence" by Laurent Belcour and Pascal Barla,
    https://belcour.github.io/blog/research/publication/2017/05/01/brdf-thin-film.html

Pull Request: https://projects.blender.org/blender/blender/pulls/140944
2025-07-09 22:10:28 +02:00
Sean Kim
8f7ad48f7b Tests: Update Sculpt render test reference images
Previously, the tests produced inaccurate results when in batched mode
and on Mac. This commit updates them now that the results are consistent
again.

Related to #136688

Pull Request: https://projects.blender.org/blender/blender/pulls/141416
2025-07-09 21:09:42 +02:00
Brecht Van Lommel
13ab5067ce Cycles: Detect volume attribute nodes that can use stochastic sampling
Detect which volume attributes nodes have a linear mapping to their usage
as density / color / temperature in volume shader nodes, and use stochastic
sampling for them.

Pull Request: https://projects.blender.org/blender/blender/pulls/132908
2025-07-09 21:04:38 +02:00
Brecht Van Lommel
646dc7fe4d Cycles: Use stochastic sampling to speed up tricubic volume filter
Stochastically turn a tricubic filter into a trilinear one. This
reduces the number of taps from 64 to 8. It combines ideas from
the "Stochastic Texture Filtering" paper and our previous GPU
sampling of 3D textures.

This is currently only used in a few places where we know stochastic
interpolation is valid or close enough in practice.
* Principled volume density, color and temperature
* Motion blur velocity

On an Macbook Pro M3 with the openvdb_smoke.blend regression test
and cubic sampling, this gives a ~2x speedup for CPU and ~4x speedup
for GPU. However it also increases noise, usually only a little. Equal
time renders for this scene show a clear reduction in noise for both
CPU and GPU.

Note we can probably get a bigger speedup with acceptable noise trade-off
using full stochastic sampling, but will investigate that separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/132908
2025-07-09 21:04:38 +02:00
Brecht Van Lommel
7978799e6f Cycles: Always render volume as NanoVDB
All GPU backends now support NanoVDB, using our own kernel side code
that is easily portable. This simplifies kernel and device code.

Volume bounds are now built from the NanoVDB grid instead of OpenVDB,
to avoid having to keep around the OpenVDB grid after loading.

While this reduces memory usage, it does have a performance impact,
particularly for the Cubic filter. That will be addressed by
another commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/132908
2025-07-09 21:04:38 +02:00
Miguel Pozo
6d9ad29c2a Merge branch 'blender-v4.5-release' 2025-07-09 15:16:46 +02:00
Alaska
d1d22ca484 Fix: Vulkan compositor tests do not run
This commit fixes a issue where GPU compositor tests would always run
with the default GPU backend, Metal for macOS, and OpenGL
for other operating systems.

Now tests correctly run on the defined GPU backend, allowing Vulkan
GPU compositor tests to correctly run with the Vulkan GPU backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/141447
2025-07-09 14:30:50 +02:00
Lukas Tönne
bb293e5677 Regression test for armature deformation on lattice
This is a basic armature deformation test for #141535  using Lattices instead of
Mesh as the target object type. Lattice deformation was briefly broken, which is
caught by this test.

The test adds the general-purpose `unit_test_compare` function to lattice object
data. It only compares lattice point counts and positions for now, more data can
be added later if necessary.

The `MeshTest` class did not support lattice object types yet, so needed some
changes. The Curves case was already supported, but only by full conversion to
mesh data, without actually using the `unit_test_compare` function specific for
curves geometry. This is unchanged, because applying constructive modifiers on
curves does not work. If it were not for this limitation the test could do
actual curves comparisons now.

For lattice support the `MeshTest` class comparison function has been
generalized to all supported object data types. It runs the appropriate
`unit_test_compare` api function and validation where supported (only meshes at
this point).

Pull Request: https://projects.blender.org/blender/blender/pulls/141546
2025-07-09 09:53:00 +02:00
Jesse Yurkovich
26a511df7a Merge branch 'blender-v4.5-release' 2025-07-08 19:45:03 -07:00
Jesse Yurkovich
a8f543f6a8 Fix: USD: Add MeshSequenceCache modifier for animated crease values
The mesh importer was only checking for animated positions, velocities,
and primvars when determining if a cache modifier needed to be used.
Extend this to crease values (and normals) too.

The added test ensures a base level of coverage here.

Related to: #141633

Pull Request: https://projects.blender.org/blender/blender/pulls/141643
2025-07-09 04:44:30 +02:00
Sean Kim
92e9a6d9f1 Tests: Add Multires Apply Base test
Adds a new file for testing the Multires Apply Base operator.

This is not included with the other modifier tests as it is a bit of an
exception - the modifier is not applied at the end for comparison
between the expected result and actual result.

Pull Request: https://projects.blender.org/blender/blender/pulls/141571
2025-07-08 22:17:36 +02:00
Campbell Barton
58959caac9 Merge branch 'blender-v4.5-release' 2025-07-08 23:02:01 +10:00
Marc Hamamji
2aa7502d3b Fix #139533: Select vertices and faces after bevel operation
When beveling a vertex with only 2 connected edges, the resulting
geometry was not selected.

Resolve by not only selecting the faces created by the bevel operation,
but also selecting the vertices created.

Note: apply the same change as before,
the LFS data has been manually pushed.

Ref !139691
2025-07-08 22:57:41 +10:00
Campbell Barton
d9a5377104 Merge branch 'blender-v4.5-release' 2025-07-08 22:20:28 +10:00
Campbell Barton
cbb32d104a Revert "Fix #139533: Select vertices and faces after bevel operation"
This reverts commit 3f6262f115.

There is a problem with the blend file not being on the server,
Reverting until the issue can be resovled.
2025-07-08 22:19:58 +10:00
Campbell Barton
26c90076cf Merge branch 'blender-v4.5-release' 2025-07-08 21:50:49 +10:00
Marc Hamamji
3f6262f115 Fix #139533: Select vertices and faces after bevel operation
When beveling a vertex with only 2 connected edges, the resulting
geometry was not selected.

Resolve by not only selecting the faces created by the bevel operation,
but also selecting the vertices created.

Ref !139691
2025-07-08 21:42:11 +10:00
Jesse Yurkovich
779f6cb387 Merge branch 'blender-v4.5-release' 2025-07-07 21:20:02 -07:00
Michael B Johnson
a5f915d3d3 Fix: USD: Correct the exported extents for point instancers
Adds and corrects the extent attributes of USD PointInstancer prims.
Extents are now computed for PointInstancers just before the USD stage
is saved and during the export finalization step. The unit test has been
updated accordingly.

This PR also marks all point instancers' prototypes as over after the
extent calculation is done, including the prototypes used by nested
point instancers. This follows the official USD recommendation to place
prototypes under a point instancer marked as over:
https://openusd.org/docs/api/class_usd_geom_point_instancer.html#:~:text=place%20them%20under%20a%20prim%20that%20is%20just%20an%20%22over%22

Authored by Apple: Zili Zhou (Liz)

Co-authored-by: Zili (Liz) Zhou <zili_zhou@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/141299
2025-07-08 06:19:32 +02:00
Brecht Van Lommel
ba5bdbcf28 Merge branch 'blender-v4.5-release' 2025-07-07 19:30:07 +02:00
Alaska
b3cc9ed21b Tests: Add intial tests for the OSL camera
This commit adds 4 tests covering the majority of the new features
added with the OSL camera feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/139426
2025-07-07 19:08:44 +02:00
Christoph Neuhauser
6cf0adc06a Tests: Add minimum number of frames tested in EEVEE performance tests
This commit adds a minimum number of frames tested in the EEVEE
performance tests (`tests/performance/tests/eevee.py`). This way,
test results are more reliable for .blend files with a low number of
animation frames.

Pull Request: https://projects.blender.org/blender/blender/pulls/141290
2025-07-07 17:22:29 +02:00
Namit Bhutani
e5db240434 Mesh: Spatial Reordering for Sculpt Speed Improvements
**Problem Description**

Blender's current mesh data layout often lacks spatial coherence,
causing performance bottlenecks during BVH construction for sculpting
and painting operations. Each time a BVH is built, the system must
recompute spatial partitioning and vertex groupings from scratch,
leading to redundant calculations and suboptimal memory access patterns.

**Proposed Solution**

This patch implements pre-computed spatial organization of mesh data
through a new `mesh_apply_spatial_organization()` function that:

- Reorders vertices and faces based on spatial locality using recursive
  spatial partitioning.
- Stores pre-computed MeshGroup hierarchies in MeshRuntime for reuse.
- Enables the BVH system to bypass expensive spatial computation when
  pre-organized data is available.

This approach separates the expensive spatial computation from more
frequent BVH rebuilds, providing sustained performance improvements
across multiple sculpting operations.

**Limitations**

- Requires manual invocation (occurs automatically only during remesh
  operations).
- Additional memory overhead for storing MeshGroup metadata.
- One-time computational cost during initial organization.
- Spatial group references are not yet stored in files.

**User Interface**

The feature is accessible via a new "Reorder Mesh Spatially" operator in
the Mesh Data Properties panel under the Geometry Data section. Users
can invoke it manually when needed, or it will be applied automatically
during quadriflow and voxel remesh operations. The operator provides
feedback confirming successful spatial reordering.

Pull Request: https://projects.blender.org/blender/blender/pulls/139536
2025-07-04 20:02:37 +02:00
Alaska
7771c36270 Tests: Add tests for AOV passes on objects with transparent materials
This commit adds a test for the situation in which a AOV pass is used
on a object with a fully or semi-transparent material, either using the
transparent BSDF directly, or mixing it with some other material.

Pull Request: https://projects.blender.org/blender/blender/pulls/141068
2025-07-04 14:29:11 +02:00
Aras Pranckevicius
65ce05eae7 Merge branch 'blender-v4.5-release' 2025-07-04 11:37:22 +03:00
Aras Pranckevicius
641824753a Fix #141434: OBJ importer should apply bounds clamp size to the whole scene
It was applying the bounds clamp to each object individually,
which changed spatial relationships between objects. Make the logic
match what used to be done in the Python OBJ importer back in the day.

Pull Request: https://projects.blender.org/blender/blender/pulls/141446
2025-07-04 10:36:18 +02:00
Sean Kim
6fb90e5303 Fix: Background paint strokes may not initialize certain settings
When a paint stroke is executed instead of processed via the modal
handler, prior to this commit, the `paint_brush_update` function was
not called. This method handles initialization of some temporary stroke
data inside `UnifiedPaintSettings`, which is used by dyntopo when
performing edge collapse.

This had the result of causing a divide by 0 with certain uninitalized
settings when using a brush with dyntopo enabled and calling the
operator from the python API (e.g. from unit testing), resulting in
nonsensical deformations.

There are a number of weak points with the current design:
* This issue was only exposed because of the refactor to the
  `UnifiedPaintSettings`, indicating that despite these values being
  runtime-only, they were still persisted in some cases in .blend files
* The data stored as individual stroke steps is not sufficient to
  reconstruct a paint stroke given a list of screen-space locations, and
  this data is populated outside of the common `stroke` callbacks.

Both of the above issues are wider reaching than this PR is intended to
fix.

This commit ensures that `paint_brush_update` is called in the `exec`
codepath and updates the related test image.

Pull Request: https://projects.blender.org/blender/blender/pulls/141314
2025-07-03 23:00:28 +02:00
Clément Foucault
b4ca7b5022 Fix: Workbench: Broken render tests after AA fix
Broken since c49e9e1773
2025-07-02 16:31:12 +02:00
Ian Yoo
477d44867f Tests: Add bilateral-blur single_value tests
`node_bilateralblur.blend` covered a specific case where the
determinator was a single value. This was renamed to
`node_bilateralblur_det_single_value.blend` and added a single value
 input test for the image, and a standard bilateral blur test for cpu/gpu

Coverage:
- Function: 66.67% -> 100%
- Line: 39.10% -> 100%
- Region: 45.71% -> 100%
- Branch: 22.22% -> 88.89%

Pull Request: https://projects.blender.org/blender/blender/pulls/141315
2025-07-02 12:33:05 +02:00
Sean Kim
1278088aee Merge branch 'blender-v4.5-release' 2025-07-01 09:40:50 -07:00
Sean Kim
5b89f6d973 Tests: Add multires subdivision performance test
Add performance test for subdividing a multiresolution mesh from level
2 to 3. This test ends with a total fine vertex count of approximately
10m, similar to the stroke and BVH tests for multires.

Pull Request: https://projects.blender.org/blender/blender/pulls/141168
2025-07-01 18:40:21 +02:00
Hans Goudey
68759af516 Attributes: Use AttributeStorage for curves and Grease Pencil
This commit moves Curves and Grease Pencil to use `AttributeStorage`
instead of `CustomData`, except for vertex groups. This PR mostly
involves extending the changes from the above commit for point clouds
to generalize to other geometry types.

This is mostly straightforward, though a couple non-trivial places of
note are the joining of Grease Pencil objects (`merge_attributes`), the
"default render fallback" UV for curves objects which was previously
unused at the UI level and just ended up being the first attribute, and
the `update_curve_types()` call in the curves versioning function.

Similar to:
- fa03c53d4a
- f74e304b00

Part of #122398.

Pull Request: https://projects.blender.org/blender/blender/pulls/140936
2025-07-01 16:30:00 +02:00
Christoph Lendenfeld
8be420ff1f Merge branch 'blender-v4.5-release' 2025-07-01 14:33:41 +02:00
Christoph Lendenfeld
3233ddc3b3 Fix #141243: Crash when removing constraints with drivers via python
The issue was that the depsgraph was not rebuilt, thus
the driver node still stuck around. This then crashed when the
depsgraph evaluated.

The reason why this wasn't caught in the unit tests, was because the
depsgraph was not updated between creating and removing the data.

Pull Request: https://projects.blender.org/blender/blender/pulls/141272
2025-07-01 14:28:27 +02:00
Lukas Tönne
fe869232ee Modifiers: Armature deformation test for various modifier settings
Test for armature deform modifier settings that are not yet covered by other tests:

- Vertex Group vs. Envelope deformation and both combined.
- Vertex group masking ('vertex_group' setting of the modifier)
- Inverted vertex group masking
- Preserve Volume (dual quaternions)
- Vertex Group/Envelope influence mixing (bone option)
- B-Bone deformation
- Multi-modifier mixing

Each case has a new test/expected mesh pair in the modifiers test.

Pull Request: https://projects.blender.org/blender/blender/pulls/141054
2025-07-01 14:18:58 +02:00
Ian Yoo
48cef1a0e2 Tests: Add convert-color-space tests
There previously were no `convert_color_space` node tests.
This adds 3 tests which cover the basic `image` case, `single_value`
input case, and the `is_identity` case.

Coverage improvement:
- Function: 18.18% -> 81.82%
- Line: 17.56% -> 82.44%
- Region: 11.11% -> 75.00%
- Branch: 0.00% -> 62.50%

Pull Request: https://projects.blender.org/blender/blender/pulls/141205
2025-07-01 11:17:05 +02:00
Ian Yoo
5957c14e7c Tests: Remove node_levels reference image
This PR deletes `node_levels.png` from `utilities/compositor_renders`.
It is unassociated with any test in the compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/141057
2025-07-01 11:16:30 +02:00
Alaska
b7f1aa4a41 Tests: Add Cycles test for normal map light leaking
In a recent commit (1), light leaking was accidentally introduced on
some objects making use of normal maps (#139870)

This commit adds a test inspired by the file in that report to avoid
issues like this reoccuring in the future.

(1) a6015e1411

Pull Request: https://projects.blender.org/blender/blender/pulls/141065
2025-06-30 18:24:48 +02:00
Bastien Montagne
f9c39d16c5 Fix typo in blendfile_io test. 2025-06-30 17:10:11 +02:00
Ian Yoo
f25c5dc1d6 Tests: Add compositor z-combine anti-alias and single value tests
This improves the z-combine node coverage. The tests cover the
`anti_alias`, `anti_aliased_depth`, and `single_value` related
functions.

Coverage:
- Function: 52% -> 100%
- Line: 49.15% -> 98.86%
- Region: 48.91% -> 96.74%
- Branch: 38.46% -> 86.54%

Pull Request: https://projects.blender.org/blender/blender/pulls/141071
2025-06-30 12:14:25 +02:00
Campbell Barton
0d3826b354 Cleanup: make the blend file header private
This was split out as part of a refactor but isn't intended to be a
new public module for other scripts to use.

Ref !141088
2025-06-28 08:40:31 +10:00
Ian Yoo
c189f2f3ce Compositor Tests: Reorganize folders to match node groupings
This addresses issue #120949 to move compositor tests to reflect the
grouping used when adding a new node.

This PR only moves the relevant single tests and their renders into
matching directories. Folders such as 'multi-node setups' and
'pixel nodes' were not changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/139757
2025-06-26 17:26:59 +02:00
Habib Gahbiche
f2d95e758d Fix: Crash when opening files with animated compositor normal node
Saved files in 4.5 with a compositing node tree containing a Normal
Node with animated 'Dot' input crash in 5.0.

A test case with animated dot and normal inputs was added as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/140908
2025-06-25 11:04:29 +02:00
Sean Kim
a50a88a656 Merge branch 'blender-v4.5-release' 2025-06-24 12:06:10 -07:00
Sean Kim
c542dad3c6 Tests: Add basic subdivision tests for Multires modifier
This test replaces the existing multires modifier test with one that
subdivides the mesh and then compares the result. The existing one has
little purpose, as it applies a modifier with 0 subdivision levels.

Pull Request: https://projects.blender.org/blender/blender/pulls/140567
2025-06-24 21:05:16 +02:00
Sean Kim
74fbeeeccb Merge branch 'blender-v4.5-release' 2025-06-24 10:28:14 -07:00
Sean Kim
f99b35463a Tests: Remove suite level apply_modifiers option for modifier tests
The `apply_modifiers` property of the `RunTest` class overrides
all of the test level `apply_modifier` properties. This prevents
modifiers from manually specifying when a modifier is applied and forces
the modifier to be applied immediately after it is added.

The vast majority of tests do not override the `apply_modifier`
property, the primary usecase for this property is to work in
combination with the `do_compare` property to allow examining the
corresponding .blend file to debug test failures.

This commit simplifies the settings by removing this parameter. It now
only disables applying the modifier if `do_compare` is set to False.

Pull Request: https://projects.blender.org/blender/blender/pulls/140893
2025-06-24 19:27:36 +02:00
Bastien Montagne
8d04546fb7 Benchmark Tests: improve error reporting.
When a benchmark test was failing, there was very little info available
to investigate it. Now report the stdout/stderr generated by the failing
command.
2025-06-24 18:54:55 +02:00
Omar Emara
383c8860a2 Compositor: Remove Texture node
This patch removes the Texture node from the compositor, which was based
on the legacy Internal Textures system in Blender. The main motivation
for removing this node is as follows:

- Procedural texturing nodes that previously existed in shading and
  geometry nodes are now supported in the compositor, which cover 95% of
  what is previously possible using and even adds new possibilities like
  Gabor, Bricks, and various improvements to existing texture types.
- The old texture system did not support GPU evaluation, so it was
  always computed and cached on the CPU, which causes bad performance
  especially for interactive use in the viewport compositor. While the
  new nodes are fully GPU accelerated and do not require any caching.
- The Texture node didn't support Texture nodes, so it was not fully
  supported and we so far had a warning about that.
- The general direction in Blender is to remove the old texture system,
  and the compositor was one of the last main users of it. 5.0 is thus
  the ideal time to remove such use.
- The Texture node was always and still is a source of bugs, since it
  relies on proper tagging for cache invalidation and updates, which is
  so far not perfect. It also suffers from UI/UX issues, since it needs
  to be adjusted from the properties panel, which can break if there are
  other texture nodes in the context.

This is a breaking change and no versioning was attempted since:

1. It is impossible to get the same results as before due to the use of
different random number generators, so any versioning would just give us
the general look.
2. The Texture node supports a lot of possible configurations. For
instance, each general texture can have many options for the basis type,
and each basis type might have multiple options. So versioning all of
that will take a lot of time, code, and effort.

Pull Request: https://projects.blender.org/blender/blender/pulls/140545
2025-06-24 11:54:39 +02:00