Commit Graph

1399 Commits

Author SHA1 Message Date
Weizhen Huang
6fbc958e89 Fix: Cycles Light Tree gives low weight to distant lights in large volume
The original paper only considers the minimal distance of the cluster to
the ray, not the interval length, resulting in low weight for distant
lights that have large influence over a long distance.
This commit modifies the measure by considering `theta_b - theta_a` for
local lights and the ray length `t` for distant lights.

Pull Request: https://projects.blender.org/blender/blender/pulls/123537
2024-06-24 12:48:08 +02:00
Miguel Pozo
02f6ea906e EEVEE: Update reference images for tests 2024-06-19 18:43:40 +02:00
Clément Foucault
d41cd2095a EEVEE: Make render tests use volume indirect lighting 2024-06-18 17:53:22 +02:00
Brecht Van Lommel
a87907b425 Fix #123201: Cycles OSL bump mapping broken
After the last OSL update, the Normal input to the auto generated Bump
node was getting a constant value instead of the normal.
2024-06-14 16:54:44 +02:00
Bastien Montagne
b03a6bbd60 Cleanup: Remove left-over debug print in tests. 2024-06-13 20:50:13 +02:00
Bastien Montagne
5dfc197262 IDProp: BPY: Support assigning large int values to float properties.
Allow assigning integer values beyond int32 range to float/double
IDProperties. Extract the py object value into a temporary int64 value
in these cases.
2024-06-13 20:47:46 +02:00
Bastien Montagne
b278e37f70 IDProps: Make 'dynamic RNA' IDProperties statically typed.
All IDProperties generated as part of 'storage backend' for dynamic RNA
properties are now statically typed.

Also adds some basic unittests for the new statically typed IDProperty
system, based on py-defined RNA data.

Ref. #122743.
2024-06-13 19:58:22 +02:00
83311ef96d Fix #122777: The keyframe_insert method throws python exceptions
Just for the `pyrna_struct_keyframe_insert()` function, reduce the
reporting level of keyframe insertion failures from `RPT_ERROR` to
`RPT_WARNING`. This prevents the conversion of these reports to a Python
exception.

`CombinedKeyingResult::generate_reports()` now accepts an option
argument `report_level`, so that the caller is in control over the type
of reports it generates.

Previously only errors were converted to exceptions; warnings were
implicitly cleared and never displayed. To avoid these 'keyframe
insertion failure' reports from becoming invisible, the
`pyrna_struct_keyframe_insert()` function now sends any warnings to
stdout (unless there were errors, in which case the old
error-to-exception behaviour is still there).

Pull Request: https://projects.blender.org/blender/blender/pulls/122827
2024-06-11 11:11:16 +02:00
Bastien Montagne
65f68fe7fe BPY IDProp tests: Add basic tests for 'UI data' system.
This are not complete by far, mainly here to illustrate the issue
reported in #122843 (mismatch returned value for 'enum' idprops).
2024-06-10 15:54:29 +02:00
Bastien Montagne
a799c84946 BPY IDProp tests: test matching results from subscription and path_resolve.
Add (partially disabled) systematic tests that for all IDProp types, the
returned value from direct idprop subscription and RNA-based
`path_resolve` return the same data.

NOTE: This does not work currently for 'composite' types (`IDP_ARRAY` and
`IDP_GROUP`).
2024-06-10 14:27:16 +02:00
Campbell Barton
b7e0d7d1c3 Fix script_load_addons including add-ons from the users home directory
The add-on load test could fail depending on add-ons in user extension
repositories.

Remove all repositories before running the tests.

Also minor naming & comment edits.
2024-06-09 22:50:10 +10:00
Brecht Van Lommel
fe4c28f2dc Fix: Benchmarks auto build not working with new lib directories
Symlinking the lib folder doesn't work anymore with submodules.
2024-06-06 19:52:55 +02:00
Michael B Johnson
f913fb6159 USD: Add MaterialX shader export
This change adds the ability to export MaterialX networks into the resulting
USD layer.

Details:

A new export option has been added to the USD export to enable MaterialX
export. It is off by default currently due to reasons in the caveats
section.

When enabled, it exports the MaterialX shading network alongside the
UsdPreviewSurface network, on the same USD Material. This allows the same
material to be used by renderers that don't support MaterialX, using the
USDPreviewSurface as a fallback. This is similar to setups in other DCC
packages, and matches the format we've used in our Reality Composer Pro
asset library.

It uses the existing MaterialX framework used to generate MaterialX
documents for rendering, to act as the basis for the USD graph. In this
process it also re-uses the existing texture export code as well if provided
and necessary.

Once the MaterialX document is created, use usdMtlx to generate a USD
shading network. Unfortunately, usdMtlx generates a graph that is unlike
what other DCCs that support MaterialX-embedded-in-USD generates. It
generates several extra prim hierarchies, and externalizes all shader
inputs, making them difficult to edit in other MaterialX graph editors.

To workaround this, generate the MaterialX shading network onto a
temporary stage, where we then run various pre-processing steps to prevent
prim collisions and to reflow the paths once they're converted.

The PrimSpecs are then copied over to their new path. The resulting prim
hierarchy matches what many artists we've worked with prefer to work with.

Caveats:

The Export MaterialX check is off by default. When using the Principled
BSDF, the resulting graph is very usable. However, when using some of the
other BSDFs, the shading networks generated by the existing MaterialX
framework in Blender generate some shading graphs that are difficult for
usdview and other DCC's to understand. The graph is still correct, but
because we're trying to prioritize compatibility, the default is off.

In future PRs we can aim to make the graphs for those other BSDFs play
better with other DCCs.

Other Implementation Details:

As part of this commit we've also done the following:

* Place some of the materialx graphs inside a passthrough nodegraph to
  avoid node conflicts.
* Better handle some shader output types , and better handle some
  conflict cases.
* Moved the ExportTextureFunction to materials.h due to some difficult
  to resolve header ordering issues. This has no effect on any runtime code.
* There is a test for the MaterialX export that does some basic checking to
  make sure we get an export out the other end that matches our expectations

Authored by Apple: Dhruv Govil

This PR is based on an earlier implementation by Brecht van Lommel , as well
as Brian Savery and his teams' work at AMD to implement the general
MaterialX framework within Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/122575
2024-06-05 20:43:44 +02:00
Lukas Stockner
5246fb5a57 Cycles: Implement blue-noise dithered sampling
This patch implements blue-noise dithered sampling as described by Nathan Vegdahl (https://psychopath.io/post/2022_07_24_owen_scrambling_based_dithered_blue_noise_sampling), which in turn is based on "Screen-Space Blue-Noise Diffusion of Monte Carlo Sampling Error via Hierarchical Ordering of Pixels"(https://repository.kaust.edu.sa/items/1269ae24-2596-400b-a839-e54486033a93).

The basic idea is simple: Instead of generating independent sequences for each pixel by scrambling them, we use a single sequence for the entire image, with each pixel getting one chunk of the samples. The ordering across pixels is determined by hierarchical scrambling of the pixel's position along a space-filling curve, which ends up being pretty much the same operation as already used for the underlying sequence.

This results in a more high-frequency noise distribution, which appears smoother despite not being less noisy overall.

The main limitation at the moment is that the improvement is only clear if the full sample amount is used per pixel, so interactive preview rendering and adaptive sampling will not receive the benefit. One exception to this is that when using the new "Automatic" setting, the first sample in interactive rendering will also be blue-noise-distributed.

The sampling mode option is now exposed in the UI, with the three options being Blue Noise (the new mode), Classic (the previous Tabulated Sobol method) and the new default, Automatic (blue noise, with the additional property of ensuring the first sample is also blue-noise-distributed in interactive rendering). When debug mode is enabled, additional options appear, such as Sobol-Burley.

Note that the scrambling distance option is not compatible with the blue-noise pattern.

Pull Request: https://projects.blender.org/blender/blender/pulls/118479
2024-06-05 02:29:47 +02:00
Omar Emara
4f21b26675 Fix #121639: Glare shifts the colors of highlights
The Glare node shifts the color of the highlights when the threshold is
high. That's because the thresholding algorithm simply subtracts the
threshold from the RGB data, which is not expected to retain the same hue
of the color.

To fix this, we do the thresholding only on the luminance of the color
in HSV color space. This eliminates the color shifting and also helps to
smooth the edges of the highlights.

This is a breaking change, but it is more of a fix rather than a change
of behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/122570
2024-06-04 20:59:32 +02:00
Jeroen Bakker
6a71a91b83 EEVEE-Next: Light Probe RNA
Split `bpy.types.LightProbe` into specialized subclasses.
- Rename all grid_* to remove the prefix in the RNA and limit access to
  volume probe.
- Parallax and other sphere probe only properties should be limited to
  sphere probe.
- `visibility` properties are deprecated (to be removed in a future
  Blender version)

Ref #113976

Pull Request: https://projects.blender.org/blender/blender/pulls/122353
2024-06-04 15:05:22 +02:00
Clément Foucault
cc0d12dd20 EEVEE: Remove EEVEE-Legacy
This handles the transition to EEVEE-Next (now EEVEE).

This removes some things that make no sense to keep
even for compatibility.
- Scene.eevee.light_cache_data
- Scene Light cache operators
- Scene Light cache RNA properties

The remaining legacy properties will be removed later
on to avoid python API breakage.

We keep the identifier of EEVEE-Next as `BLENDER_EEVEE_NEXT`
to avoid addons being incorrectly silently made compatible
with the EEVEE-Next where the Python API is different.
This renaming should be done in 5.0 release.

Thank you EEVEE-Legacy, you served us well.

Pull Request: https://projects.blender.org/blender/blender/pulls/122433
2024-06-04 14:17:58 +02:00
Clément Foucault
dabaa3d280 USD: Update material test to use Cycles instead of EEVEE
This avoid issue with the versioning script that will
disconnect all alpha inputs for opaque materials.
2024-06-03 18:31:28 +02:00
Brecht Van Lommel
c0b8473bd6 Tests: Update Hydra reference renders 2024-06-03 14:04:30 +02:00
Jesse Yurkovich
05f8d35652 Fix #122606: fully map Blender's INT8 type to USD's UChar
While USD does not have a signed, 8-bit, integer type we can use its
UChar type instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/122610
2024-06-02 22:26:12 +02:00
Charles Wardlaw
e1a6749b3d USD: dome light IO
This commit adds logic to convert between USD dome lights and Blender
world materials.

The USD dome light rotation is represented in a mapping node input to the
environment texture.  If the dome light has a color specified in addition to
the texture map, the color will be converted to a vector multiply on the
the environment texture output.

I the imported USD has multiple dome lights, only the first dome light will
be converted to a world material.

Co-authored-by: kiki <charles@skeletalstudios.com>
Co-authored-by: Michael Kowalski <makowalski@nvidia.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/121800
2024-05-30 20:48:43 +02:00
Habib Gahbiche
192d4dc9dc Compositor: implement bicubic interpolation for Stabilize2DNode
This patch also fixes a crash when image input of `Stabilize2DNode` is unconnected and interpolation is set to bicubic.

Differences to GPU compositor:
- ~1px difference is observed due to different rounding of domain size vs. canvas size. This difference is constant for all image sizes.
- If image input is unconnected but other inputs are, CPU compositor doesn't consider the operation to be constant, whereas GPU compositor still outputs a constant result.

Pull Request: https://projects.blender.org/blender/blender/pulls/122288
2024-05-30 17:38:41 +02:00
3f555ee027 Anim: add RNA guards to prevent mixing legacy/layered action operations
Add guards to the RNA code to prevent the creation of legacy data on a
layered Action, and vice versa.

On a legacy Action, it is now impossible to create new layers or bindings.

On a layered Action, it's now impossible to create legacy F-Curves or
groups.

Refactor: Anim: rename bl_animation_id.py to bl_animation_action.py

The `Animation` datablock is no more, and this file tests `Action`.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/122483
2024-05-30 13:19:21 +02:00
ef6dd90a6e Refactor: Anim: rename bl_animation_id.py to bl_animation_action.py
The `Animation` datablock is no more, and this file tests `Action`.

No functional changes.
2024-05-30 13:19:21 +02:00
Amine Bensalem
4708e9ec6d Fix #114780: Cycles: Principled Chiang Hair importance sampling correction
Principled Chiang hair longitudinal importance sampling correction,
according to the new pbrt fix here :
https://github.com/mmp/pbrt-v3/pull/256

Pull Request: https://projects.blender.org/blender/blender/pulls/115241
2024-05-27 09:35:35 +02:00
Jesse Yurkovich
9daded5d87 USD: Use nodes for alpha-clip behavior instead of material properties
EEVEE-next has removed the MA_BM_CLIP / alpha_threshold material
properties in favor of using nodes for equivalent functionality. This
changes USD to build and traverse node graphs during import and export
accordingly. Indirectly this allows Cycles to correctly render such
materials now too.

A complicating factor is that the UsdPreviewSurface defines its opacity
threshold using greater-than-equals[1], which Blender does not support
(and for which was technically already incorrect as EEVEE-legacy only
used greater-than for its shaders). Due to this we actually need to use
2 nodes: A less-than, followed by a one-minus invert, to arrive at the
proper value. We'll translate UsdPreviewSurface to this form on Import.

For Export we will look for either this 2-node pattern or a Round
node plugged into Alpha. Looking for Round is a result of the glTF
documentation which recommended the use of this node for thresholds of
0.5[2]. It's a tiny addition that seems reasonable to accommodate.

[1] https://openusd.org/release/spec_usdpreviewsurface.html (search for "opacityThreshold")
[2] https://docs.blender.org/manual/en/4.2/addons/import_export/scene_gltf2.html#alpha-modes

See PR for example images

Pull Request: https://projects.blender.org/blender/blender/pulls/122025
2024-05-25 23:30:13 +02:00
Jesse Yurkovich
21db0daa4e USD: Read and write custom attributes for Curves
Add support for reading and writing custom `Curves` attributes.

This allows us to roundtrip Blender's Hair grooms containing UVs and
other attribute data. Note that animated attribute values are not
supported with this change.

This will also address #120042

Pull Request: https://projects.blender.org/blender/blender/pulls/121928
2024-05-25 22:23:40 +02:00
Lukas Stockner
de2ec32927 Cycles: Add test for small mesh light
This kind of setup has caused numerical issues a few times by now.
2024-05-23 02:59:15 +02:00
Jesse Yurkovich
7930c67a65 USD: Add bezier curve to attributes test file 2024-05-22 17:32:18 -07:00
Jesse Yurkovich
20450acb94 USD: Add more materials to export test 2024-05-21 19:01:42 -07:00
Omar Emara
f0c379e1d3 Realtime Compositor: Implement Fog Glow Glare node
This patch implements the Fog Glow Glare node by porting the CPU
implementation, so it is not GPU accelerated and is not expected to be
realtime. However, after d4bf23771d, it is now fast enough to be usable,
see that commit for more information on the implementation.

The only difference is that the kernel part of the convolution is cached
in the realtime compositor, so it should be about 30% faster than CPU
for interactive editing.

In the future, this implementation will be replaced by a proper GPU
implementation, likely based on VkFFT.
2024-05-21 18:11:01 +03:00
Campbell Barton
8ff15f1c70 Cleanup: restore error, exclude extensions tests from bl_load_py_modules
Also remove outdated exclusions.
2024-05-16 16:02:25 +10:00
Campbell Barton
ccb1fcb5a5 Cleanup: use more descriptive names for module test exclusion
Include comments for how exclusion works.
2024-05-16 15:57:28 +10:00
Omar Emara
3d1c8a3ff3 Compositor: Explicitly set device in test scripts
This patch explicitly sets the compositing device in the compositor test
scripts. This is done to make the tests more robust, since a developer
might accordantly save a file with a different device.
2024-05-14 19:03:55 +03:00
Omar Emara
956eb9a034 Compositor: Update test for for Crop node
The file was accidentally saved with the execution device set to GPU,
which will not work on the build-bot. To update it to use the CPU device
again.
2024-05-14 18:42:25 +03:00
Sergey Sharybin
727a90a0f1 Compositor: Make GPU compositor an official feature
Effectively, make GPU compositor available without need to enable
an experimental feature set.

The compositor device is now exposed in the Performance panel of
Render Buttons. It is also still available in the compositor's
N-panel, together with some other options which are more about how
editing works, and not exactly related to render performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/121398
2024-05-14 15:49:20 +02:00
d94a56bdad Anim: merge Animation data-block into bAction
The new/experimental, layered `Animation` data-block is merged with the
existing `bAction` data-block.

The `Animation` data-block is considerably newer than `bAction`, so the
supporting code that was written for it is also more modern. When moving
that code into `bAction`, I chose to keep the modernity where possible,
and thus some of the old code has been updated as well. Things like
preferring references over pointers.

The `Animation` data-block is now gone from DNA, the main database, etc.
As this was still an experimental feature, there is no versioning code
to convert any of that to Actions.

The DNA struct `bAction` now has a C++ wrapper `animrig::Action`, that
can be obtained via `some_action->wrap()`.

`animrig::Action` has functions `is_empty()`, `is_action_legacy()`, and
`is_action_layered()`. They **all** return `true` when the Action is
empty, as in that case none of the data that makes an action either
'legacy' or 'layered' is there.

The 'animation filtering' code (for showing things in the dope sheet,
graph editor, etc) that I wrote for `Animation` is intentionally kept
around. These types now target 'layered actions' and the
already-existing ones 'legacy actions'. A future PR may merge these two
together, but given how much work it was to add something new there, I'd
rather wait until the dust has settled on this commit.

There are plenty of variables (and some comments) named `anim` or
`animation` that now are of type `animrig::Action`. I haven't renamed
them all, to keep the noise level low in this commit (it's already big
enough). This can be done in a followup, non-functional PR.

Related task: #121355

Pull Request: https://projects.blender.org/blender/blender/pulls/121357
2024-05-13 15:58:04 +02:00
Clément Foucault
c7bc3334ad EEVEE-Next: Shadow: Add Maximum Resolution Option
This adds a light parameter to avoid near camera pixels
allocating too much shadow resolution.

This is more intuitive than the scale shadow setting and
allows reducing the precision without changing the look
of distant shadows.

For sun lights, the property sets the minimum pixel
size the shadow can contains. This allows to
remove a lot tilemap close up.

For local lights, there is another additional property
to set the maximum resolution in shadow space (like
EEVEE-Legacy) instead of in world space (like sun
lights). This allows making older files lighter and
allow a more conservative approach to resolution.

This add versionning code to handle EEVEE-Legacy files
that had fixed resolution per light type.

The resolution setting is always in world space distance
as the maximum shadow resolution distribution might change
in the future or be dependent on other parameters
(like beam angle). This ensure that there is no
dependency on these parameters, but make the
setting use very small units. But this is more of
a UI problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/121701
2024-05-13 14:34:11 +02:00
Aras Pranckevicius
39150096d8 Fix #121720: OBJ does not import some curves properly
If a curve was not using U parameter range of 0..1, the importer
did not properly detect whether the "U endpoint" flag should
be set on it. Fixed that, along with test coverage for the case.
2024-05-13 11:45:20 +03:00
Lukas Stockner
4a1597e39a Cycles: Add tests for Thin Film in Principled BSDF 2024-05-12 22:29:08 +02:00
Clément Foucault
717f546f91 EEVEE-Next: Increase light threshold
Make tests closer to cycles as the main difference
was the light not going far enough to bounce on
the background.
2024-05-10 19:52:11 +02:00
Clément Foucault
9cb76bd728 Fix: EEVEE-Next: Fix crashing tests 2024-05-10 19:49:21 +02:00
Sergey Sharybin
7b4232e8aa Compositor: Move Execution Mode and Precision from bNodeTree to Scene
This allows to expose these settings in the Performance panel in the
render buttons. Also moves compositor-specific options away from the
generic node tree structure.

For the backwards-compatibility the options are still present in the
DNA for the bNodeTree. This is to minimize the impact on the Studio
which has used the GPU compositor for a while now. They can be
removed in a future release.

There is no functional changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/121583
2024-05-10 18:08:33 +02:00
Falk David
40a739e800 Cleanup: Formatting 2024-05-10 17:58:56 +02:00
Bastien Montagne
7629182c62 Unittests: blendfile versioning: Add Link and Append basic tests.
These are really basic testing as well, merely linking or appending the
first collection or object in all processed blendfiles. But it should
help catching 'rare' issues in linking/appending from older blendfiles.
2024-05-10 16:00:30 +02:00
Bastien Montagne
3c14067ecd Unittests: 'versioning' py test: generate multiple instances to parallelize it.
The `io_blendfile_versioning` test is currently one of the slowest
(excluding Cycles ones) in debug builds, it can easily take several
minutes to complete.

This commit split it into several instances, each processing a subset of
all the blendfiles.

This gives a strong speed-up when only running that specific test.
As expected, speedup is neglectable when running the whole test suite
though.

| instances | debug  | release | debug all* | release all |
| --------- | ------ | ------- | ---------- | ----------- |
|         1 | 190.95 |   19.39 |     439.54 |       63.51 |
|         4 |  61.80 |    6.81 |        N/A |         N/A |
|         8 |  38.33 |    5.14 |     435.00 |       58.93 |
|        16 |  33.97 |    4.16 |        N/A |         N/A |
|        32 |  46.54 |    5.14 |        N/A |         N/A |

Times are in seconds.
`instances` are the number of tests generated (1 is same as before this
commit).
The first two columns are timings for running the versioning test only,
the last two are timings for the full test suite (excluding Cycles tests
in the debug build case).
2024-05-10 16:00:30 +02:00
Aras Pranckevicius
7970915dc9 Tests: Add VSE test for text strip blurred shadow / outline options 2024-05-09 16:33:11 +03:00
Habib Gahbiche
6f2afc7390 Fix #121436: Compositor: 2d Stabilization translates image when set to bicubic
The node uses multiple transform operations, each using its own sampling. Using bicubic sampling in the translate node causes undesired offsets.

These changes were intentional (see test updates in `c4e1be73`), but the offsets were thought to be too small for users to notice.

Pull Request: https://projects.blender.org/blender/blender/pulls/121495
2024-05-07 21:08:28 +02:00
Clément Foucault
0b7985a58b EEVEE-Next: Increase shadow precision in render tests 2024-05-07 15:07:40 +02:00
Attila Áfra
205b909669 Build: Upgrade OIDN to 2.3.0-beta
This updates OIDN to 2.3.0-beta. The final version is planned to be
released in time for Blender 4.2 Beta. The most relevant changes:

1. Much higher quality when denoising with accurate prefiltering in *high*
   quality mode, but at the cost of lower performance (use *balanced*
   quality mode to revert to previous *high* quality mode)
2. Added new *fast* quality mode for 1.5-2x higher performance viewport
   denoising
3. Lazy device module loading to avoid potential stability issues caused by
   drivers of unused devices
4. Release CUDA primary context as soon as the OIDN device gets destroyed
   to prevent potential memory leaks

To enable 2 and 3, code changes are needed in Blender, to be committed
separately.

Ref #118455

Pull Request: https://projects.blender.org/blender/blender/pulls/121359
2024-05-06 14:14:58 +02:00