Commit Graph

109007 Commits

Author SHA1 Message Date
Clément Foucault
643f4eaedf Fix: EEVEE-Next: Compilation error
Caused by accidentally merging two comflicting
PRs that had no merge conflict.
2024-04-30 20:40:48 +02:00
Clément Foucault
303f91a09c EEVEE-Next: Add slab thickness and thickness from shadow options
Implement the design discussed in #120384.

This adds two parameters. One for changing the approximation
method, and another to use the thickness from shadow map.

We pack the former in the gbuffer by dividing the 16bits
used for thickness by two and use one bit to store the
method.

The thickness from shadow map is now decoupled from the
light evaluation shader. This makes it more performant and
compatible with ray-tracing. This commit also uses the
same biases as shadow mapping to avoid aliasing artifacts
(fix #119339).

This refactors the light evaluation quite a bit to
remove unused bits bits and make the whole transmission
light evaluation without too much complexity.

Pull Request: https://projects.blender.org/blender/blender/pulls/121171
2024-04-30 20:32:46 +02:00
Hans Goudey
bc5f5d9a6c Cleanup: Use reference and rename mesh buffer list variable 2024-04-30 14:23:13 -04:00
Hans Goudey
6c2593cc13 Fix: EEVEE render crash after recent mesh index buffer commit
Caused by 1b7e67a851.
The GPU subdivision extraction was missing the check for whether
neither lines nor lines_loose was requested.
2024-04-30 14:18:28 -04:00
Miguel Pozo
a8f8745dcb Draw: Add default material fallback detection
Detect passes that are functionally equivalent to the default Material
ones to skip their compilation.

Pull Request: https://projects.blender.org/blender/blender/pulls/121137
2024-04-30 19:44:06 +02:00
Clément Foucault
e581ba077d Fix: EEVEE-Next: Principled BSDF transmission color applied twice
This was caused by the 2 transmission event approximation we
do for object with non-null thickness. This follows cycles
by using the square root of the color.
2024-04-30 19:32:52 +02:00
Hans Goudey
f4bf30c224 Cleanup: Tweak comment and indentation in mesh IBO extraction 2024-04-30 13:03:26 -04:00
Hans Goudey
7799c04cf6 Cleanup: Use const BMesh pointer 2024-04-30 13:03:26 -04:00
Hans Goudey
19cdef03e2 BLI: Add IndexMask::from_bools_inverse utility 2024-04-30 13:03:26 -04:00
Hans Goudey
71df15de04 Fix #121265: Normals of faceless vertices are not displayed
Caused by bace4c9a29 which only
extracted normals at face corners. Solve by also extracting loose edge and
loose vertex normals. And change the BMesh extraction to not use the
face iteration of the MeshExtract system, just because that's simpler.
2024-04-30 13:03:26 -04:00
Sybren A. Stüvel
15cc446773 Cleanup: anim, rename 'out' to 'binding' in unit test
A unit test file was still using `out`, short for 'output', which was the
original name for what later became 'binding'. This is now updated, and
the variables are now named appropriately.

Pull Request: https://projects.blender.org/blender/blender/pulls/121273
2024-04-30 18:01:49 +02:00
Sybren A. Stüvel
10c00b6390 Anim: Add RNA enum for animation bindings + operator to un-assign
Add an RNA enum property `AnimData.animation_binding` that lists all the
bindings available in `AnimData.animation`.

The list of bindings is filtered to only contain the bindings suitable
for the animated ID. This prevents assigning a 'camera' binding to a
mesh.

Un-assigning is done via an operator, represented as an 'X' button in
the interface.

The enum property contains up to two special items:
- "New" to create a new binding for the ID.
- "(none/legacy)" to indicate that this ID doesn't have a binding
  assigned. This one is conditional, and only appears when it is
  necessary.

These two special items are experimental, and mostly exist because we're
still evaluating things and building a better UI. It is intended that
the binding selector will become as close to the ID selector as
possible.

-----------

Note that this PR also contains #121268 as it builds up from that one, and I didn't want to wait with testing on the buildbot until that one lands.

The new Baklava panel:

![image](/attachments/ac357f32-d50a-481b-8b3c-9c0be07424b6)

Pull Request: https://projects.blender.org/blender/blender/pulls/121269
2024-04-30 17:37:16 +02:00
Pablo Vazquez
e29676ac98 UI: Rename New Bone Collection confirmation button
Rename "Move" to "Create" to match object collections operator and
because it is the first action performed right after.
Plus it is arguably the action with the most impact of the two.
2024-04-30 17:09:31 +02:00
Omar Emara
98043d3fc3 Fix #121264: Crash when File Output has preview
Blender crashes when a File Output was created when the Use Preview
option of the render output settings was enabled. This is a regression
introduced in 931c188ce5, where the image format of the node was
initialized from the scene image settings, so the preview option was
carried over, yet it is not supported nor exposed to the user in the
File Output node. To fix this, ensure the file output code will ignore
previews.
2024-04-30 17:44:02 +03:00
Brecht Van Lommel
5e772390af Fix #119997: Multires bake wrong result with sharp edges or faces 2024-04-30 16:34:40 +02:00
Sybren A. Stüvel
c41f1be5b7 Anim: RNA, refuse to set AnimData.binding_handle when there is no animation
Refuse to set the RNA property `AnimData.animation_binding_handle` when
`AnimData.animation` is nil.

When in a hypothetical future `AnimData.animation` would be set, the
binding handle would be ignored anyway, as it's only meaningful within
the context of a known animation. Refusing to set the binding handle in
cases where it is known to be meaningless may help to find bugs in
Python scripts.

Pull Request: https://projects.blender.org/blender/blender/pulls/121268
2024-04-30 16:24:31 +02:00
Hans Goudey
1b7e67a851 Mesh: Lines index buffer creation improvement
Implements another phase of #116901, this time for the `lines` and
`lines_loose` index buffers that store indices for wireframe drawing.
The key improvement is removing loose edge's dependency on the main
edge index buffer. That means for the majority of meshes with no loose
edges, edge index extraction can be completely skipped. Even when there
are loose edges, only the loose edges need to be extracted with
wireframe turned off.

Besides that improvement, there are more changes to use data-oriented
code with visible hot loops instead of the virtual function call design
used for the existing mesh extractor system. For this step I completely
replaced the `extract_lines` object, which is in line with the general
plan for this area.

Additionally, hidden edge filtering is done ahead of time using several
`IndexMask` operations. This means only indices for visible edges need
to be uploaded to the GPU, and no restart index stripping needs to be
performed on macOS.

On my usual test file with 1.9 million vertices, I observed an
improvement from 26 to 33 FPS with wireframe off, and from 9.15 to 9.5
FPS with wireframe on.

Pull Request: https://projects.blender.org/blender/blender/pulls/120720
2024-04-30 15:54:50 +02:00
Hans Goudey
462e7aeedd Geometry Nodes: Add Align Rotation to Vector node
A version of "Align Euler to Vector" with the rotation socket
instead of the vector Euler socket. Other than that, and a few
cleanups to use newer math functions, the node is the same.

The old node is just "Deprecated" for now. We could remove
it with versioning, but we can also wait to do that.

In a simple test this node is about 1.7 times faster than the old one.

Pull Request: https://projects.blender.org/blender/blender/pulls/118565
2024-04-30 15:52:11 +02:00
Sybren A. Stüvel
0da53b5e62 Anim: Change how names of Bindings work, and how Bindings are created/assigned
This cleans up some of the Animation/Binding API, and adds a distinction
between a binding's "name" and its "display name".

`name`: internal name that is unique within the `Animation`. As such, it
        is also the key into the `anim.bindings` collection.
  - To ensure the uniqueness, `name` is always prefxed with the ID
    identifier, like `OBCube` and `CACamera`.
  - A binding that was not created to animate a specific ID will be
    called `XXBinding`.
`name_display`: display name that strips the first two characters, so in
        the above examples would be `Cube`, `Camera`, and `Binding`.

### RNA setter behaviour

`name`: always sets the name, emitting a warning when the name's prefix
doesn't match the ID type of the Binding. This implicitly changes the
display name (as they are two views into the same string).

`name_display`: sets `name = prefix_for_ID_type + name_display`. So even
when the old name was `QQSomethingWeird`, setting `binding.name_display
= "NewName"` would effectively set `binding.name = "OBNewName"`
(assuming it was already bound to some object earlier).

Bindings now also **always have a name**. Previously it was possible to
create bindings named `""`, but that's no longer possible.

Bindings used to be **renamed automatically** when they were first
assigned, for example from `XXBinding` to `OBCube`. This behaviour has
been removed, as it could potentially cause confusion.

Pull Request: https://projects.blender.org/blender/blender/pulls/120941
2024-04-30 15:51:47 +02:00
Nathan Vegdahl
d5a4b98323 Fix #115930: custom colored bones are invisible when drawn in stick mode
The fix here is simple: we ignore the alpha channel in the bone theme
colors, setting it unconditionally to fully opaque.  This is correct
because conceptually the bone theme colors are just RGB, not RGBA,
and the alpha channel doesn't always get set consistently.

Pull Request: https://projects.blender.org/blender/blender/pulls/121256
2024-04-30 15:25:21 +02:00
Christoph Lendenfeld
08de3fa0b6 Anim: extract constant variables out of sorting loop
No functional changes expected.

This PR extracts the `IndexRange` of the `BeztMap` span and its `size()` call out
of the sorting loop. Doing this removes one `if` condition within the loop and gives a
small performance boost.
(Before: 0.93ms, After: 0.65ms average run of `sort_time_beztmaps`)

Pull Request: https://projects.blender.org/blender/blender/pulls/121267
2024-04-30 15:14:49 +02:00
Hans Goudey
a83e695c0a Cleanup: Use utility for safe division 2024-04-30 09:08:46 -04:00
Hans Goudey
ca924bf247 Fix #121217: Mouse position node size sockets ignore UI scale
Use winrct instead of sizex/y as recommended by its docstring.
The winrct accounts for UI scale, just like event->mval.
2024-04-30 08:55:47 -04:00
Christoph Lendenfeld
1cf193336a Refactor: Rename enum entries of BakeCurveRemove
No functional changes.

The enum entries of `BakeCurveRemove` used to
start with `REMOVE` which just doubled that word.

Removing that simplifies the enum entries.

This has been brought up by @dr.sybren in #120984

Pull Request: https://projects.blender.org/blender/blender/pulls/121258
2024-04-30 14:40:26 +02:00
Aaron Carlisle
f5157b00a9 Compositor: Remove left over code from tile based compositor
The compositor used to have a feature that would calculate tiles for the viewer based on a custom order. Since the removal of the tile based compositor, this code is unused.

Pull Request: https://projects.blender.org/blender/blender/pulls/121176
2024-04-30 13:47:45 +02:00
Falk David
5ebce2c72c Fix: GPv3: Division by zero for single point curves
Makes sure to map curves with a single point to 0.0f in the
custom curve mapping.
2024-04-30 13:17:36 +02:00
Christoph Lendenfeld
33c6e9f92c Refactor: move FCurve baking code to animrig
No functional changes.

This PR moves the following public functions to animrig:
* sample_fcurve_segment
* bake_fcurve
* bake_fcurve_segments

The `bake_fcurve_segments` also gets a docstring and its comments have been
updated to follow the style guide.

Pull Request: https://projects.blender.org/blender/blender/pulls/120984
2024-04-30 12:22:47 +02:00
Nathan Vegdahl
f099977923 Fix: add missing nullptr check in BKE_fcurve_find_by_rna_context_ui
The guard clauses elsewhere in the function clearly indicate that
`r_driven` should be passable as a nullptr if the caller doesn't need
it, but there is one place where the guard clause was missing.

Discovered while working on #120936.

Pull Request: https://projects.blender.org/blender/blender/pulls/121253
2024-04-30 12:05:20 +02:00
Pratik Borhade
3b0c23a1f2 GPv3: Wrong onion skinning icon in the dopesheet
`PROP_ICONS_CONSECUTIVE` is set for `use_onion_skinning` property with the
help of `RNA_def_property_ui_icon`. In this case, `but->iconadd` will
handle the other icon for "toggle" button types. So just use
`ICON_ONIONSKIN_OFF` when drawing the onion skinning button in dopesheet.

Resolves #121232

Pull Request: https://projects.blender.org/blender/blender/pulls/121254
2024-04-30 11:50:37 +02:00
Jacques Lucke
d550db1288 Cleanup: correct function name 2024-04-30 11:14:40 +02:00
Jason Fielder
7114c44c9b Fix #121020: Fix curve index buffer generation with Triangle prim
Resolves offset error when building index buffers on device for
cuves/hair strips using Triangles instead of TriangleStrips.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/121218
2024-04-30 10:49:09 +02:00
Christoph Lendenfeld
c6c7d3d8c4 Anim: Graph Editor - use Map to update TransInfo pointers instead of searching
This is a performance improvement when moving a bunch
of keys on the same `FCurve` in heavy scenes.

When moving keys in such a way that the `BezTriple` array of the FCurve
has to be sorted, the pointers of `TransInfo` also have to be  updated.
This used to happen by doing a nested loop over all `BeztMap` and all `TransData2D`.
There was a bit of optimization with the
`blender::Vector<bool> adjusted` which stored if a `TransData2D` has been fixed yet.
But in general the complexity was still `BeztMap.size() * TransData.size()`.

There are two optimizations that can be done here.
* Skip any BeztMap if `old_index == new_index`.
If the Key is not going to move any pointers to it will still be valid.
* Use a `Map<float *, int>` built beforehand to quickly get
the `TransData2D` that needs updating instead of searching.
The `int` in this case is the index to the `TransData2D` array.

Doing this reduces the complexity to `BeztMap.size() + TransData.size()`.

Measurements of `beztmap_to_data`
| - | Before | After |
| - | - | - |
| Moving 1 key of 1 FCurve | ~24000 ns | ~5800ns |
| Moving ~1000 keys of 1 FCurve | 17ms | 0.02ms |

Measurements of `remake_graph_transdata`
| - | Before | After |
| - | - | - |
| Moving 1 key of 279 FCurves | 290ms | 22ms |
| Moving ~300 keys of 279 FCurves | 82 **SECONDS** | 80ms |

Test file used
https://download.blender.org/ftp/sybren/animation-rigging/heavy_mocap_test.blend

The deeper technical explanation.
`TransInfo` has an array of `TransData`.
`TransData` has pointers to the float arrays of a `BezTriple`.
The `BezTriple` array is sorted by swapping data,
meaning the `TransData` will now point to the wrong data in the array.
This has to be updated and we can do that by using the `BeztMap`.
This is all under the assumption that `BeztMap` is sorted in the exact
same way as `BezTriple` otherwise this method will fail.
But by doing it the same way, we can know at which
index the `BezTriple` is before and after sorting.
Now we just need to find the corresponding `TransData`.
That can be done by comparing pointers. The `BeztMap` stores the
`BezTriple` it represents and from it we can
get the pointers to its `vec` 0, 1 and 2. (key and handles)

Pull Request: https://projects.blender.org/blender/blender/pulls/120816
2024-04-30 10:46:48 +02:00
Jeroen Bakker
3d3dfb6518 Fix #120273: GPU: UHD630 on Windows reports buggy extension
On windows the OpenGL backend of the UHD630 driver (but could also be other
GPUs that use the same driver) reports of supporting `GL_ARB_multi_bind`.
But when enabling it can result in incorrect bindings and report errors
about unsupported internal texture formats. These are internal driver issues.

Might also fix #107642 as it shows the same error message. EEVEE-Next
relies more on using the same binding slot for the same texture in order
to reduce actual bindings which makes this more prominent.

Pull Request: https://projects.blender.org/blender/blender/pulls/121062
2024-04-30 10:38:07 +02:00
Jacques Lucke
176c6ef329 Geometry Nodes: unify menu switch with other nodes with dynamic sockets
This changes the menu switch socket to use the socket-items system
(`NOD_socket_items.hh`) that is already used by the simulation zone, repeat
zone, bake node and index switch node. By using this system, the per-node
boilerplate can be removed significantly. This is especially important as we
plan to have dynamic socket amounts in more nodes in the future.

There are some user visible changes which make the node more consistent with
others:
* Move the menu items list into the properties panel as in 0c585a1b8a.
* Add an extend socket.
* Duplicating a menu item keeps the name of the old one.

There is also a (backward compatible) change in the Python API: It's now
possible to directly access `node.enum_items` and `node.active_index` instead of
having to use `node.enum_definition.enum_items`. This is consistent with the
other nodes. For backward compatibility, `node.enum_definition` still exists,
but simply returns the node itself.

Many API functions from `NodeEnumDefinition` like
`NodeEnumDefinition::remove_item` have been removed. Those are not used anymore
and are unnecessary boilerplate. If ever necessary, they can be implemented back
in terms of the socket-items system.

The socket-items system had to be extended a little bit to support the case for
the menu switch node where each socket item has a name but no type. Previously,
there was the case without name and type in the index switch node, and the case
with both in the bake node and zones. The system was trivial to extend to this
case.

Pull Request: https://projects.blender.org/blender/blender/pulls/121234
2024-04-30 10:19:32 +02:00
Christoph Lendenfeld
5ba5fc8962 Anim: make Keyframing error messages translateable
This fixes an issue with the error messages that keying
can produce where they couldn't be translated.

To make translation possible, two things changed:
* use of `RPT_`
* simplified string formatting

Pull Request: https://projects.blender.org/blender/blender/pulls/121112
2024-04-30 09:59:51 +02:00
Aras Pranckevicius
0a911b42c6 Fix #121190: VSE AlphaUnder with opacity=1 does not work properly
Accidental logic change in PR #116089, restore previous behavior

Pull Request: https://projects.blender.org/blender/blender/pulls/121224
2024-04-30 08:32:25 +02:00
Campbell Barton
d06c34b2e5 Cleanup: note that XDG_* environment variables can't be relied on
This assumption caused #121241.

Also correct `endif` comment.
2024-04-30 15:02:29 +10:00
Campbell Barton
da4b81e980 Cleanup: move doc-strings into headers 2024-04-30 12:52:52 +10:00
Campbell Barton
9ee0912d1c Cleanup: pass a const Lattice to BKE_lattice_* functions
Also match arguments between function & declaration.
2024-04-30 12:13:25 +10:00
Campbell Barton
734a312004 Cleanup: remove unused argument 2024-04-30 12:13:23 +10:00
Campbell Barton
b93ddf30e9 Unbreak build WITH_TBB=OFF 2024-04-30 12:12:02 +10:00
Hans Goudey
2ac6321e88 Refactor: Remove corner triangle faces from PBVH storage
Part of an effort to reduce redundancy of storage for data used
by sculpt mode. See #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/121238
2024-04-30 04:02:59 +02:00
Hans Goudey
75e424563c Refactor: Remove vert to face map from PBVH storage
Part of an effort to reduce redundancy of storage for data used
by sculpt mode. See #118145.
2024-04-30 04:02:57 +02:00
Jacques Lucke
8d13a9608b BLI: generalize task size hints for parallel_for
This integrates the functionality for `parallel_for_weighted` from 9a3ceb79de
into `parallel_for`. This reduces the number of entry points to the threading
API and also makes it easier to build higher level threading primitives. For
example, `IndexMask.foreach_*` may use `parallel_for` if a `GrainSize` is
provided, but can't use `parallel_for_weighted` easily without duplicating a
fair amount of code.

The default behavior of `parallel_for` does not change. However, now one can
optionally pass in `TaskSizeHints` as the last parameter. This can be used to
specify the size of individual tasks relative to each other and relative to the
grain size. This helps scheduling more equally sized tasks which generally
improves performance because threads are used more effectively.

One generally does not construct `TaskSizeHints` manually, but calls either
`threading::individual_task_sizes` or `threading::accumulated_task_sizes`. Both
allow specifying individual task sizes, but the latter should be used when the
combined size of consecutive tasks can be computed in O(1) time. This allows
splitting up the work more efficiently. It can often be used in conjunction with
`OffsetIndices`.

Pull Request: https://projects.blender.org/blender/blender/pulls/121127
2024-04-29 23:55:22 +02:00
Jacques Lucke
d588bfdb5e Geometry Nodes: improve naming and code deduplication
On this level it makes sense to have a single `add_item` function
because the operator does not take any parameters. It's also
mostly the same for different kinds of socket items except
for one line.
2024-04-29 22:45:16 +02:00
Jacques Lucke
6bd1d5de54 Fix: assert when removing element from empty array 2024-04-29 22:45:15 +02:00
Hans Goudey
76a151b9d6 Refactor: Store PBVH in unique_ptr
This requires adding a destructor and deleting move and copy assignment
for SculptSession, because (for now at least) we want to keep the PBVH
as an opaque type (though with one exception for including pbvh_intern.hh
in paint.cc for the SculptSession destructor).

Pull Request: https://projects.blender.org/blender/blender/pulls/121227
2024-04-29 22:21:24 +02:00
Hans Goudey
7c56e16e44 Cleanup: Use references for sculpt PBVH variables 2024-04-29 22:21:23 +02:00
Jacques Lucke
9c153a58c0 Fix: missing null check 2024-04-29 22:15:31 +02:00
Jesse Yurkovich
ff8261ff6a USD: Small wording and layout changes for custom properties options
Make the recently added option descriptions a bit more consistent with
each other.

Small layout change to not have so much spacing between the 2 related
export options and move them under the existing options.

Pull Request: https://projects.blender.org/blender/blender/pulls/121198
2024-04-29 21:56:32 +02:00