Commit Graph

127855 Commits

Author SHA1 Message Date
Michael Jones
6c98cb73ac Cycles: Use new MetalRT curve primitives for 3D curves and ribbons
This patch updates the experimental MetalRT code path to use new [curve primitives](https://developer.apple.com/videos/play/wwdc2023/10128/) which were recently added in macOS 14. This replaces the previous custom box intersection implementation, allowing the driver to better optimise curve acceleration structures for the GPU. On existing hardware, this can speed up MetalRT renders by up to 40% for scenes that use hair / curve primitives extensively.

The MetalRT option will only be available on macOS >= 14, and requires Xcode >= 15 to build (otherwise the option will be compiled out).

Authored by Marco Giordano, Michael Jones, and Jason Fielder

---
Before / after render times (M1 Max MacBook Pro, macOS 14 beta, MetalRT enabled):
```
                  Custom box intersection      MetalRT curve primitives       Speedup
fishy_cat           111.5                         80.5                         1.39
koro                114.4                         86.7                         1.32
sinosauropteryx     291.8                        279.2                         1.05
spring              142.3                        142.2                         1.00
victor              442.7                        347.7                         1.27
```

---

Pull Request: https://projects.blender.org/blender/blender/pulls/111795
2023-09-13 16:02:49 +02:00
Julian Eisel
36f31f1eff Asset shelf: Remove unnecessary separator between buttons in header
We don't usually add such a separator after search buttons.
2023-09-13 15:29:33 +02:00
Julian Eisel
5470ce4cf3 Cleanup: Improve comment on asset shelf header size
Now explains the why, not the what (which is obvious anyway).
2023-09-13 15:28:00 +02:00
Amelie Fondevilla
08eb7f1c97 GPv3: Snap selected grease pencil frames
Update of the ACTION_OT_snap to take into account grease pencil frames.
Implemented modes are snap to current frame, nearest second, and nearest marker.

Pull Request: https://projects.blender.org/blender/blender/pulls/111507
2023-09-13 12:10:23 +02:00
Philipp Oeser
564716d5a2 Fix #112285: Sculpt Mode: Mask brush smoothing is broken
Mistake in cc01bb83f6.

Above commit tried to be smart about early out, but wasnt.
Now corrected.

NOTE: fix needs to go into 3.6 LTS

Pull Request: https://projects.blender.org/blender/blender/pulls/112292
2023-09-13 11:04:52 +02:00
Campbell Barton
9a0eaa2062 Fix crash using the key-map editor after refreshing internal data
Any action that triggered the key-map to be rebuilt causes the key-map
UI to display freed data.

Recently key-map refreshing happens during transform, while this should
be resolved - it's still good to avoid a crash in this situation as it's
possible scripts perform actions that tag the key-map to be rebuilt
which is out of our control.
2023-09-13 16:46:59 +10:00
Campbell Barton
716d1b9e29 Tests: bl_keymap_validate failure wasn't causing tests to fail
bl_keymap_validate wasn't exiting with a non-zero exit code
on failure since [0] which unintentionally removed the assignment.

[0]: 167c4c6962
2023-09-13 15:11:38 +10:00
Campbell Barton
6adc6675ad Fix bl_keymap_validate.py failure caused by add-on key-maps 2023-09-13 15:09:54 +10:00
Campbell Barton
b1b6f73487 PyAPI: add keyconfig.keymaps.clear()
Add a utility function to clear all key maps from a key configuration.

This allows the add-ons key-config to be cleared so the exported
configuration wont include add-on keymap items,
needed for bl_keymap_validate.py to properly compare the
exported key-map with the data in:
./scripts/presets/keyconfig/keymap_data/blender_default.py
2023-09-13 15:09:05 +10:00
Campbell Barton
ec7785fffc Cleanup: include the type name as a prefix for RNA keymap functions
RNA defines KeyMap & KeyMaps types, name functions to avoid confusion.
2023-09-13 15:06:12 +10:00
Campbell Barton
d154009910 Fix error messages removing keymaps from keyconfigs 2023-09-13 15:02:08 +10:00
Campbell Barton
ec58f3d4cd RNA: move the "contains" checks into the RNA API
C++ callers must ensure the arguments are valid,
reserve validity for the RNA API for raising errors.

This is already the case for most RNA API calls that wrap BKE API's.
2023-09-13 15:01:49 +10:00
Campbell Barton
c51336f5e8 Cleanup: single quote enums in Python 2023-09-13 13:38:39 +10:00
Campbell Barton
7eb0b6cce9 Docs: remove references to "tessface" 2023-09-13 13:31:34 +10:00
Andrej730
0f6444a3ef Docs: add note to mathutils.Matrix.normalize()
Ref !111253.
2023-09-13 13:04:48 +10:00
Campbell Barton
8167ad746c Fix Toggle Region pie menu items not matching the region direction
Regression in [0] which removed empty regions that were used to
ensure pie menu items match the location of regions.

The header for e.g. in time-line / graph editor for e.g. showed
on the opposite side.

[0]: 48b8c8f78f
2023-09-13 12:19:43 +10:00
Lukas Stockner
e6296acdba Cycles: Only compute Coat Normal if needed 2023-09-13 03:16:43 +02:00
Lukas Stockner
4c229070a9 Cycles: Rework Principled BSDF Emission
- Changes defaults from Emission Color 0.0, Emission Strength 1.0 to be the
  other way around (Color 1.0, Strength 0.0), suggested by @brecht
- Makes emission component occluded by sheen and coat
  (to simulate e.g. dust-covered light sources)
- Moves transparency into the Principled SVM/OSL node, to allow for future
  support for e.g. transparent shadows in thin sheet mode.

Note that there are optimization opportunities here (mostly skipping the
non-transparent components for transparent shadow evaluation, and skipping
the parts that don't affect emission for light evaluation), but I have a
separate point for those in the Principled V2 planning since there's some
other optimization topics as well.

Co-authored-by: Weizhen Huang <weizhen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/111155
2023-09-13 03:05:27 +02:00
Lukas Stockner
d7aee5a580 Cycles: Tweak Principled BSDF Subsurface parameters
Previously, the Principled BSDF used the Subsurface input to scale the radius.
When it was zero, it used a diffuse closure, otherwise a subsurface closure.
This sort of scaling input makes sense, but it should be specified in distance
units, rather than a 0..1 factor, so this commit changes the unit and renames
the input to Subsurface Scale.

Additionally, it adds support for mixing diffuse and subsurface components.
This is part of e.g. the OpenPBR spec, and the logic behind it is to support
modeling e.g. dirt or paint on top of skin. Before, materials would be either
fully diffuse (radius=0) or fully subsurface.

For typical materials, this mixing factor will be either zero or one
(just like metallic or transmission), but supporting fractional inputs makes
sense for e.g. smooth transitions at boundaries.

Another change is that there is no separate Subsurface Color anymore - before,
this was mixed with the Base Color using the Subsurface input as the factor,
but this was not really useful since that input was generally very small.

And finally, the handling of how the path enters the material for random walk
subsurface scattering is changed. Before, this always used lambertian (diffuse)
transmission, but this caused some problems, like overly white edges.

Instead, two different methods are now used, depending on the selected mode.
In Fixed Radius mode, the code assumes a simple medium boundary, and performs
refraction into the material using the main Roughness and IOR inputs.

Meanwhile, when not using Fixed Radius, the code assumes a more complex
boundary (as typically found on organic materials, e.g. skin), so the entry
bounce has a 50/50 chance of being either diffuse transmission or refraction
using the separate Subsurface IOR input and a fixed roughness of 1.
Credit for this method goes to Christophe Hery.

Pull Request: https://projects.blender.org/blender/blender/pulls/110989
2023-09-13 02:45:33 +02:00
Lukas Stockner
d169403d96 Cleanup: Format 2023-09-13 02:25:03 +02:00
Lukas Stockner
158dbc1b10 Cycles: Rework Principled BSDF Clearcoat
- Adds tint control, which simulates volumetric absorption inside the coating.
  This results in angle-dependent saturation and affects all underlying layers
  (diffuse, subsurface, metallic, transmission). It provides a physically-based
  alternative to ad-hoc effects such as tinted specular highlights.
- Renames the component from "Clearcoat" to "Coat", since it's no longer
  necessarily clear now. This matches naming in e.g. other renderers or OpenPBR.
- Adds an explicit Coat IOR input, in preparation for future smarter IOR logic
  around the interaction between Coat and main IOR. This used to be hardcoded
  to 1.5.
- Removes hardcoded 0.25 weight multiplier, and adds versioning code to update
  existing files accordingly. OBJ import/export still applies the factor.
- Replaces the GTR1 microfacet component with regular GGX. This removes a corner
  case in the Microfacet code, solves #53038, and makes us more consistent with
  other standard surface shaders. The original Disney BSDF used GTR1, but it
  doesn't appear that it caught on in the industry.

Co-authored-by: Weizhen Huang <weizhen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/110993
2023-09-13 00:03:11 +02:00
Miguel Pozo
b7ba7663a7 Fix #112231: Workbench: Texture support in sculpt mode 2023-09-12 18:48:34 +02:00
Bastien Montagne
306723c6bf Liboverride/Outliner: Fix assert in Hierarchy view.
Not sure why/when that was changed, but drawing code should not assume
all items in the hierarchy view tree of the Outliner are liboverrides -
it adds e.g. regular local IDs items for the root item of each library
hierarchy of linked liboverrides.

Reported by @dfelinto & @LukasTonne, thanks.
2023-09-12 18:27:26 +02:00
Ray Molenkamp
cf973a2d16 deps_builder: Fix zlib URI
zlib's uri is a bit unstable as when they release a new version they
move the last release "elsewhere"

This change switches the upstream URI over to github, which should be
a bit more reliable.
2023-09-12 10:23:03 -06:00
Lukas Tönne
4523a1e362 Fix #112247: Node group socket declarations using only 'NONE' subtype
The declaration code for node groups was relying on `bNodeSocketType` to
provide the subtype of a socket. This worked before node panels
(#111348) since the interface sockets had a fully refined typeinfo.

Now the interface sockets use only the base typeinfo and the socket
subtype is stored in the interface data itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/112286
2023-09-12 17:13:40 +02:00
Miguel Pozo
443254b1a6 Fix #112211: Workbench: Clamp infinite inputs in TAA 2023-09-12 16:27:40 +02:00
Christoph Lendenfeld
12f8f926b2 Refactor: Rename functions and structs in keyframes_draw.cc
No functional changes.

While looking at the Dope Sheet drawing code to see if it
can be made faster I came across a bunch of functions with confusing names.

This PR tries to address that by:
* removing the `ED_` prefix from static functions
* adding it to non static functions
* renaming `AnimKeylistDrawListElem` to `ChannelListElement`
* renaming `AnimKeylistDrawList` to `ChannelDrawList`
* all `draw_..._channel` renamed to `ED_add_..._channel`
   since the function itself doesn't actually do any drawing
* generally simplifying the function names

Pull Request: https://projects.blender.org/blender/blender/pulls/111510
2023-09-12 16:08:16 +02:00
Falk David
97d2dbb24e Fix #112068: Crash when loading converted curves
In 2788fa915b the `CurvesGeometry::blend_write` and `CurvesGeometry::blend_read` functions were added. Unfortunately, the commit also altered the writing logic and introduced a bug where loading a file with a converted `Curves` object would crash. See https://projects.blender.org/blender/blender/issues/112068.

This PR fixes the issue by making sure that `CustomData_blend_write_prepare` is called before `BKE_id_blend_write`, which is the root cause of the crash that happens on load.

The  `CurvesGeometry::blend_write` function is split into  `CurvesGeometry::blend_write_prepare` and `CurvesGeometry::blend_write`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112280
2023-09-12 16:02:04 +02:00
Philipp Oeser
e7b024a691 Fix: 3D Viewport header missing update changing vertex groups
Since 3b5df8a7ea, we are displaying a "canvas picker" in the 3DView
header. In weightpaint mode, this gives us the active vertexgroup to
paint on, however the header wasnt updating when changing the
vertexgroup elsewhere (e.g. from the Properties Editor).

Part of #112186.

Pull Request: https://projects.blender.org/blender/blender/pulls/112227
2023-09-12 15:43:57 +02:00
Philipp Oeser
ff6b25a200 Keymap: Add Numpad Return to create newline in Text object edit mode
Since this is what text editors usually do (blenders text editor as
well), we can also add it for Text object edit mode.

Resolves #112170.

Pull Request: https://projects.blender.org/blender/blender/pulls/112277
2023-09-12 15:42:54 +02:00
Miguel Pozo
d81165f3ec Fix #111960, #112200, #112214: EEVEE: Incorrect BuiltinBits::LAYER use
5cf7089e43 added the `BuiltinBits::LAYER` to shaders with a geometry
stage. This causes compilation errors when
`GLContext::layered_rendering_support` is false (otherwise the flag
does nothing).

This PR moves the `LAYER` flags to the `no_geom` shader versions and
adds a check to `ShaderCreateInfo::finalize()` to ensure the `LAYER` flag
is not used in shaders with a geometry stage.

Pull Request: https://projects.blender.org/blender/blender/pulls/112245
2023-09-12 15:39:33 +02:00
Ray Molenkamp
5f8dfa231d CMake: Fix building with WITH_VULKAN_BACKEND
Ghost uses vulkan in its public headers but none of the projects that
depend on ghost had the vulkan headers in its includes nor did
bf_intern_ghost expose this vulkan dependency itself publicly yet.

bf_windowmanager also did not express its dependency on
bf_intern_ghost yet used its headers.

this change fixes both issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/112259
2023-09-12 15:07:41 +02:00
Sybren A. Stüvel
6c4eb80cc3 Anim: clarify BKE_armature_find_bone_name docstring
No functional changes.
2023-09-12 15:00:33 +02:00
Julian Eisel
0519e8d711 UI: Remove panel name size limit for complex character languages
The previous limit of 63 bytes for the panel name was an issue for
languages where characters use multiple bytes. The UI would show panel
names truncated that had reasonably long/short names.

It's easy to support dynamically sized strings here, so do that instead
of using fixed size buffers.

Fixes #111927.

Pull Request: https://projects.blender.org/blender/blender/pulls/111979
2023-09-12 14:47:46 +02:00
Jeroen Bakker
f1a0de8415 Overlay: Remove Unused Attribute in edit mesh face shader
`overlay_edit_mesh_face` has an attribute for its vertex normals,
but only used in the vertex shader when it isn't a face shader.

Removing this attribute fixes some performance validation warnings
in the Vulkan backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/112269
2023-09-12 14:47:20 +02:00
Lukas Tönne
7b680850c6 Fix for node group "make" adding sockets in wrong order
Making a group from a single node that has some connections will add the
connected outputs and inputs first, then add all unconnected outputs and
inputs. This can lead to incorrect socket order (out-in-out-in).

This patch integrates unconnected sockets into the main outputs/inputs
loops to ensure all outputs are added before inputs.

Pull Request: https://projects.blender.org/blender/blender/pulls/112281
2023-09-12 14:27:09 +02:00
Hans Goudey
c59d998ce5 Geometry Nodes: Skip redo panel for node tools without inputs
The operator system assumes that the `ot->ui` callback means
there will always be a redo panel. This situation where there is a
callback but sometimes no inputs hasn't been encountered before.

Resolve that by changing `WM_operator_check_ui_empty` into
a `WM_operator_ui_poll` that handles this case properly, with
a new operator type callback called `ui_poll`.

See #101778, #111346

Pull Request: https://projects.blender.org/blender/blender/pulls/112251
2023-09-12 13:24:05 +02:00
Jacques Lucke
34b4487844 Fix #109670: attribute shared between geometries even when edited
The RNA attribute API did not make sure that attributes are unshared when
the data is accessed. This is necessary to avoid accidentally changing data
on other geometries.

Unfortunately, we currently can't detect if the access is read-only or if the
attribute data is modified. Therefore, the data is always copied when it
was shared. This makes it a little bit less efficient in some cases, but that
should still be ok. The old behavior could by brought back by implementing
#112150.

Pull Request: https://projects.blender.org/blender/blender/pulls/111514
2023-09-12 13:03:01 +02:00
Amelie Fondevilla
127eee87ce GPv3: Duplicate keyframes
Implementation of the duplicate and move operator for grease pencil frames.

The `ACTION_OT_duplicate` operator now creates duplicates of the selected frames and stores them in the layer runtime data.
The `TRANSFORM_OT_transform` operator is updated to take care of these duplicated frames.

Pull Request: https://projects.blender.org/blender/blender/pulls/111051
2023-09-12 12:07:15 +02:00
Jeroen Bakker
6920c690f1 Vulkan: Implement Component Swizzling
Component swizzling is part of an image view and localized in the code.
With component swizzling a different channel (or 0 or 1) can be read
when the component is accessed.

Pull Request: https://projects.blender.org/blender/blender/pulls/112273
2023-09-12 11:54:57 +02:00
Jeroen Bakker
ded7d96ba1 Vulkan: Texture View
Adding support for Texture View in Vulkan backend.

When a VKTexture is a texture view many options become
irrelevant, but isn't actually clear via its API. Added
asserts to make sure that the usage is supported.

This patch allows rendering simple workbench-next scenes
without any validation errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/110887
2023-09-12 11:18:38 +02:00
Jeroen Bakker
65a88c3d60 Vulkan: Fix Incorrect UINT formats.
When `COMP_U*` is used together with a `GPU_FETCH_INT` the backend
tried to convert them to floats. What is of course not what should
happen.

Issue was that these cases were never correctly tested. With this
change the `data` attribute of the `overlay_edit_mesh` shaders are
transferred correctly and can draw some pixels as intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/112270
2023-09-12 11:15:51 +02:00
Falk David
c0850237a1 Fix: "use_duplicated_keyframes" not found
`5ed35e` introduced the warning:
`RNA_boolean_set: TRANSFORM_OT_transform.use_duplicated_keyframes not found`

This was because the `TRANSFORM_OT_transform` did not pass
the `P_OPTIONS` flag to `Transform_Properties` to define
the `use_duplicated_keyframes` property.
2023-09-12 11:00:43 +02:00
Christoph Lendenfeld
614fe73712 Fix: Wrong operator call in Graph Editor menu
During the recent operator renames, the menu
entry for "Sound to Samples" was missed and
left as "graph.sound_bake"
This fixes it to be the correct "graph.sound_to_samples"
2023-09-12 10:51:29 +02:00
Nathan Vegdahl
aaddb25fa3 Cleanup: remove unneeded include
In a previous commit fixing a warning, the C++ header include was added,
but the corresponding C header include wasn't removed.  The C++ header
already includes the C header, so including it separately is
redundant.
2023-09-12 10:29:10 +02:00
Christoph Lendenfeld
e656e850a6 Animation: Rename ACTION_OT_sample
After Renaming "Bake Curve" to "Samples to Keys" in #111049,
the name of the `ACTION_OT_sample` operator needed renaming.
That is because the word "sample" is now used to describe FCurve
data in an uneditable state.

Rename to `ACTION_OT_bake_keys` since baking is the
term used in animation to describe the action of creating dense key data.

Pull Request: https://projects.blender.org/blender/blender/pulls/112151
2023-09-12 09:42:01 +02:00
Christoph Lendenfeld
9e5e04e915 Animation: Rename Graph_OT_sample
After Renaming "Bake Curve" to "Samples to Keys" in #111049,
the name of the `GRAPH_OT_sample` operator needed renaming.
That is because the word "sample" is now used to describe FCurve
data in an uneditable state.

Rename to `GRAPH_OT_bake_keys` since baking is the term
used in animation to describe the action of creating dense key data.

Pull Request: https://projects.blender.org/blender/blender/pulls/112148
2023-09-12 09:32:18 +02:00
Campbell Barton
057c9364fc Cleanup: use braces around statements 2023-09-12 14:48:20 +10:00
Campbell Barton
f942f64b1d Cleanup: format 2023-09-12 14:48:18 +10:00
Campbell Barton
52bd4b73c3 Cleanup: compiler warning from missing include 2023-09-12 14:46:32 +10:00