Commit Graph

120055 Commits

Author SHA1 Message Date
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
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
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
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
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
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
b8b7f71520 Vulkan: Implement native handles for pixel buffers
* Pixel buffer is always allocated with export and dedicated memory flags.
* Returns an opaque file descriptor (Unix) or handle (Windows).
* Native handle now includes memory size as it may be slightly bigger
  than the requested size.

Pull Request: https://projects.blender.org/blender/blender/pulls/137363
2025-04-28 11:38:56 +02:00
Jeroen Bakker
7d96042ee3 Vulkan: Add dedicated memory bit to external memory pool
This ensures memory has offset zero, makes it easier to share.

Pull Request: https://projects.blender.org/blender/blender/pulls/137363
2025-04-28 11:38:56 +02:00
YimingWu
1f4cae0c46 Grease Pencil: Filter option in render
This PR adds Grease Pencil type filter in the view layer, so users can
control whether Grease Pencil objects should be rendered or not. When
the option is turned off, Grease Pencil rendering is skipped.

Pull Request: https://projects.blender.org/blender/blender/pulls/137667
2025-04-28 11:29:13 +02:00
Howard Trickey
15623b26b9 Fix #137968: Bad custom normals after Manifold boolean.
Custom normals are interpolated with the new Manifold boolean
code. In the other two solvers, there is no interplation for the
CD_PROP_INT16_2D type so custom normals were left at (0,0) when
an exact copy from the input corner isn't possible.
The new code for manifold first does a join mesh, which converts
custom normals to float3, which can be (and are) interpolated.
However, if the input face (or face fragment) has flipped normal
in the boolean output, then the custom normal should be flipped to.
The fix is to do that for attributes called "custom_normal".
The general case of a "normal-like" thing with a different name
remains unsolved, but I doubt that case comes up often.
2025-04-27 19:36:28 -04:00
Clément Foucault
db22802652 DRW: Avoid warning in subdiv shader code
Was missing a return statement.
2025-04-28 00:55:57 +02:00
Guillermo Venegas
8e499caded Refactor: UI: Replace uiLayoutColumnWithHeading with class method uiLayout::column
This converts the public `uiLayoutColumnWithHeading` function to an
object oriented API (an `uiLayout::column` overloaded version), matching
the python API.

Like the original `uiLayout::column`, this overloaded version now also
returns an `uiLayout` reference instead of a pointer. New calls to this
method should use references too.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138056
2025-04-27 17:09:52 +02:00
Jun Mizutani
90b735c28c Fix: UI: Incorrect splash screen width on HiDPI/Retina displays at low window sizes
This patch fixes an issue where the splash screen width clamping
calculation would result in a very narrow size on HiDPI/Retina
display due to the native pixel size not being taken into account.

Fixed by using the `WM_window_native_pixel_x()` function to obtain
the horizontal window size instead of directly using
`CTX_wm_window(C)->sizex`.

Pull Request: https://projects.blender.org/blender/blender/pulls/137997
2025-04-27 14:39:56 +02:00
Bartosz Kosiorek
9bee273649 Physics: Improve fluid baking messages
- Added unit (seconds) to baking process
- Added information at which frame the baking was interrupted

See images in PR description

Pull Request: https://projects.blender.org/blender/blender/pulls/137933
2025-04-27 09:52:29 +02:00
Guillermo Venegas
2d896877d1 Refactor: UI: Replace uiLayoutColumn with class method uiLayout::column
This converts the public `uiLayoutColumn` function to an object oriented
API (`uiLayout::column`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::column` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138034
2025-04-26 21:07:34 +02:00
ChengduLittleA
5e16193b4c Fix #138012: Grease Pencil: Use eval object in compute_objects_bounds
`compute_objects_bounds` should use evaluated object so it can handle
generated/converted geometries correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/138028
2025-04-26 13:55:19 +02:00
Campbell Barton
c90e8bae0b Cleanup: spelling in comments & replace some use of single quotes
Previously spell checker ignored text in single quotes however this
meant incorrect spelling was ignored in text where it shouldn't have
been.

In cases single quotes were used for literal strings
(such as variables, code & compiler flags),
replace these with back-ticks.

In cases they were used for UI labels,
replace these with double quotes.

In cases they were used to reference symbols,
replace them with doxygens symbol link syntax (leading hash).

Apply some spelling corrections & tweaks (for check_spelling_* targets).
2025-04-26 11:17:13 +00:00
Philipp Oeser
b513ff9a8f Fix #132178: "Frames" wrong in the tooltip for movies in image search
This also crashed in a debug build with ASAN reporting heap-use-after-
free.
We were casting an `ImageAnim` to a `MovieReader`, now corrected.

Pull Request: https://projects.blender.org/blender/blender/pulls/137999
2025-04-26 08:00:45 +02:00
Campbell Barton
682e5e3597 Cleanup: spelling in comments (make check_spelling_*) 2025-04-26 00:48:04 +00:00
Guillermo Venegas
f0f0361254 Refactor: UI: Replace uiLayoutRowWithHeading with class method uiLayout::row
This converts the public `uiLayoutRowWithHeading` function to an object oriented
API (an `uiLayout::row` overloaded version), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Same as the original `uiLayout::row`, this overloaded version also now returns an
`uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138014
2025-04-26 02:17:31 +02:00
Jonathan Lampel
f67f10c60f Overlay: Reduce retopology overlay default distance
Changes the default distance to something suitable for working on human
sized objects. The previous default required the object to be quite
massive in scale to look correct.

This not only improves the display but also makes accidental back facing
selection significantly less likely. There will be more cases where the
source object clips through the retopology, but this can also be helpful
as it shows where there are significant differences is the silhouette.
0.01 was chosen in Blender Chat as a nice round number that works for a
variety of objects.

See PR for comparison images.

Pull Request: https://projects.blender.org/blender/blender/pulls/137978
2025-04-26 00:13:46 +02:00
Jesse Yurkovich
cdaa1ebe56 Cleanup: Fix type-limits warning with GCC
Pull Request: https://projects.blender.org/blender/blender/pulls/138020
2025-04-25 23:59:15 +02:00
T0MIS0N
347e294959 Fix #136608: ASAN crash when texture painting
**Problem**
When using Sculpt Texture Paint to paint objects in a debug build,
Blender will crash due to an Address Sanitizer exception,
`stack-use-after-free`. This makes development for Sculpt Texture
Paint harder since the feature can't be used in debug builds without
turning off Address Sanitizer.

Code-wise, the issue here happens when extending UV island borders.
When creating and adding UV primitives to extend the UV border, the
primitives are allocated locally and then added to a list. This means
that when these primitives are accessed later from the list, the ASAN
error is triggered since the primitives have been freed. Freed
primitives are generally accessed when checking if a primitive has
already been added to the primitive list belonging to its connected UV
Edges.

**Solution**
The solution here is to change UV Edges to store the index of a UV
primitive, and not use a pointer to the object itself. This is the best
solution since it makes it fast and simple to check if an UV Edge
already has a reference to its connected primitives, while still
allowing access to the primitive objects since primitives can be
accessed using indexes from mesh data objects.

Co-authored-by: T0MIS0N <50230774+T0MIS0N@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/137032
2025-04-25 21:47:08 +02:00
Jesse Yurkovich
ba60868477 USD: Animated camera property import
Imports in the following animated data from UsdGeomCameras:
- Focal length
- DOF distance
- DOF fstop
- Clip start, Clip end
- Tilt shift x, Tilt shift y
- Aperture sizes (with caveats)

Implementation wise, it's more complicated than I'd like due to needing
to read in both non-animated and animated data for each property. And
because I've tried to reduce the duplication of various transforms we
have to do on each value. E.g. scaling values by "tenth of scene units"
or the extraction of the USD clipping range from a GfVec2f into 2
separate properties, and 2 separate fcurves, in Blender etc. The current
approach was the best I could come up with so far.

Aperture sizes remain problematic for import, with animation data and
without, due to how Blender selects the largest sensor dimension to base
downstream calculations on and for which there's no concept in USD to
strictly dictate which dimension to use. Additionally, changing the
sensor size will impact the Tilt values as well. This means that if the
Aperture sizes are animated, we must also animate the tilt values; leads
to more fcurves being created than perhaps expected.

The `projection` attribute (perspective and orthographic) remains
unchanged (non animated only) due to differences in how USD<>Blender
interoperate with the Orthographic projection method. Note: Blender only
exports perspective cameras due to the same reason.

Pull Request: https://projects.blender.org/blender/blender/pulls/137487
2025-04-25 19:57:12 +02:00
Guillermo Venegas
90644b30b2 Refactor: UI: Replace uiLayoutRow with class method uiLayout::row
This converts the public `uiLayoutRow` function to an object oriented
API (`uiLayout::row`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::row` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/137979
2025-04-25 19:45:25 +02:00
Lukas Stockner
bf412ed9dd Cycles: Support for custom OSL cameras
This allows users to implement arbitrary camera models using OSL by writing
shaders that take an image position as input and compute ray origin and
direction.

The obvious applications for this are e.g. panorama modes, lens distortion
models and realistic lens simulation, but the possibilities are endless.

Currently, this is only supported on devices with OSL support, so CPU and
OptiX. However, it is independent from the shading model used, so custom
cameras can be used without getting the performance hit of OSL shading.

A few samples are provided as Text Editor templates.

One notable current limitation (in addition to the limited device support)
is that inverse mapping is not supported, so Window texture coordinates and
the Vector pass will not work with custom cameras.

Pull Request: https://projects.blender.org/blender/blender/pulls/129495
2025-04-25 19:27:30 +02:00
Clément Foucault
81c00bf272 EEVEE: Shadow Terminator Normal Bias
This implement the design detailed in #135935.

A new per object property called `Shadow Terminator Normal Offset` is
introduced to shift the shadowed position along the shading normal.

The amount of shift is defined in object space on the object datablock.

This amount is modulated by the facing ratio to the light. Faces
already facing the light will get no offset. This avoids most light
leaking artifacts.

In case of multiple shading normal, the normal used for the shift
is arbitrary. Note that this is the same behavior for other biases.

The magnitude of the bias is controlled by `Shadow Terminator Normal Offset`.
The amount of faces affected by the bias is controlled using
`Shadow Terminator Geometry Offset` just like cycles.

Tweaking the `Shadow Terminator Geometry Offset` allows to avoid too much
shadow distortion on surfaces with bump mapping.

Cycles properties are copied from the Cycles object datablock to the
blender datablock. This break the python API for Cycles.

The defaults are set to no bias because:
- There is no good default. The best value depends on the geometry.
- The best value might depend on real-time displacement.
- Any bias will introduce light leaking on surfaces that do not need it.
- There is an additional cost of enabling it, which is proportional
  to the amount of pixels on screen using it.

Pull Request: https://projects.blender.org/blender/blender/pulls/136935
2025-04-25 19:12:04 +02:00
Clément Foucault
417ffa8f54 Fix #137097: Cycles: No occlusion with Grease Pencil in the viewport
This was caused by missing depth of objects.
The old implementation was relying on the external engine
to provide the correct depth of the objects.
This patch does exactly this.

The downside is that, if overlays are present, the prepass
will be also drawn by the overlay engine.

Pull Request: https://projects.blender.org/blender/blender/pulls/138004
2025-04-25 19:05:57 +02:00
Harley Acheson
94acb16e7e UI: Remove Gizmo 3D Part Hit-space Scaling
Removal of the code that scales gizmo 3D part hitspace with gizmo size,
introduced in a043a0e74d, as requested by Campbell.

Pull Request: https://projects.blender.org/blender/blender/pulls/138007
2025-04-25 18:51:58 +02:00
Bastien Montagne
6231267d86 Add missing header in compositing node code after recent change.
Recent clang compilers do not like types that are not fully defined in
the current unit...
2025-04-25 18:30:14 +02:00
Hans Goudey
afd8d744e1 Shape Keys: Tweaks to duplicate operator
- The new shape key is added directly below the source.
- The new shape key is made active.
- The flag, including the lock status, is now copied.
2025-04-25 12:28:37 -04:00
Philipp Oeser
c08d0b53e9 Fix #131778: Grease Pencil: Cursor radius wrong for transformed object
Cursor radius wouldnt match the drawn line if the object was not at the
origin.

When getting the radius in `grease_pencil_brush_cursor_draw`,
`DrawingPlacement::project` gives us a location in layer space.
The following `project_brush_radius` expects a worldspace location as
input though.

So to resolve, convert to worldpsace again.

Pull Request: https://projects.blender.org/blender/blender/pulls/138006
2025-04-25 17:56:57 +02:00
Sybren A. Stüvel
1625d9359d Fix #137864: Action Constraint without Action produces invalid result
When there is no Action set on an Action constraint, the matrix returned
by the constraint would be uninitialized. In practice, this meant an
all-zeroes matrix. Now, the unit matrix is returned in such a case.

Pull Request: https://projects.blender.org/blender/blender/pulls/137965
2025-04-25 17:24:11 +02:00
Omar Emara
7066a8fdb8 Compositor: Support link search for Glare node
This patch supports link search the glare node types, such that users
can add specific effects like Bloom quickly.

Pull Request: https://projects.blender.org/blender/blender/pulls/137988
2025-04-25 17:20:45 +02:00
Julian Eisel
79d760fcae Assets: Disable snap feedback for dragging collections that will be linked
Part of #134755 / #134766.

When linking collections without collection instancing, they cannot be
transformed, so snapping doesn't make sense. Don't draw the snapping indicator
when using drag & drop, it would be misleading.
2025-04-25 17:08:08 +02:00
ChengduLittleA
f47df7bc52 Fix #137792: Applying auto-keyframing when resetting property values.
When resetting a proprety with animation, auto-keyframing should also
record the changed value as a new keyframe.

Pull Request: https://projects.blender.org/blender/blender/pulls/137835
2025-04-25 16:41:18 +02:00
Aras Pranckevicius
393a1d3d88 Cleanup: DURIAN_CAMERA_SWITCH is always on
The DURIAN_CAMERA_SWITCH feature has been always on since c3401eb5cb
(2009, Blender 2.51), remove the preprocessor option to turn it off.

Pull Request: https://projects.blender.org/blender/blender/pulls/137991
2025-04-25 14:20:52 +02:00
YimingWu
48f9212483 Fix #137700: Guard null lt.editlatt in DRW_cache_lattice_wire_get
Switching to lattice edit mode when it has an armature modifier can
crash if the armature modifier's `show_in_editmode` is turned on. Now
prevent null `editlatt` access.

Pull Request: https://projects.blender.org/blender/blender/pulls/137701
2025-04-25 13:07:54 +02:00
Campbell Barton
93f5f57e64 Fix: correct type for wmWindow::event_queue_consecutive_gesture_type
The event type was stored in a char when event type values
require a larger range.

Also correct the doc-string location of `addmousemove`.
2025-04-25 04:24:10 +00:00
Alaska
4a2e918576 Cleanup: Make format 2025-04-25 15:46:33 +12:00
Campbell Barton
c50ae81c4d Fix: incorrect use of the last handled event
Recent commits ([0], [1]) referenced the last handled event
which is incorrect.

- It represents the previous event (not the event being handled).
- It's documented to only be used by the event queue logic.

Resolve using the current event instead of the last handled.

[0]: a043a0e74d
[1]: 5102880f51
2025-04-25 02:10:47 +00:00
ChengduLittleA
1f657cd38d Cleanup: Modeling: Don't show failed object conversion as incompatible
Previously in b795f09e22 the variable
`incompatible_count` was increased when object conversion failed, this
was not logically correct since the objects type combination is
acceptable compatible, but it's the conversion itself has failed. Do not
increase `incompatible_count` value when this happens, this makes it
consistent with the error message
2025-04-25 10:02:49 +08:00
Howard Trickey
5f57d9ac94 Modeling: fix face merging issue with manifold boolean.
The new manifold boolean operation would merge coplanar faces
even if they had different faceIDs. This doesn't fit user
expectations.
By using the manifold library's "OriginalID" mechanism, we can
prevent that from happening. However, it slows the code by
almost a factor of 2 on large examples.
The Manifold maintainers going to work on a better solution.
2025-04-24 21:32:52 -04:00
Campbell Barton
f09ca4d807 Fix #137940: 3D text cursor displays intermittently when zoomed out
Draw a wire quad along with the filled quad to ensure it's never
less than a pixel width wide.
2025-04-25 11:23:23 +10:00
Campbell Barton
b096066da5 Revert "Fix #137940: Wider Text Caret for Text Object Editing"
This reverts commit 4856cfa89c.

The change only slightly mitigated the issue, revert in favor
of an alternative fix.
2025-04-25 01:23:13 +00:00