Commit Graph

107212 Commits

Author SHA1 Message Date
Omar Emara
3295123fca Fix: Variable sized blur truncates filter kernel
The GPU compositor Blur node truncates the filter kernel if the blur
radius is lower than the base radius. That's because it evaluated the
filter kernel only up to the desired radius. To fix this, we evaluate
at the entire kernel for all radii using a texture sampler for the
weights.
2024-02-27 11:03:15 +02:00
Lukas Tönne
ffcdf8b4dc Cleanup: Remove unused lambda capture. 2024-02-27 09:46:49 +01:00
Jeroen Bakker
be0c57a0a8 Cleanup: EEVEE: Use uint for enum specialization
Enums are stored as uints, but due to a missing implementation they
where stored in shaders as ints. As draw manager now supports uints
as specialization constants we can update these constants to be
stored as uints on the shader side as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/118788
2024-02-27 08:38:31 +01:00
Campbell Barton
9795c432e1 Cleanup: avoid redundant copy-by-value for 4x4 matrices & float3 2024-02-27 17:57:50 +11:00
Jesse Yurkovich
96ef405c19 Merge branch 'blender-v4.1-release' 2024-02-26 22:47:41 -08:00
Jesse Yurkovich
5b65e2dd7c Fix #118704: permit filepaths without extensions in STL batch mode
The STL exporter was enforcing file paths with an extension when used
from the file browser. This would cause oddness during Batch export mode
and was different than the prior Python based exporter[1].

Permit the exporter to accept names without an extension as before.

[1] [Prior python exporter](https://projects.blender.org/blender/blender-addons/src/branch/blender-v4.0-release/io_mesh_stl/__init__.py#L239)

Pull Request: https://projects.blender.org/blender/blender/pulls/118777
2024-02-27 07:46:29 +01:00
Campbell Barton
63a295f307 Merge branch 'blender-v4.1-release' 2024-02-27 17:03:48 +11:00
Campbell Barton
b16ef496a6 Fix #113479: Crash on script error after calling modal_handler_add()
Operators that added themselves as modal handlers would crash if there
was a Python exception in the script before returning.

Now modal handlers are removed an exception occurs in exec & invoke
operator callbacks.
2024-02-27 16:38:01 +11:00
YimingWu
9e143968d3 LineArt: Fix back transformation issue for v3
Line art v3 strokes should not move along with the grease pencil object
to keep the same behaviour as the old line art. Now fixed.
2024-02-27 13:07:47 +08:00
Hans Goudey
ad648a83ac Merge branch 'blender-v4.1-release' 2024-02-26 22:33:10 -05:00
Hans Goudey
341166c728 Fix #118538: Sculpt smooth mask broken for multires
Mistake in bd51bb7623.
2024-02-26 22:31:55 -05:00
Campbell Barton
523909dd73 Merge branch 'blender-v4.1-release' 2024-02-27 13:10:12 +11:00
Campbell Barton
fe8e27ad17 Fix #116680: Crash disabling an add-on used in the file-selector
Clear SpaceFile::op pointer when unregistering an operator to
prevent a use after free error.
2024-02-27 13:04:38 +11:00
Ray Molenkamp
cfb60c98be CMake: MSVC: Add natvis file for blender's native types
This currently contains some types I personally needed
more types can be added if people desire them.

Due to the .natvis being added to creator, Visual Studio
will automatically pick up on these types and show the
improved visualizers while debugging.

vscode can also use this file, but you'll have to check
its documentation on how to set that up.

Pull Request: https://projects.blender.org/blender/blender/pulls/118576
2024-02-27 01:02:42 +01:00
Hans Goudey
dbc884fa92 Cleanup: Use enum class for sculpt mask filter type 2024-02-26 15:54:10 -05:00
Hans Goudey
f7b661b554 Cleanup: Remove useless sculpt mask filter enum descriptions
These don't add anything beyond the enum item names. Better to have
nothing than waste people's time reading useless descriptions.
2024-02-26 15:47:23 -05:00
Hans Goudey
19c6f7bfac Fix: Build error after recent commit with incorrect header names
5d9e127234
2024-02-26 15:14:25 -05:00
Hans Goudey
2697413fc7 Cleanup: Remove unused code in points to volume node 2024-02-26 15:04:29 -05:00
Hans Goudey
0f9ee1194f Geometry Nodes: Add link drag search items to store named grid node 2024-02-26 15:04:29 -05:00
Hans Goudey
9d349896a7 Cleanup: Remove BKE_mesh.hh include from mesh_to_volume.cc
Avoid rebuilding this file when changing BKE_mesh.hh, since it's very slow.
Instead pass the necessary data directly as spans.
2024-02-26 15:04:28 -05:00
Hans Goudey
291a3c681f Cleanup: Sort node definitions alphabetically 2024-02-26 15:04:28 -05:00
Jesse Yurkovich
e3122d270d Merge branch 'blender-v4.1-release' 2024-02-26 11:48:43 -08:00
Jesse Yurkovich
5d9e127234 Fix: Proper error handling for STL, PLY, and OBJ IO
Properly handle exceptions from STL and PLY code to prevent crashes on
invalid file paths.

This will now also Report errors/warnings to the callers of these
formats as well. For the UI this means a Report banner and Info editor
entry. For Python scripts this means an exception instead of silently
continuing.

Related to #117881
Pull Request: https://projects.blender.org/blender/blender/pulls/118731
2024-02-26 20:45:46 +01:00
Julian Eisel
9bf10d9a69 Cleanup: Use const for catalog service functions
These expose internal data for unit testing purposes. While it might be
better to avoid this entirely, at least make the returned data const, so
there's no unexpected modification from outside the catalog service
internals.
2024-02-26 20:15:14 +01:00
Julian Eisel
a9858c1565 Assets: Make asset catalog tree building (mostly) thread safe
Making this thread safe is quite trivial now. Note that for building the
tree we iterate the catalogs map, which may still be modified from
another thread in parallel. Making this thread safe is kept for a
separate commit.
2024-02-26 20:14:13 +01:00
Lukas Tönne
5599172499 GPv3: Armature Modifier
Armature deformation modifier for Grease Pencil v3.

Changes compared to GPv2:
- `multi` DNA field was unused and was removed.
- `vert_coords_prev` array is unused and was removed (gets passed to
  armature functions but never gets allocated).
- GPv3 modifier uses the common `influence` struct to store the vertex
  group name, for consistency. The
  `GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP` flag is copied to
  `deformflag` as `ARM_DEF_INVERT_VGROUP` before evaluation, which is
  used internally by armature functions.
- `BKE_armature_deform_coords_with_curves` is added as another variant
  of the deform function, but uses C++ parameter types (spans instead
  of raw pointers). It gets a `Span<MDeformVert>` directly instead of
  deducing it internally from the object type. This is because we want
  to do this curve-by-curve and already use arbitrary vector spans for
  positions.

Pull Request: https://projects.blender.org/blender/blender/pulls/118752
2024-02-26 19:36:10 +01:00
Bastien Montagne
920b9ab134 Merge branch 'blender-v4.1-release' 2024-02-26 18:49:24 +01:00
Bastien Montagne
3748e49034 LibOverride: When created from IDTemplate UI, ensure instanciation of hierarchy root.
When a new liboverride is created from the IDTemplate UI widget, in case
its hierarchy root is different than the liboverride itself, ensure that
it is also instanciated in the scene, if possible (i.e. if it's an
object or collection).

Should allow for better representation of liboverride hierarchies
created that way, and reduce the risk of getting key liboverrides hidden
from the scene's hierarchy (in the Outliner ViewLayer view e.g.).
2024-02-26 18:48:37 +01:00
Bastien Montagne
73a2af3ae5 Fix #118714: Crash on trying to create override on nested linked object.
LibOverride creation code wrapper when called from the IDTemplates in
the UI was a tad too permissive in its attempts to find the best
possible liboverride hierarchy root, leading to potential invalid linked
ID selection.
2024-02-26 18:48:37 +01:00
Hans Goudey
f83471fa95 Cleanup: Use C++ matrix type in mesh render data 2024-02-26 11:46:01 -05:00
Hans Goudey
53f1ebf232 Cleanup: Pass field directly to mesh render data creation
Avoid the need to set use_hide afterwards when other things are stored directly.
2024-02-26 11:46:01 -05:00
Philipp Oeser
85c350e3e9 Merge branch 'blender-v4.1-release' 2024-02-26 17:41:17 +01:00
Philipp Oeser
a6060ea8ee Fix #118637: crash after editbone duplication in certain case
Crash happens in `action_group_colors_set_from_posebone` /
`ANIM_bonecolor_posebone_get` on a `bPoseChannel` without a `bone`.
If I am not mistaken a new `bPoseChannel` (e.g. after duplication) will
only get its `bone` after leaving editmode.

So in a way the situation is similar to 2a8ce1f121

Behavior of `animchan_sync_group` is not reliable in a way that getting
a `bPoseChannel` from an `bActionGroup` will guarantee these are really
corresponding. So usually, if you dulplicate/symmetrize a bone, there
would be no corresponding `bActionGroup` and nothing would happen
really. But you could for example group fcurves from `Bone` under a
group called `Bone.001` and vice versa. This is totally allowed to do.
In this case, `animchan_sync_group` is doing nothing totally helpful, so
it could find the "wrong" `bPoseChannel`. And it could try
`action_group_colors_set_from_posebone` with that `bPoseChannel` which
still does not have a `bone` and then crash.

So now only do this if we have a valid `bone`.

Pull Request: https://projects.blender.org/blender/blender/pulls/118676
2024-02-26 17:40:57 +01:00
Miguel Pozo
c713fbc2d3 GPU: Allow printing full shader source on compilation error
Add a define (DEBUG_LOG_SHADER_SRC_ON_ERROR ) in gpu_shader_private.h
to print the full source code of shaders that fail to compile.

Pull Request: https://projects.blender.org/blender/blender/pulls/116470
2024-02-26 17:30:15 +01:00
Hans Goudey
5463dd1f69 Cleanup: Rename mesh extraction file
The "pos_nor" file only extracts postions after bace4c9a29.
2024-02-26 11:28:33 -05:00
Philipp Oeser
663c1ea14d Merge branch 'blender-v4.1-release' 2024-02-26 17:16:33 +01:00
Philipp Oeser
ae022e515b Fix 104657: crash when trying to create a Pivot Constraint for armature
`RootPChanMap` will be nullptr when building DEG object-level
constraints (as as opposed to bone constraints where this map is built
prior), and in that case we don't need to check for the common chains in
`bone_target_opcode`.

Thx @sergey for additional confirmation

Pull Request: https://projects.blender.org/blender/blender/pulls/118745
2024-02-26 17:15:58 +01:00
Clément Foucault
c04eb58134 EEVEE-Next: Make denoising roughness correct for refraction
Avoid overblurred refractions.

Fix #110760
2024-02-26 16:21:08 +01:00
Jeroen Bakker
8dce2a422b EEVEE-Next: Specialization Constants for Film Accumulation
On lower end hardware the film accumulation has bad performance. Sometimes
upto 10ms. This PR improves the performance somewhat by adding a
specialization constant around the renderpasses that are actually needed for
rendering, the number of samples and if reprojection is enabled.

`enabled_categories`: Based on the enabled render passes some outer loops are
enabled/disabled that handle the specific render passes. This improves the performance
as no memory will be reserved for branches that are never accessed.

`samples_len` & `use_reprojection`: GPU compilers tend to optimize texture fetches
when they to the outer loop. This is only possible when the inner loop can be unrolled.
In the case of the film accumulation the inner loop couldn't be unrolled. By adding a
specialization constant would allow unrolling of the inner loop.

On old or low-end devices the improvement is around 40%. On newer devices
the improvement is 50+%. Performance of this shader is similar to
the godot.

| GPU                  | Before | New   |
|----------------------|--------|-------|
| NVIDIA GTX 760       | 3.5ms  | 2.4ms |
| GFX1036 (RDNA2 iGPU) | 9.9ms  | 6.2ms |
| AMD Radeon Pro W7500 | 2.1ms  | 0.9ms |

Pull Request: https://projects.blender.org/blender/blender/pulls/118385
2024-02-26 16:19:26 +01:00
Jeroen Bakker
e5b9bbe0ae Draw: Add support for uint specialization constants
When implementing film accumulation specialization constants we came
across a missing implementation for uint as specialization constant.
This is a split-off from the original patch to add support for uint.

When using it is important to compile with asserts on. uint can be casted
to int without knowning. There are assert mechanism that point you to
these cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/118750
2024-02-26 16:18:09 +01:00
Hans Goudey
bace4c9a29 Mesh: Improvements to position and normal draw extraction
Currently there are two vertex buffers that contain mesh normals. First, the
normals are extracted and stored interleaved with positions. Then there is
a second vertex buffer for just normals. Interleaving them makes some
sense, since they change together, but it fights with the contiguous storage
benefits of `Mesh` and generally makes code more difficult to optimize.

This PR removes the normals interleaved with the positions and changes
the code for extracting positions and normals from meshes to be simpler
and faster, mainly by not using the "extract iterators" as described by the
#116901 design task. That moves most of the branching outside of hot
loops, so we don't do the same work for every mesh element. This also
gives us the option of not calculating or extracting normals in more
situations like wireframe display in the future.

This is only a small part of the work for #116901, so the state of the code
after this PR will have more design inconsistencies. I'll keep working to
resolve those in the future.

In general I observed at least a 5-40% improvement in FPS in playback
of files with large meshes.

Pull Request: https://projects.blender.org/blender/blender/pulls/116902
2024-02-26 16:01:14 +01:00
Omar Emara
43f45f3986 Merge branch 'blender-v4.1-release' 2024-02-26 16:29:28 +02:00
YimingWu
3d1cdfe2ca GPv3: Line Art Modifier
This is a migration of the current Line Art modifier to GPv3.

Note:
- The modifier is using the exact same DNA structure as the old one, it's re-defined in a different name. At the moment all the variable names and placement after the `ModifierData` part should stay exactly the same until we do proper versioning of the modifier data and completely remove the GPv2 support.
- Vertex weight transfer feature no longer supports name initial matching ("group" used to match "group1","group2" etc). Now it will only transfer vertex weight from source vertex groups that has the exact same name as specified.

Pull Request: https://projects.blender.org/blender/blender/pulls/117028
2024-02-26 15:28:15 +01:00
Omar Emara
a2ca050087 Fix #118711: Crash in compositor with many nodes
The Viewport Compositors crashes when there are many nodes that are not
connected to the compositor or viewer outputs.

That's because those sockets were wrongly added to the shader operation,
even though they will not be used, which surpasses the limit for the
maximum image units per shader.
2024-02-26 16:24:38 +02:00
Clément Foucault
038fc84ab3 EEVEE-Next: Add light support for refraction closures
This adds support by just reusing the GGX reflection LTC
look-up table. This avoid more memory usage for another
table.

This is quite a hack and has no real physical ground.
We already have a roughness remapping function for
reusing sphere-probe for refraction and matching the
blur level. We can reuse this function and use it
for sampling the reflection LUT.

Then getting the theta LUT parameter is done by
computing the angle between the refraction direction
and the reversed normal.

This works because the table is parametrized using the
angle between the view vector and the normal. This angle
is the same as the angle between the reflection vector
and the normal. So to get the equivalent lobe in the
refraction direction we get the angle between the
refraction direction and the reversed normal.

Note: This has issues shadow-map tagging but it should
be fixed separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/118589
2024-02-26 15:20:16 +01:00
Julian Eisel
0995adce20 Fix asset catalogs test failure
Unit tests were assuming that creating a catalog from a path would not
create catalogs for the parent path elements if missing. I'd argue this
should not be unit tested since it's internal behavior that isn't
visible to API users. But for now I'll keep the test working as is, also
to avoid indirect recursive calls of `create_missing_catalogs()`.
2024-02-26 15:12:38 +01:00
Jeroen Bakker
3109564825 GPU: Fix shader compilation Metal
Metal uses an union to store the `gl_WorkGroupSize` the union needs to
be unpacked. We first unpack to uvec3 before in order to work around an
NVIDIA driver bug.

Issue introduced by: e3ac2ac93e

Pull Request: https://projects.blender.org/blender/blender/pulls/118749
2024-02-26 14:51:21 +01:00
Jeroen Bakker
582be5e315 Cleanup: Make format 2024-02-26 14:44:56 +01:00
Aras Pranckevicius
12ef5d38c4 Merge branch 'blender-v4.1-release' 2024-02-26 14:54:35 +02:00
Aras Pranckevicius
b846ccd76b Fix #118501: crash opening some projects if Load UI is off
Missing vecscope_rgb null initialization when loading Scopes data,
introduced in 567455124d
2024-02-26 14:54:05 +02:00