Commit Graph

134559 Commits

Author SHA1 Message Date
Jesse Yurkovich
9ae24fee48 USD: Add tests to cover curve, light, and point instancer import
The curve variations were used during development of the GeometrySet
changes.

The lights and point instancer coverage would have helped uncover bugs
earlier. Bugs that eventually had to be fixed in 4.1. Better late than
never.

The one downside is that the light tests is actually a round-trip test,
which is normally fine to do, except it technically does an export
during the import test.

Pull Request: https://projects.blender.org/blender/blender/pulls/119858
2024-03-26 18:58:46 +01:00
Hans Goudey
efee753e8f Cleanup: Move BKE_idprop.h to C++ 2024-03-26 13:07:04 -04:00
Hans Goudey
f41ab9abc1 Cleanup: Combine BKE_idprop C and C++ headers
In preparation for moving the whole BKE_idprop.h to C++.
To keep the git history intact we remove the newer smaller file.
2024-03-26 13:07:04 -04:00
Sean Kim
881178895b Sculpt: Add fast solver option for trim operations
This PR introduces the ability for users to switch between boolean
solvers while using the sculpt *Trim* tools (*Box Trim* & *Lasso Trim*)
much like the mesh boolean modifier and geometry node. Because the
*Exact* solver has performance issues with larger meshes, the *Fast*
solver is set to be the default.

In my very rough timing tests on my laptop on a mesh with **1.7m**
vertices, a *Trim* operation with the *Fast* solver finishes in roughly
20 seconds as opposed to still being in progress after five minutes
with the *Exact* solver.

Addresses part of #84229

Pull Request: https://projects.blender.org/blender/blender/pulls/119699
2024-03-26 17:25:06 +01:00
Hans Goudey
b4b74c8da6 Cleanup: Simplify object data iteration in shade smooth operator
Use a Set instead of the `LIB_TAG_DOIT` flag.
2024-03-26 11:37:05 -04:00
Weizhen Huang
c16fd219a8 Fix #70210: Cycles environment map sampling not accounting for negative values
Cycles samples environment map with a PDF proportional to the luminance.
This computation was assuming positive values, but generated texture
coordinates from world could have negative values, so the resulted CDF
was almost zero in the bug report scene.
Fixed by taking the absolute value when computing luminance in CDF.

Pull Request: https://projects.blender.org/blender/blender/pulls/119896
2024-03-26 16:24:36 +01:00
Falk David
f8ef2b3e78 Curves: Add simplify_curve_attribute function
Compute an index masks of points to remove to simplify the curve attribute using the Ramer-Douglas-Peucker algorithm.

The Ramer-Douglas-Peucker algorithm finds a set of points in a polyline to remove so that the overall shape of the polyline is similar. How similar can be controlled by the distance `epsilon`.

The function takes a `GSpan` so it can be used with any attribute (that has a type `float`, `float2`, or `float3`).

Pull Request: https://projects.blender.org/blender/blender/pulls/118560
2024-03-26 15:28:11 +01:00
Aras Pranckevicius
3663c8147c Vulkan: implement support for compressed textures
Textures that are GPU-compressed already (in practice: from DDS files
that are DXT1/DXT3/DXT5 compressed) now can stay GPU compressed
in Vulkan, similar to how that works on OpenGL.

Additionally, fixed lack of mipmaps in Vulkan textures. The textures
were created with mipmaps (good), the sampler too (good), but
the vulkan image view was always saying "yo, this is mip 0 only"
because mip range variables were never set to anything than zero.

Pull Request: https://projects.blender.org/blender/blender/pulls/119866
2024-03-26 14:49:53 +01:00
Jacques Lucke
4cdc62044e BLI: fix fixed-width-int to string conversion 2024-03-26 14:25:33 +01:00
Sergey Sharybin
d3504a6bab Fix #119907: Active curve vertex/spline not visualizing properly
A regression caused by 7a2d04a5c4.

The offending commit made it so selection tag does not imply parameters
update, which also avoids transitive re-evaluation of the curve geometry.
However, the active curve index is stored on a Curve, and curve modifier
stack creates a copy of the curve to hold the evaluation results, which
makes it so evaluated curve object does not intrinsically share the active
spline index.

This change makes it so changes in selection triggers geometry evaluation
on curves, matching the behavior prior to the offending commit.

AN ideal fix would somehow avoid such geometry re-evaluation, but it would
be a bigger change, not suitable for possible corrective release.

Potential candidate for 4.1.1.

Pull Request: https://projects.blender.org/blender/blender/pulls/119918
2024-03-26 13:58:55 +01:00
Campbell Barton
9c3eceb8c8 BKE_reports: only print a single newline after each report
Printing reports was printing 2x newlines afterwards.

This caused a blank line to be printed when any operator reported info.
2024-03-26 23:00:59 +11:00
Omar Emara
5764173501 Compositor: Update tests for realtime compositor 2024-03-26 12:52:07 +02:00
Jeroen Bakker
e811785f37 Vulkan: to_string for used vulkan types
Every vulkan installation has a vk.xml file containing the vulkan specification
in a machine readable fasion.

This PR uses the vk.xml to generate to_string functions for data types blender uses.
When updating to a new specification or when changing features/extensions we
should re-generate the to_string functions.

The generator is implemented in `vk_to_string.py`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119880
2024-03-26 11:35:16 +01:00
Omar Emara
df9b3d35a2 Fix: Compositor retains old images
The compositor does not correctly free, wrap, or allocate images. That's
because the resetting mechanism didn't reset all members. This patch
rests all members and only retains the important ones.
2024-03-26 12:32:36 +02:00
Sietse Brouwer
a02b429324 Fix: GPv3: Layer settings not copied when duplicating a layer
Pull Request: https://projects.blender.org/blender/blender/pulls/119821
2024-03-26 11:01:00 +01:00
Sietse Brouwer
ab84f9eaf0 Fix: GPv3: The 'Use Masks' switch is always enabled for new layers 2024-03-26 10:59:08 +01:00
Sietse Brouwer
76c164e0ad Fix: GPv3: Blend mode not initialized when adding a new layer 2024-03-26 10:59:08 +01:00
Sietse Brouwer
31c194c002 Fix: GPv3: Layer 'Lock All' not working when 'Unlock All' has run before 2024-03-26 10:59:08 +01:00
Sietse Brouwer
ca8fc1dea6 Fix: GPv3: Empty drawings with layer 'Duplicate' when 'Duplicate Empty Keyframes' has run before 2024-03-26 10:59:08 +01:00
Weizhen Huang
1bf467aff6 Cleanup: make format 2024-03-26 09:39:22 +01:00
Philipp Oeser
b8bd762714 Fix #112618: many Outliner operators crash running without a region
This could happen when e.g. overriding context with just the area.

Now add poll functions that check for an active region when running
operators that require a region.

The fix is similar to 72688791dcb2

Alternatively, we could have a fix similar to a8892c726435 (getting the
correct region from the area), this would require less setup by
scripters, however for some operators the usage of the region is a
little further down the line, so implementation would be a bit more
involved. Also: for some of the operators, this would have to be done in
both `invoke` and `exec` (so would be more duplicate code changes).

Pull Request: https://projects.blender.org/blender/blender/pulls/119696
2024-03-26 09:30:47 +01:00
Alaska
a4f1a52a5c Fix #119903: Cycles compilation on device that don't use the light tree
During the some of the shading for volumetrics, Cycles would try to
write to a variable that does not exist if the device has the
light tree disabled.

At the moment this only impacts AMD GPUs with the Metal backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/119906
2024-03-26 08:20:09 +01:00
Campbell Barton
155dae94d7 Cleanup: code-comments, use doxygen formatting & spelling corrections
Also move some function doc-strings from the implementation
to their declarations.
2024-03-26 17:55:20 +11:00
Omar Emara
6d7b4e049e Compositor: Refactor backdrop offset
This patch refactors the backdrop offset to be stored as a float instead
of an int and to be stored in the image runtime structure instead of the
image itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/119877
2024-03-26 07:49:33 +01:00
Aaron Carlisle
3b3a6ccecd Docs: Python: Use headings instead of rubrics
This allows these headings to show under "On this page".
2024-03-26 01:48:32 -04:00
Aaron Carlisle
7d29f25ee1 Docs: Python: Fixes for sphinx Idioms
- There is no need to use the low level css add function use `html_css_files` instead.
- There is no need to specify each file for `html_extra_path`, just use the directory.
2024-03-26 01:23:55 -04:00
Campbell Barton
666ec966b9 Docs: improve code-comments for setup_app_data 2024-03-26 15:49:38 +11:00
Campbell Barton
099ff1a953 Cleanup: various non-functional C++ changes 2024-03-26 15:29:11 +11:00
Hans Goudey
fc0d8ba012 Cleanup: Remove C++ ifdef checks in C++ headers
Pull Request: https://projects.blender.org/blender/blender/pulls/119900
2024-03-26 04:56:03 +01:00
Hans Goudey
893130e6fe Refactor: Remove unnecessary C wrapper for GPUBatch class
Similar to fe76d8c946e5ce7a76d45acaee0a67407cb3b599

Pull Request: https://projects.blender.org/blender/blender/pulls/119898
2024-03-26 03:06:25 +01:00
Jacques Lucke
7314c86869 BLI: add fixed width integer type
This is intended to be used in the new exact mesh boolean algorithm by @howardt.
The new `BLI_fixed_width_int.hh` header provides types like `Int256` and
`UInt256` which are like e.g. `uint64_t` but with higher precision. The code
supports many different integer sizes.

The following operations are supported:
* Addition
* Subtraction
* Multiplication
* Comparisons
* Negation
* Conversion to and from other number types
* Conversion to and from string (based on `GMP`)

Division is not implemented. It could be implemented, but it's more complex and
is not required for the new mesh boolean algorithm.

Some alternatives to having a custom implementation have been discussed in
https://devtalk.blender.org/t/fixed-length-multiprecision-arithmetic/29189/.

Generally, the implementation is fairly straight forward. The main complexity is
the addition/multiplication algorithm which isn't too complicated. It's nice to
have control over this part as it allows us to optimize the code more if
necessary. Also, from what I understand, we might be able to benefit from some
special cases like multiplying a large integer with a smaller one.

I tried some different ways to optimize this already, but so far the normal
compiler optimization turned out to work best. Not sure if the same is true on
windows though, as it doesn't have native support for an `int128` which helps
the compiler understand what I'm doing. Alternatives I tried so far are using
intrinsics directly (mainly `_addcarry_u64` and similar), writing inline
assembly manually and copying the assembly output from the compiler. I assume
the assembly implementation didn't help for me because it prohibited other
compiler optimizations.

Pull Request: https://projects.blender.org/blender/blender/pulls/119528
2024-03-25 23:39:42 +01:00
Hans Goudey
1681e55114 Geometry Nodes: Add 8-bit integer attribute type to store attribute node
We already expose two other types that don't have a directly
corresponding socket type-- float2 and byte colors. This also solves
the inability to write to the nurbs_order attribute in geometry nodes.

Fixes #119843

Pull Request: https://projects.blender.org/blender/blender/pulls/119879
2024-03-25 23:04:11 +01:00
Hans Goudey
ef22826a3c Cleanup: Remove non-creatable option for builtin attributes
This was necessary when attributes were stored embedded in legacy
structs like `MPoly`. Nowadays that isn't the case anymore, and there
doesn't seem to be a reason to restrict the creation of attributes.
2024-03-25 17:05:39 -04:00
Hans Goudey
a6d4845899 Merge branch 'blender-v4.1-release' 2024-03-25 16:58:33 -04:00
Hans Goudey
ccb416322c UI: Add XYZ labels to Set Curve Normal node vector input 2024-03-25 16:58:29 -04:00
Hans Goudey
aa9bfc1b2a Fix: Uninitialized attribute memory read after recent commit
update_on_change_ shouldn't be called when creating an attribute but
not setting the array values. In that case it is UB to not set the values
elsewhere anyway, and that will cause its own update tag.
2024-03-25 16:58:21 -04:00
Hans Goudey
40a5e739e2 Fix #119873: Bake node crash with instanced light objects
4d0936c7d74bee32cd50 explicitly avoids turning non-geometry object
instances into geometry instances. This code is called to prepare
geometry sets for baking, and baking currently assumes that the baked
instances are always geometry sets.

To fix this, just check the instance type and serialize an empty
geometry set for the crashing object instance case. Compared to before
the crash causing commit, there is no change in behavior, since that
would have created empty geometry sets too.

Pull Request: https://projects.blender.org/blender/blender/pulls/119892
2024-03-25 21:42:07 +01:00
Hans Goudey
04bcd17dc8 Cleanup: Remove unnecessary builtin attribute provider logic
All builtin attributes are now stored as named attributes, so the old
code path from where they were stored with non-generic types can be
removed. The stored type and attribute type don't have to be tracked
separately anymore either.
2024-03-25 16:01:36 -04:00
Hans Goudey
11afa15361 Revert "Fix #119508: Missing update after "Shade Flat" operator"
This reverts commit 130701763bdb9e104486c9fd789cf128af68d9d5.

73cc27b988420d1ee10aaab808e57947dad55bbd made this unnecessary.
2024-03-25 15:50:27 -04:00
Hans Goudey
73cc27b988 Fix #119886: Set curve node missing normals update tag
The change to use generic "capture field on geometry" utilities for this
node and other nodes like it means `AttributeWriter` with its update
tagging isn't being used anymore, the attribute is just being created
with the new values (for some cases anyway). To fix this, call the
attribute provider's update function when creating the attribute too.
This was noted as useful in 130701763bdb9e104486 too.

The initialization of curve and point cloud runtime structs is moved
because they now have to be allocated before any attributes are added.
2024-03-25 15:49:25 -04:00
Weizhen Huang
2c301c921f Tests: temporarily disable light tree in the new test file
seems to cause problem on other platforms
2024-03-25 19:43:14 +01:00
Weizhen Huang
fdc2962beb Fix #114634: correlated samples in volume when using equiangular sampling and light tree
The same random number was used when sampling from the volume segment
and from the direct scattering position, causing correlation issues with
light tree.

To solve this problem, we ensure the same light is picked for
volume segment/direct scattering, equiangular/distance sampling by
sampling the light tree only once in volume segment. From the direct
scattering position in volume, we sample a position on the picked light
as usual. If sampling from the light tree fails, we continue with
indirect scattering.
For unbiased MIS weight for forward sampling, we retrieve the `P`, `D`
and `t` used in volume segment for traversing the light tree.

The main changes are:
1. `light_tree_sample()` and `light_distribution_sample()` now only pick
lights. Sampling a position on light is done separately via
`light_sample()`.
2. `light_tree_sample()` is now only called only once from volume
segment. For direct lighting we call `light_sample()`.
3. `light_tree_pdf()` now has a template `<in_volume_segment>`.
4. A new field `emitter_id` is added to struct `LightSample`, which just
stores the picked emitter index.
5. Additional field `previous_dt = ray->tmax - ray->tmin` is added to
`state->ray`, because we need this quantity for computing the pdf.
6. Distant/Background lights are also picked by light tree in volume
segment now, because we have no way to pick them afterwards. The direct
sample event for these lights will be handled by
`VOLUME_SAMPLE_DISTANCE`.
7. Original paper suggests to use the maximal importance, this results
in very poor sampling probability for distant and point lights therefore
excessive noise. We have a minimal importance for surface to balance, we
could do the same for volume but I do not want to spend much time on
this now. Just doing `min_importance = 0.0f` seems to do the job
okayish. This way we still won't sample the light with zero
`max_importance`.

The current solution might perform worse with distance sampling, because
the light tree measure is biased towards equiangular sampling. However,
it is difficult to perform MIS between equiangular and distance sampling
if different lights are picked for each method. This is something we can
look into in the future if proved to be a serious regression.

Pull Request: https://projects.blender.org/blender/blender/pulls/119389
2024-03-25 18:50:52 +01:00
Sergey Sharybin
565dc1f22b Merge branch 'blender-v4.1-release' 2024-03-25 18:15:05 +01:00
Sergey Sharybin
6c74d4af15 Fix #118555: Occasional incorrect compositor result with relative transform
In the tiled compositor ensure_delta() can be called from multiple threads,
but without any threading synchronization. This worked fine when the node
only supported absolute transform: multiple threads would do the same work
and assign delta to the same values.

With the addition of relative transform in #115947 a code which adjusts
previously calculated delta was added, leading to possible double-applying
relative transform.

The solution is to avoid multiple threads modifying the same data by using
a double-locked check.

This issue does not happen in 4.2 (main branch) because it switched to full
frame compositor, which works differently.

Pull Request: https://projects.blender.org/blender/blender/pulls/119883
2024-03-25 18:13:38 +01:00
Thomas Dinges
4ed88ce44d Merge branch 'blender-v4.1-release' 2024-03-25 18:10:23 +01:00
Thomas Dinges
26caa18173 Release: Bump to 4.1 release 2024-03-25 18:08:02 +01:00
Aaron Carlisle
f032da82af Merge branch 'blender-v4.1-release' 2024-03-25 12:52:47 -04:00
Aaron Carlisle
5a9b292ac4 Docs: Python API: Enable version switch menu 2024-03-25 12:50:01 -04:00
5ff8738dce Cleanup: Anim, reduce indentation in ANIM_animdata_filter
Return early if possible, reducing cognitive complexity.

No functional changes.
2024-03-25 15:26:27 +01:00
Jacques Lucke
6b5a97170c Geometry Nodes: allow overriding bake settings on overridden object
Previously, the bake settings in geometry nodes were not
editable even though they were stored on the overridden
object (instead of the not-overridden but linked node tree).

Pull Request: https://projects.blender.org/blender/blender/pulls/119874
2024-03-25 14:58:45 +01:00