Commit Graph

150077 Commits

Author SHA1 Message Date
Clément Foucault
8b70166214 GPU: Tests: Avoid test not passing on certain platform
These tests were using exact comparison on data that
was going through lossy conversion steps. Adding
casting or epsilon value fixes the issue.
2025-04-29 15:27:58 +02:00
Kabinet0
dd528023d9 Fix #138000: Retopology overlay broken
Do not skip the depth prepass for the retopology mesh.

Pull Request: https://projects.blender.org/blender/blender/pulls/138042
2025-04-29 15:24:28 +02:00
Omar Emara
93408e03a4 Compositor: Turn Ellipse Mask options to inputs
This patch turns the options of the Ellipse Mask node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138130
2025-04-29 15:20:54 +02:00
Omar Emara
3d4900f412 Compositor: Turn Box Mask options to inputs
This patch turns the options of the Box Mask node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138129
2025-04-29 14:34:23 +02:00
Clément Foucault
ca013ae67a GPU: Tests: Move context creation to SetUpTestSuite
This avoid recreating the GPU context for each individual
tests. This reduces the overhead drastically.

Excluding static_shaders and texture_pool tests I get for GPUVulkanTest:
`Before: 129 tests from 1 test suite ran. (26304 ms total) `
`After: 129 tests from 1 test suite ran. (6965 ms total) `

Including static_shaders and texture_pool tests I get for GPUMetalTest:
`Before: 124 tests from 1 test suite ran. (54654 ms total)`
`After: 124 tests from 1 test suite ran. (1870 ms total)`

Given the tests are run twice for the workarounds versions, the
speedup can be multiplied by 2.

Overall tests time is still largely dominated by shader compilation time.
However, there is still 3x improvement using this patch:

Including static_shaders and texture_pool tests I get for GPUVulkanTest,
GPUVulkanWorkaroundTest, GPUOpenGLTest, GPUOpenGLWorkaroundTest:
`Before: 516 tests from 4 test suites ran. (318878 ms total)`
`After: 516 tests from 4 test suites ran. (106593 ms total)`

Pull Request: https://projects.blender.org/blender/blender/pulls/138097
2025-04-29 14:02:38 +02:00
Jacques Lucke
802addc180 Geometry Nodes: add initial links to new closure zone
This improves the user experience, because the data-flow is not interrupted
temporarily. The automatically inserted links are exactly the same that the
Evaluate Closure node uses when no closure is connected.

Pull Request: https://projects.blender.org/blender/blender/pulls/138125
2025-04-29 13:56:53 +02:00
Campbell Barton
b27459dbd8 Fix #137456: Select shortest path can double-back on itself
The corner-cost bias used when calculating the shortest path meant
the path could cross over itself.

Resolve by tagging vertices as well as edges to prevent stepping across
vertices used by edges that have been added to the heap.
2025-04-29 11:52:01 +00:00
Jeroen Bakker
3aba58b94a Cleanup: Make format 2025-04-29 13:49:24 +02:00
Falk David
1d6f313995 Grease Pencil: Remove minimum thickness clamping
This removes the minimum thickness clamping in the shader.
The reason why this was clamped in the first place was to reduce
aliasing artifacts. With the new super sampling method for
rendering, this should no longer be an issue.

Note: This can break visual compatibility, but the previous radii
were arguably "wrong". This essentially fixes this and renders
the strokes with the actual radii from the attribute.
Previous files that might have relied on the clamping will have
to be updated.

Pull Request: https://projects.blender.org/blender/blender/pulls/138119
2025-04-29 12:46:48 +02:00
Jeroen Bakker
d4986be082 Fix #138088: Anti-aliasing issues in Metal and Vulkan
Metal and Vulkan don't support line smoothing. There is a workaround
implemented. This workaround is only enabled when linesmooth value is
larger than 1. However When using smooth lines it should also be used.

This is fixed by adding a `GPU_line_smooth_get` function for getting the
current line smooth state.

Pull Request: https://projects.blender.org/blender/blender/pulls/138123
2025-04-29 12:32:31 +02:00
Jacques Lucke
1f0eeea2b2 Fix #138084: closure and bundles show up in UI even if disabled 2025-04-29 11:40:23 +02:00
Pratik Borhade
127fbaa0e6 Fix: Grease Pencil: Change split stroke shortcut
Change shortcut to `shift + v`. Currently it conflicts with set handle
type key-item.

Pull Request: https://projects.blender.org/blender/blender/pulls/138078
2025-04-29 11:35:18 +02:00
Aras Pranckevicius
4b161093b4 Fix: Do not create completely empty animation curves in new FBX importer
Some files have animated properties that do not have any actual
animation curve data. Do not try to create f-curves for those. Fixes
a crash on some files.

Pull Request: https://projects.blender.org/blender/blender/pulls/138118
2025-04-29 11:02:33 +02:00
Omar Emara
682ab26994 Compositor: Remove Map UV node Alpha option
This patch removes the Alpha option in the Map UV node. That's because
it currently only has a marginal effect on the result of the node and is
unnoticeable to the user.

The alpha option was supposed to darken the edges of the object that has
the UVs by attenuating the result according to the Laplacian of UV
coordinates. But the attenuation factor was too small to be noticeable.
This option was probably added when UV passes had no anti-aliased alpha
and was therefore needed to smooth the transition at the edges probably.

We asked for user feedback and got feedback from the studio, and it seem
the option is mostly unused.

Pull Request: https://projects.blender.org/blender/blender/pulls/138116
2025-04-29 10:56:33 +02:00
Jacques Lucke
6a90382390 Core: support buffers larger than 2GB in .blend files
This is implements option 1 of #129309. It contains a few changes:
* Split `BHead8` into `SmallBHead8` and `LargeBHead8`. The latter is the new one
  and uses `int64_t` for array sizes instead of just `int`. That applies to to
  buffer size in bytes (`len`) and the array size (`nr`).
* The first .blend file header (the first few bytes of the file) are updated
  according to #129309.
* Support reading files with that use `BHead4`, `SmallBHead8` and `LargeBHead8`.
* New option in the preferences that controls whether new files are written with
  the older `SmallBHead8` or the new `LargeBHead8`. The new file format is
  disabled by default. Potential unofficial 32 bit builds (#67184) always write
  `BHead4`, but can read all types (in theory anyway, can't test it).

Note that there are other places in Blender that don't fully support arrays this
large. E.g. I noticed that the spreadsheet currently can't scroll all the way
down.

The experimental option can be removed once we are in the 5.0 branch, at which
point only 4.5 will be able to open the files saved with 5.0.

Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/129751
2025-04-29 10:55:26 +02:00
Aras Pranckevicius
8528feb7ee Cleanup: replace some spinlocks with atomics or mutexes
- ImBuf reference counting: turn that into just an atomic integer
- Cachefile safety: turn into a mutex, since work under the spinlock
  was quite heavy (hashtable creation, other memory allocations)
- Movie clip editor: turn into a mutex, since work under the spinlock
  was very heavy (reading files from disk, etc.)
- Mesh intersect: remove the previously commented out spinlock path;
  replace BLI mutex with C++ mutex for shorter code

Pull Request: https://projects.blender.org/blender/blender/pulls/137989
2025-04-29 10:42:45 +02:00
Omar Emara
ddc0f9460d Compositor: Turn Lens Distortion options to inputs
This patch turns the options of the Lens Distortion node into inputs.

The Projector option was turned into an enum between two options.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138113
2025-04-29 09:54:12 +02:00
Jeroen Bakker
f6a8993570 Fix #137382: Vulkan: Memory leak when rendering
Each time when rendering an image a new context is created. When the
context is destroyed it can still contain a render graph, which ownership
isn't transferred back to the device. Resulting in an increase of several
MB per render. The render graph is cleanly destroyed during quiting as
there is a master list of created render graphs.

Fixed by moving the ownership of the render graph back to the device
when a context is unregistered.

Pull Request: https://projects.blender.org/blender/blender/pulls/138095
2025-04-29 09:39:45 +02:00
Campbell Barton
5ff7ffe31b Cleanup: use colon after doxygen parameters 2025-04-29 05:04:36 +00:00
Campbell Barton
99d469e4d5 Fix: glitch highlighting gizmos when using a tablet
When using a tablet an increased gizmo hit-radius was used,
afterwards toggling modifier keys could then re-evaluate the
highlighted gizmo with a smaller radius, meaning that pressing modifiers
caused gizmos to become inactive.

Revert [0] while keeping larger radius for both mouse & tablet motion
from 10 to 12 px (scaled by the UI scale).

[0]: a043a0e74d
2025-04-29 04:52:08 +00:00
airyz
b23e5e6068 UI: Expose MOD_MESHSEQ_READ_ATTRIBUTES flag for Mesh Sequence Cache modifier
There is an internal flag which gets set only during USD import,
which allows for custom attributes to be read from Mesh Sequence Cache.
This flag is not shown anywhere in the UI, and is not accessible through
python, which can lead to confusing behavior.

For example, loading a .usd file through `bpy.ops.wm.usd_import` will read
custom attributes, but when  `Mesh Sequence Cache` is added manually then
loading the same usd file through `bpy.ops.cachefile.open` will not load
custom attributes.

Further, if the user edits `object.modifiers['MeshSequenceCache'].read_data`
then `MOD_MESHSEQ_READ_ATTRIBUTES` flag will be removed with no way
to bring it back.

Pull Request: https://projects.blender.org/blender/blender/pulls/132475
2025-04-29 06:28:47 +02:00
Pratik Borhade
8d05ad3195 Fix #138072: UV stitch from menu doesn't allow user to configure what get's stitch
Calling UV stitch from menu executes `exec` function instead of modal() due
to wrong opcontext. Set `operator_context=INVOKE_REGION_WIN` so that
clicking operator from menu invokes `stitch_invoke()` which later calls
modal operation.

Pull Request: https://projects.blender.org/blender/blender/pulls/138075
2025-04-29 06:10:07 +02:00
Brecht Van Lommel
2f96afb4be Fix #138073: Crash with UI display of custom properties
Don't directly access translation context, as this pointer may be an ID
property instead of a real PropertyRNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/138100
2025-04-28 20:16:14 +02:00
Clément Foucault
d819647538 GPU: Tests: Use GHOST_CreateSystemBackground
This will eventually allow to run tests on the buildbot.
2025-04-28 19:04:51 +02:00
илья _
c00cc2312b Cleanup: Geometry Nodes: Avoid copying of input arguments in some cases
There are two way to access input data in geometry nodes: `get_input` and `extract_input`.
They semantially the same as copy and move constructor. Since sometimes we can access
input multiple times in arbitrary context, we can not always use move constructor. But if
execution flow is trivial then `extract_input` should be preferred.

Pull Request: https://projects.blender.org/blender/blender/pulls/138057
2025-04-28 18:53:53 +02:00
Jesse Yurkovich
1325b83758 Fix #137996: Use square texture when baking to color attributes
Instead of creating a 1D 'data' texture during color attribute baking,
where `width = #face corners` and `height = 1`, this PR uses a square
aspect texture instead. This fixes the reported issue and makes baking
faster since large 1D textures are inefficient with tiled rendering.

See PR for measurements and further details.

Pull Request: https://projects.blender.org/blender/blender/pulls/138047
2025-04-28 17:47:57 +02:00
Clément Foucault
d415d8ef09 GPU: Tests: Add missing context cleanup calls
These missing calls would modify the global context.
This is a problem when trying to batch tests
together.
2025-04-28 15:43:25 +02:00
Clément Foucault
98adf4db14 Cleanup: GPU: Tests: Avoid testing more than one value
Also avoid undefined values in vertex buffer.
2025-04-28 15:43:25 +02:00
Lukas Stockner
8fdeebbcb2 Deps: Add missing dependency in apt install guide 2025-04-28 14:59:18 +02:00
Philipp Oeser
dde50b7186 Fix #138071: Cycles World Ray Visibility not updating viewport
(when done from python)

When changing those setting via the **UI**, we somehow get the
dependency graph tagged for changes.
If this happens, the update ripples through the following (and we are
all good):
- `DEG_editors_update` (here the depsgraph update is detected via
`DEG_id_type_any_updated`)
- `deg_editors_scene_update`
- `ED_render_scene_update`
- `ED_render_view3d_update`
- `engine_view_update` which finally calls the renderengine `sync_func`

When doing this from python though, the DEG tag is missing, now added
(similar to 4f15c24705)
We could as well just do a broader update though and use
`update_render_engine`

Since it seems `CyclesVisibilitySettings` are only used for the World
nowadays, this PR also corrects the property descriptions accordingly
(might make sense to split this into a separate commit).

Pull Request: https://projects.blender.org/blender/blender/pulls/138093
2025-04-28 14:55:29 +02:00
Lukas Stockner
be4268ec1c Tests: Cycles: Remove OSL-specific displacement test after fix to match SVM
Since commit 175686f2, the behavior of OSL now matches SVM, so instead of this
separate test this is handled by the regular test and the "does OSL match SVM"
checks.
2025-04-28 14:53:05 +02:00
Jeroen Bakker
a5a36b8e98 Vulkan: Remove from experimental
This changes removes Vulkan from experimental. It should be feature
parity with OpenGL with the exception of USD/Hydra.
Some backports to USD/Hydra developments are being made #133717
and should land soon.

This change only updates UI text that mentions the state of the
backend.

Thanks for the community so far for testing and reporting issues!

Pull Request: https://projects.blender.org/blender/blender/pulls/138086
2025-04-28 14:51:32 +02:00
Omar Emara
375ff1df6b Fix #137724: Crash during render compositing
Blender crashes if the compositor runs from the render pipeline while
the node tree is being drawn. That's because the render pipeline
adjusting the original node tree by calling ntreeCompositTagRender from
a different thread during compositor evaluation, which is unsafe while
the node tree is being drawn on the main thread.

ntreeCompositTagRender seems to update Composite and Texture nodes, but
they don't have update function, so it seems to do nothing in those
cases. It also updates nodes that reference the scene, like the Render
Layers and Cryptomatte nodes, but this seems to be already done in other
places like do_render_compositor_scenes and ntreeCompositUpdateRLayers.
Furthermore, in one of the calls in the render pipeline, it does raw
pointer comparison with the evaluated scene, so the comparison fails and
it does nothing.

Considering the above, it seems this can be omitted from the render
pipeline code.

Pull Request: https://projects.blender.org/blender/blender/pulls/138087
2025-04-28 14:48:47 +02:00
Jonas Holzman
733d65e514 GHOST: Remove GHOST_DisplayManager and its implementations
The GHOST_DisplayManager and its implementations are for the most part
unmaintained and almost completely unused in all backends. To clean
things up, and avoid any confusion about how displays are handled in
each respective GHOST backend, this PR completely removes the GHOST
Display Manager, and move the few remaining logic it still held directly
to the corresponding backends.

The backends that were modified (apart from removing the display manager
initialization call from their init) are:

- Win32: `GHOST_SystemWin32::getNumDisplays()` was calling
  `m_displayManager->getNumDisplays`, the underlying system metric call
  (`GetSystemMetrics(SM_CMONITORS)`) was substituted in place.

- SDL: `GHOST_SystemSDL::createWindow` was calling
  `GHOST_DisplayManagerSDL::getCurrentDisplayModeSDL` which returned its
  `m_mode` data member by reference. Since none of the
  `GHOST_DisplayManagerSDL` member function that modified this data member
  were ever called, the variable `memset` initialization call was
  substituted in place from the `DisplayManagerSDL` constructor

Pull Request: https://projects.blender.org/blender/blender/pulls/138066
2025-04-28 14:26:39 +02:00
Lukas Stockner
b4c8d709e8 Cleanup: Cycles: Deduplicate OptiX module creation
Pull Request: https://projects.blender.org/blender/blender/pulls/138091
2025-04-28 14:04:15 +02:00
Lukas Stockner
175686f286 Fix: Cycles: Shadow terminator logic does not account for OSL bump mapping
The issue here is that the automatic bump shader in OSL adjusts globals.N,
which is used to define each closure's shading normal, but sd->N remains
as it was (unlike SVM, which sets it from svm_node_set_normal).

This is a problem since some code like the shadow terminator stuff uses sd->N,
so to make behavior consistent the fix is to set it from OSL as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/138092
2025-04-28 14:03:55 +02:00
Clément Foucault
58e1f05160 Fix: GPU: Broken blend mode tests
This is caused by 28ad3736e8
The new primitive was drawing 2 faces, doing the
blending twice. Reverting back to a quad fixes it.
2025-04-28 14:01:41 +02:00
Jeroen Bakker
8416e09eb4 Vulkan: Validation error when allocating large vertex buffers
When allocating a large vertex buffer on NVIDIA it tried to allocate it
on the GPU and host visible. This section is limited in size (256MB).
However when allocating a large vertex buffer it should not have been
chosen.

Detected during investigation of #137909.
It removes the validation error, but it is unclear yet if this solves the'
crash as I wasn't able to reproduce the crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/138079
2025-04-28 13:22:41 +02:00
YimingWu
b05b0f413c Grease Pencil: Add separate render pass
This PR adds a separate "Grease Pencil" render pass. Once
the "Grease Pencil" option is checked in the passes list, the
Grease Pencil engine will render to a new render pass for various
composition uses.

Notes:

- Occluded Grease Pencil geometry is not rendered.
- In most cases, using an "Alpha Over" with the rest will result
  in the same render as the "Combined" output. The exception is
  when there are Grease Pencil layers that use a blending mode
  that changes the chromaticity of the alpha channel.

Pull Request: https://projects.blender.org/blender/blender/pulls/137638
2025-04-28 12:59:54 +02:00
Lukas Stockner
0dc4754da4 Cycles: Move OptiX OSL Camera kernel into its own PTX module
On the one hand, this improves initialization time since we don't need to
load/compile the full OSL module with all the shading logic if we're only
using a custom camera with SVM shading.

On the other hand, it also fixes a bug I noticed while preparing test scenes:
The AO and Bevel nodes don't work when using custom cameras with SVM on OptiX.

The issue there is that those two are handled by the SHADE_SURFACE_RAYTRACE
kernel, but since that one has intersection logic, we use the OptiX-specific
kernel even if OSL shading is disabled.
However, with the previous unified OSL module, this would mean loading
SHADE_SURFACE_RAYTRACE from kernel_osl.cu, which has `#undef __SVM__` and
therefore doesn't handle them correctly.

With this change, we'll use the kernels from kernel_shader_raytrace.cu in that
case, which do support SVM nodes just fine.

Disk usage of the new kernel_optix_osl_camera.ptx.zst file is 30KB, so this
also doesn't blow up the kernel disk size (and kernel_optix_osl.ptx.zst is
probably smaller by that amount now).

Since it seems that we can mix modules just fine, I'm suspecting that we could
split the modules properly (intersection, SVM shading with raytracing,
OSL shading, OSL camera), instead of the current approach where modules
essentially correspond to feature set tiers and each includes the previous
one's kernels as well - but that's a separate refactor.

Pull Request: https://projects.blender.org/blender/blender/pulls/138021
2025-04-28 12:49:35 +02:00
Lukas Stockner
54b156bf16 Cycles: Add support for automatic bump mapping on OptiX OSL
All the required parts are already there, just needs to be hooked up.
This is essentially just copying what `osl_eval_nodes<SHADER_TYPE_SURFACE>`
does on the CPU.

Fixes #104276.

Pull Request: https://projects.blender.org/blender/blender/pulls/138044
2025-04-28 12:47:31 +02:00
Lukas Stockner
8bc9f174d3 Fix: Cycles: Wrong derivative handling in OptiX OSL transform()
osl_transform_triple(), osl_transform_dvmdv() and so on are supposed to apply
the given transform in the context of OSL's auto-differentiation system.
Therefore, the given input is a dual vector, containing both the value as v[0]
and its derivatives w.r.t. X and Y in v[1] and v[2].

However, the existing code treats these as a simple list of vectors, applying
the same operation to all three instead of propagating the derivatives.
On top of that, it also treated the given matrix input as if there were three
of them, which isn't the case.

Therefore, this commit replaces the implementation to do the right thing.
The Vector and Normal case are straightforward since the operation is linear,
so applying the same operation to all three vectors works.
The Point case is a bit more complicated, but not too bad when written out.

This bug mostly became apparent when using Object or Camera texture coordinates
with a Bump node, since that node uses OSL differentials and Object/Camera
coordinates are implemented using transform().

I'm pretty sure that all the other builtin functions (e.g. sin) at the bottom
of services_gpu.h have the same problem, but one thing at a time...

Pull Request: https://projects.blender.org/blender/blender/pulls/138045
2025-04-28 12:46:54 +02:00
Omar Emara
d4a57e6cbb Fix #138001: File output node with no inputs crash
Blender crashes when rendering a scene that has a file output node with
no inputs. That's because the preview code assumes that nodes would
always have inputs. So we simply guard against this case.
2025-04-28 13:41:10 +03:00
Weizhen Huang
9cc252088e Fix: Cycles: mix weight not applied on volume emission with SVM
Pull Request: https://projects.blender.org/blender/blender/pulls/138081
2025-04-28 12:29:38 +02:00
Bastien Montagne
132b93ece9 I18N: Updated UI translations from git/weblate repsitory (9cf661d88cfa76). 2025-04-28 12:24:02 +02:00
Omar Emara
39aa73628d Compositor: Turn Color Correction options to inputs
This patch turns the options of the Color Correction node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138003
2025-04-28 12:19:42 +02:00
Urko Mauduit
2dc0a243d3 Fix #118806: Grease Pencil: Add "isolate layer" shortcut to Dope Sheet editor
Numpad * is being used for grease pencil object to isolate active layer
while inside edit/paint mode and mouse is over viewport. This PR
includes same keyitem into dopesheet keymap, so that shortcut
can be used in dopesheet editor context.

Pull Request: https://projects.blender.org/blender/blender/pulls/132054
2025-04-28 12:19:34 +02:00
Brecht Van Lommel
ecd54ba4e4 Cycles: Metal graphics interop
This is trivial with unified memory, and avoids one memory copy.

Pull Request: https://projects.blender.org/blender/blender/pulls/137363
2025-04-28 11:38:56 +02:00
Brecht Van Lommel
b174e5f0d1 Cycles: Vulkan CUDA graphics interop
* Using CUDA external memory
* Checks that device UUID matches Vulkan

Pull Request: https://projects.blender.org/blender/blender/pulls/137363
2025-04-28 11:38:56 +02:00
Brecht Van Lommel
4d7bd22beb Refactor: Cycles: Graphics interop changes
* Add GraphicsInteropDevice to check if interop is possible with device
* Rename GraphcisInterop to GraphicsInteropBuffer
* Include display device type and memory size in GraphicsInteropBuffer
* Unnest graphics interop class to make forward declarations possible

Pull Request: https://projects.blender.org/blender/blender/pulls/137363
2025-04-28 11:38:56 +02:00