Commit Graph

145690 Commits

Author SHA1 Message Date
Jacques Lucke
2fda20e1db Fix #132099: crash when using same geometry on objects with different material counts
The core issue was that the geometry batch cache (e.g. `MeshBatchCache` or
`PointCloudBatchCache`) was dependent on the object. This is problematic when
the the same geometry is used with multiple different objects because the cache
can't be consistent with all of them.

Fortunately, the only thing that was retrieved from the object was the number of
material slots, so if that can be avoided we should be fine. We can't just use
the number of material slots stored on the geometry because that may have no
material slots but still has material indices which are overridden on the object
level.

The solution is to take make the number of materials for a geometry only
dependent on the actual `material_index` attribute and not on the number of
available slots. More specifically, we find the maximal referenced material
index and handle that many materials. This number does not depend on how many
material slots there are on the object, but it still allows the object to
override materials slots that the mesh references.

A downside is that the maximum material index has to be computed which often
requires an iteration over the mesh. Fortunately, we can cache that quite easily
and the computation can be done in parallel. Also we are probably able to
eagerly update the material index in many cases when it's set instead of
computing it lazily. That is not implemented in this patch though.

The largest part of the patch is making the maximal material index easily
available on all the geometry types. Besides that, the material API is slightly
replaced and the drawing code now makes use of the updated API.

Pull Request: https://projects.blender.org/blender/blender/pulls/133498
2025-01-24 12:05:25 +01:00
Jeroen Bakker
2feb435780 Fix: Vulkan: Memory allocation on no-rebar capable platforms
Memory areas was requested to be preferable host visible. On some
platforms this would fail to allocate. Best is to not add preferable
host visible for typically large allocations.

This PR also gives the caller the responsibility to set the allocation flags.

Pull Request: https://projects.blender.org/blender/blender/pulls/133528
2025-01-24 11:54:59 +01:00
Brecht Van Lommel
b11316fa3f Fix: Chinese language translation not working after recent refactor
Properly take into account script when searching for language folders.

Pull Request: https://projects.blender.org/blender/blender/pulls/133532
2025-01-24 11:23:36 +01:00
Omar Emara
759a7a08d9 Fix: Conversion shader fails compilation on MacOS
Argument names can't be the same as a push constant name, so rename the
push constant.

Pull Request: https://projects.blender.org/blender/blender/pulls/133531
2025-01-24 11:14:56 +01:00
Pratik Borhade
15e367f31a Fix #133434: No default tool for image editor view mode
Set sample tool as default for `view` mode of image editor.
Also expanded the condition in `toolsystem_key_ensure_check` so default
tool can be obtained inn view ui_mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133471
2025-01-24 11:04:10 +01:00
Jonas Holzman
b701ba6554 macOS: Fix WITH_GPU_DRAW_TESTS build linking error
The issue was twofold, the `draw_tests` library was missing a link
dependency on `gpu_tests`, and the `gpu_tests` would only be generated
if `WITH_GPU_BACKEND_TESTS` or `WITH_VULKAN_BACKEND` were also ON due
to a superflous condition.

Pull Request: https://projects.blender.org/blender/blender/pulls/133511
2025-01-24 11:00:34 +01:00
Aras Pranckevicius
342235616a Tests: emit more details in import test .txt templates
- Animation keyframes now contain left/right handle information
- More fcurves are emitted
- Material textures emit whether their colorspace is "data"
- More files in fbx test coverage

Pull Request: https://projects.blender.org/blender/blender/pulls/133526
2025-01-24 10:24:33 +01:00
Falk David
7dfdf8f8f6 Cleanup: VSE: Rename rna_def_sequence to rna_def_strip 2025-01-24 10:22:55 +01:00
Falk David
1eb39a8689 Grease Pencil: Sculpt Mode Auto-Masking option
This implements all the auto masking options in sculpt mode.

* Stroke: Only affects strokes that are initially under the cursor.
* Layer: Only affect strokes in the same layer as the initial strokes under the cursor.
* Material: Only affect strokes with the same material as the initial strokes under the cursor.
* Active Layer: Only affect strokes in the active layer.
* Active Material: Only affect strokes that use the active material.

The `Active Layer` toggle in the toolbar has been moved to this panel.

Resolves #130022.

Pull Request: https://projects.blender.org/blender/blender/pulls/132986
2025-01-24 10:20:03 +01:00
Omar Emara
b8db212d95 Compositor: Use OCIO luminance for color to float conversion
This patch uses OCIO luminance for implicit conversion from color to
float in the compositor. This is done to match other node systems, and
because luminance is a much better default than the average formula used
before.

Versioning was added to retain average conversion for old files.

Pull Request: https://projects.blender.org/blender/blender/pulls/133206
2025-01-24 09:40:43 +01:00
Alaska
ddd83226b8 Cycles tests: Remove outdated comment
There was a comment in the Cycles test suite blocklist about UDIM
textures rendering incorrectly. 

This has since been fixed (1) so remove the comment from the blocklist.

(1) 82cc0a3eff
2025-01-24 08:28:48 +01:00
Pratik Borhade
23ff989dc0 Fix: Grease Pencil: Move use_selection property to new row in redo panel
bca8fc76f9 exposed `use_selection` in redo panel of interpolate
sequence, this resolved #133324. But it has been added to same row
Move this property to new row, so it looks nicer.

Pull Request: https://projects.blender.org/blender/blender/pulls/133520
2025-01-24 08:11:50 +01:00
Pratik Borhade
ad3459fb23 Fix #133519: Regression: Cannot select tools in curves sculpt mode
947330e529 accidently removed enum list of SculptCurves tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/133523
2025-01-24 08:09:20 +01:00
Alaska
56f5ba20f9 Tests: Add a Cycles render test for long distance ray precision
When a ray travels a long distance in Cycles, precision related
artifacts can start to appear.

In most situations these aren't noticeable, but with an orthographic
camera, specifically with HIP-RT, the issue can become
quite noticeable.

This commit adds a test for this issue by placing a orthographic camera
1000m away from a subject.

Relevant bug report: blender/blender#117961
Ref: blender/blender-test-data!44
2025-01-24 06:42:59 +01:00
Alaska
491980abd4 Tests: Add Cycles test for the "bake from multires" options
This commit adds tests for the bake normal and displacement from
multires options available in Cycles.

Ref: blender/blender#123012
Ref: blender/blender-test-data!46
2025-01-24 05:53:12 +01:00
Campbell Barton
8495a6b049 Modifier: add (disabled) assertions to validate modifier input/output
There are times it's not clear when an error is introduced,
this helps narrow it down.
2025-01-24 14:04:02 +11:00
Alaska
88f444dd4c Tests: Add render test for distant lights with world volumes
Recently a bug was introduced leading to rendering artifacts on some
devices when rendering a world volume in a scene that also contained a
distant light. This has since been fixed (1).

This commit aims to add a test for this specific case so we can detect
these sorts of issues in the future.

(1) blender/blender@58b7543ede

Ref: blender/blender-test-data!48
2025-01-24 03:24:12 +01:00
Brecht Van Lommel
82cc0a3eff Fix #124847: Cycles OSL UDIM wrong extrapolation with negative UV
Pull Request: https://projects.blender.org/blender/blender/pulls/133507
2025-01-23 22:20:52 +01:00
Brecht Van Lommel
222d6b54cf Fix #112689: Copy image to clipboard doesn't use color management
Pull Request: https://projects.blender.org/blender/blender/pulls/133505
2025-01-23 21:41:16 +01:00
Clément Foucault
f8c1154e7f Fix: DRW: Broken compilation because of missing header 2025-01-23 21:30:07 +01:00
Clément Foucault
160d9508fe Fix: Overlay: Broken GPU compilation tests
The clip variation was added to a common create info
which should not be compiled.
2025-01-23 21:30:07 +01:00
Brecht Van Lommel
63e2adaa79 Fix #127875: Cycles renders image with single UDIM tile wrong
Properly support this case instead of assuming it's not a UDIM.

Pull Request: https://projects.blender.org/blender/blender/pulls/133504
2025-01-23 21:20:01 +01:00
Brecht Van Lommel
9b445da803 Fix #81768: Hang after saving render result not as a copy
This would change the image type in image_save_post, which would make the
logic in BKE_image_acquire/release_renderresult mismatched.

Also consistently call BKE_image_release_renderresult when the render result
is null, rather than only doing it half the time.

Pull Request: https://projects.blender.org/blender/blender/pulls/133503
2025-01-23 21:19:40 +01:00
Jacques Lucke
d79e95f19a Fix: viewer node inputs are grayed out
Don't gray out inputs on nodes that don't have any inputs.
In such cases the inputs can't affect the output but they are
still meaningful.
2025-01-23 19:59:30 +01:00
Jacques Lucke
c1e6cb3a0e Fix: input sockets of output nodes are grayed out
Just like the root group output node, those should be treated
as outputs of the node tree and are thus always used.
2025-01-23 19:34:52 +01:00
Brecht Van Lommel
7584ccc28d Fix #125711: Crash saving stereo EXR image from command line
* Ensure valid bit depth is set along with file type
* Guard against invalid inputs in stereo imbuf creation
* Remove some unused code

Thanks Yiming Wu for finding the cause.

Pull Request: https://projects.blender.org/blender/blender/pulls/133499
2025-01-23 19:15:17 +01:00
Clément Foucault
cfd5d9e3ad Fix #132895: Overlay: Dashed/flickering wireframe overlay on solid shading
This add back the NDC offset that was present in the legacy overlay.

But instead of adding a new view for it, we add `ndc_offset_factor`
to `State` to simplify wire offseting

Instead of modifying the projection matrix, we compute the unit
offset and pass it to the shader which choose the appropriate
factor to apply to the vertex position.

The value is put inside `State` so that it can be referenced
easily by multiple overlays.
Later on (once we move the global UBO inside Overlay) we can
move this to a UBO.

This only implements it for wireframe and edit mesh vert and
edges.

Note: that there seems to be some code duplication with the
edit mesh vertex code. That's to be tackled in another commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/133433
2025-01-23 18:08:20 +01:00
Clément Foucault
1ac4651778 Cleanup: DRW: Remove legacy common_view_lib.glsl
No functional changes. Only moving and renaming stuff.

Pull Request: https://projects.blender.org/blender/blender/pulls/131558
2025-01-23 18:06:22 +01:00
Clément Foucault
4938ac7fa5 Fix: Overlay: Alt+B clipping not working in some edit modes
There was several issue making it broken:
- Missing UBO binding
- Missing shader variation
- Missing shader implementation for edit edges clipping
2025-01-23 17:48:46 +01:00
Clément Foucault
bf77aae7b5 Fix: Selection: Edit mesh selection does not honnor alt+B clipping
The clipping plane state was missing from the passes.
2025-01-23 17:48:46 +01:00
Clément Foucault
dcfd87f01c Fix: Overlay: Missing Alt-B clipping frustum overlay
Detected thanks to a GL error.
2025-01-23 17:48:46 +01:00
Jacques Lucke
436eace765 Core: add functions to print DNA structs with all their members
This adds a new `DNA_print.hh` header which contains functions to print DNA
structs with all their data members in a human readable form. This is intended
for debugging purposes.

The basic usage is very straight forward: `DNA_print_struct(TypeName, data);`.
For example: `DNA_print_struct(bNode, node);`.

There is also `DNA_print_structs_at_address` which is primarily useful when
debugging what is written to a .blend file.

This was originally developed for #133063, but is already quite useful on its
own.

Pull Request: https://projects.blender.org/blender/blender/pulls/133432
2025-01-23 17:37:26 +01:00
Jacques Lucke
619d9e4e01 Fix #98559: support applying Geometry Nodes through multires modifier
Before, it was only possible to apply modifiers through a multires modifier if
they were deform-only. The Geometry Nodes modifier is of course not deform-only.
However, often one can build a node setup, that only deforms and does nothing
else.

To make it possible to apply the Geometry Nodes modifier in such cases the
following things had to be done:
* Update `BKE_modifier_deform_verts` to work with modifiers that implement
  `modify_geometry_set` instead of `deform_verts`.
* Add error handling for the case when `modify_geometry_set` does more than just
  deformation.
* Allow the Geometry Nodes modifier to be applied through a multi-res modifier.

Two new utility types (`ArrayState` and `MeshTopologyState`) have been
introduced to allow for efficient and accurate checking whether the topology has
been modified. In common cases, they can detect that the topology has not been
changed in constant time, but they fall back to linear time checking if it's not
immediately obvious that the topology has not been changed.

This works with the example files from #98559 and #97603.

Pull Request: https://projects.blender.org/blender/blender/pulls/131904
2025-01-23 17:34:30 +01:00
Miguel Pozo
97b4f99aed Fix #133483: Auto Depth broken when X-Ray enabled
Disable x-ray for depth only drawings.

Pull Request: https://projects.blender.org/blender/blender/pulls/133496
2025-01-23 17:11:54 +01:00
Ankit Meel
b858319dd3 macOS/QuickLook: support rich thumbnail in Finder
Support thumbnail that shows the file contents instead
of the default blend file icon for all files in Finder.
Some files may still have the usual blender icon as thumbnail
depending on their contents.

blender-thumbnailer process is kept alive by the system
in the background and is invoked by QuickLook when needed.

The checkbox to disable the extension is present in
the Settings app.

It will NOT be an interactive "Preview" that allows richer
interactions like Panning viewport, or rotating 3D objects.
2025-01-23 17:00:19 +01:00
Ray Molenkamp
92cd4ca295 CMake: Disable WINDOWS_PYTHON_DEBUG
The python debugger in Visual Studio for has been broken for years
but the upstream project over at https://github.com/microsoft/PTVS
show hopeful signs of life once in a while, so there is hope that
at one point this will start working again. That being said people
do keep turning this option on and end up disappointed it isn't
working and they spend a whole bunch of time on trying to get it to
work. So for now rather than removing this functionality
completely, just disable it.
2025-01-23 08:36:30 -07:00
Jacques Lucke
a449625fc4 Curves: make material index attribute builtin on curves geometry
This makes the `material_index` attribute built-in on `CurvesGeometry` which
means that it's built-in on `Curves` and `GreasePencil`. While only Grease
Pencil can use it so far during rendering, we already depend on them on curves
when converting between curves and Grease Pencil.

Making the attribute built-in implies that it is locked to one domain and type
(`Curve` domain and `int32` type in this case).

This makes curves more consistent with meshes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133488
2025-01-23 16:24:22 +01:00
Miguel Pozo
8d392d41c2 Fix: GPU: GPU_indexbuf_bind_as_ssbo
Make the behavior consistent across all backends.
Clean up the GL function.

Follow-up from #132712.

Pull Request: https://projects.blender.org/blender/blender/pulls/133383
2025-01-23 15:40:45 +01:00
Miguel Pozo
49404a042e Fix: Nodes: Only look for compute contexts in geo-node trees
`find_socket_log_contexts` tries to look for `ComputeContext`s
regardless of the tree type.
This doesn't currently cause any problem in main because no other node
editor has zones, but it causes crashes in the NPR branch, and will
crash in main when other tree types add zones support.

(See https://projects.blender.org/pragma37/npr-tracker/issues/13)

Pull Request: https://projects.blender.org/blender/blender/pulls/133447
2025-01-23 15:34:12 +01:00
Brecht Van Lommel
1367a89c80 Fix: Cycles persistent data + motion blur render bugs
Objects would randomly appear and disappear, or get swapped with other
objects. This was due to a missing recalc tag, due to the object to
geometry instance mapping being incomplete.

Fix #100580
Fix #107624
Fix #132026
Fix #99281
Fix #110905

Pull Request: https://projects.blender.org/blender/blender/pulls/133490
2025-01-23 15:29:49 +01:00
Brecht Van Lommel
bd0cca5d6d Fix: Cycles Metal RT assert with persistent data render
Pull Request: https://projects.blender.org/blender/blender/pulls/133490
2025-01-23 15:29:41 +01:00
Falk David
7878b3908b Grease Pencil: Don't show material preview as "disabled"
When locking a material, the preview icon would get greyed-out (as would
the rest of the properties in the row).
This issue is that this defeats the purpose of an accurate preview of
the material. Artists want to know what the material _actually_ looks
like.

This moves the icon into a separate row and property so that
it doesn't get disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/133478
2025-01-23 15:12:59 +01:00
Jeroen Bakker
2bd4e101a0 Fix #130106: Vulkan: Pixelbuffer performance
Cycles uses pixel buffers to update the display. Due to making things
work the vulkan backend downloaded the GPU allocated pixel buffer to the
CPU, Copied it to a GPU allocated staging buffer and update the display
texture using the staging buffer. Needless to say that a (CPU->)GPU->CPU->GPU
roundtrip is a bottleneck.

This PR fixes this by allowing the pixel buffer to act as a staging
buffer as well.

Viewport and final image rendering performance is now also similar.

| **Render** | **GPU Backend** | **Path tracing** | **Display** |
| ---------- | --------------- | ---------------- | ----------- |
| Viewport   | OpenGL          | 2.7              | 0.06        |
| Viewport   | Vulkan          | 2.7              | 0.04        |
| Image      | OpenGL          | 3.9              | 0.02        |
| Image      | Vulkan          | 3.9              | 0.02        |

Tested on:
```
Operating system: Linux-6.8.0-49-generic-x86_64-with-glibc2.39 64 Bits, X11 UI
Graphics card: AMD Radeon Pro W7700 (RADV NAVI32) Advanced Micro Devices radv Mesa 24.3.1 - kisak-mesa PPA Vulkan Backend
```

Pull Request: https://projects.blender.org/blender/blender/pulls/133485
2025-01-23 14:58:49 +01:00
Brecht Van Lommel
426a9cdcbb Fix: Rendered animation player text too small on macOS 2025-01-23 13:32:50 +01:00
Brecht Van Lommel
d5d686d540 Fix: Build error with draw test after recent cleanup 2025-01-23 13:17:20 +01:00
Pratik Borhade
1dff92e8d2 Fix #133454: Grease Pencil: Overlays not updated with selection mode
This is due to missing depsgraph update and notifiers to redraw the
viewport region. `ensure_selection_domain` returns false when entire
domain elements are/ain't selected. This makes the `changed` boolean
false that further prevents update calls. Now fixed with bitwise
condition.

Pull Request: https://projects.blender.org/blender/blender/pulls/133463
2025-01-23 12:40:21 +01:00
Pratik Borhade
01db7f00f0 Fix: Grease Pencil: Auto merge affects cyclic curves
Do not add end points of cyclic curves in KD-tree to skip them from
further processing.

Pull Request: https://projects.blender.org/blender/blender/pulls/133425
2025-01-23 12:25:44 +01:00
Sean Kim
a4a0c81cd6 Overlay: Fade Inactive Geometry filter on object being interactable
Prior to this commit, the Fade Inactive Geometry overlay would inspect
the active object and compare each other object's mode and hide them if
they did not share the same mode.

This was incorrect in the following case:
* If multiple objects were all in similar modes, as can be the case
  with "Lock Object Modes" off, or with multi-edit mode, then objects
  would remain unfaded if they shared the same mode as the active
  object.

To fix this, we explicitly check for both the active and the "other"
object being in edit mode and avoid fading in this case.

Ref: #87704
Pull Request: https://projects.blender.org/blender/blender/pulls/132255
2025-01-23 12:10:45 +01:00
Omar Emara
60468d86e9 Cleanup: Missing static qualifier for local function 2025-01-23 11:59:05 +02:00
Patrick Mours
bedf7ff0c1 Fix #132036: Minimum CUDA architecture in generated OSL PTX code
Cycles supports OptiX on Maxwell and up architectures, but the
default in OSL is to generate PTX targeting Pascal and up. Adjust the
OSL target architecture to Maxwell to fix this.

Pull Request: https://projects.blender.org/blender/blender/pulls/133011
2025-01-23 10:38:05 +01:00