15493 Commits

Author SHA1 Message Date
Campbell Barton
2e6fb3e8e7 Cleanup: suppress deprecated-copy warnings 2025-08-21 02:05:34 +00:00
Campbell Barton
1070d6b64e Cleanup: use SPDX header in CMakeLists.txt generator 2025-08-21 12:02:33 +10:00
Brecht Van Lommel
1d9bd460fc Fix #144814: Cycles OSL crash accessing geom:name string attribute
This should be a ustring hash now, not a ustring.

Pull Request: https://projects.blender.org/blender/blender/pulls/144881
2025-08-20 21:00:12 +02:00
Brecht Van Lommel
98e9dd1aa2 Revert "Cycles: Simplify Metal backend with direct bindless resource encoding"
This reverts commit b4be954856.

It is causing render artifacts in the barbershop benchmark. There were some
conflicts to resolve when reverting this, mainly related to the removal of
3D textures.

Fix #144713
Ref #140671, #144712

Pull Request: https://projects.blender.org/blender/blender/pulls/144880
2025-08-20 20:53:40 +02:00
Alaska
41d4b945d3 Fix: Missing space in Unbiased volume tooltip
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/144871
2025-08-20 16:51:02 +02:00
Campbell Barton
c45ee0eb98 Cleanup: quiet compiler warnings
Suppressing "null-pointer-subtraction" was needed for clang
but caused a warning with GCC.
2025-08-20 11:18:29 +10:00
Brecht Van Lommel
c7e2368d6c Fix #144528: Cycles renders OpenVDB grids with rotation wrong
Pull Request: https://projects.blender.org/blender/blender/pulls/144825
2025-08-19 21:39:30 +02:00
Brecht Van Lommel
28f93d5443 Fix #144569: Cycles NanoVDB rendering broken with oneAPI
Wrong assumption about packed_int3, and not caught because the assert was in
the wrong place.

Pull Request: https://projects.blender.org/blender/blender/pulls/144803
2025-08-19 18:41:53 +02:00
Brecht Van Lommel
b5606b5634 Fix #144599: Cycles OSL node with external script does not update
Some code got lost in the refactor for OSL cameras.

Pull Request: https://projects.blender.org/blender/blender/pulls/144808
2025-08-19 18:33:37 +02:00
Weizhen Huang
c672aa9ef4 Cleanup: Cycles: Check if background light is enabled in one place.
`world_use_portal` is not needed anymore, now that we always add world
as object (b20b4218d5).
We now check if background light is enabled only in
`test_enabled_lights()`, depending on the sample settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/144710
2025-08-19 15:58:19 +02:00
Weizhen Huang
d866517708 Fix #144639: light missing update because it was disabled
the `light->is_enabled` check was only intended for background light,
for other light types we need to recompute the contribution at each
update.
2025-08-19 15:58:17 +02:00
Weizhen Huang
83dcaf0501 Fix #144610: Cycles: do not convert open volume mesh to sdf
because we can't determine the interior. Sample densities in the whole
bounding box instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/144732
2025-08-19 13:26:11 +02:00
Brecht Van Lommel
f41a0d5ab9 Fix: Cycles OptiX + OSL fails to render images with OSL releases
It works with the beta we are using to build Blender 4.5, but the official
release is a bit different. This fix was tested to work with OSL 1.14.7.

Thanks to Paul Zander for finding the OSL commit that lead to this.

Pull Request: https://projects.blender.org/blender/blender/pulls/144715
2025-08-19 13:22:07 +02:00
Brecht Van Lommel
2615cecf10 Refactor: Cycles: Align log levels with CLOG
WORK -> DEBUG
DEBUG, STATS -> TRACE

Pull Request: https://projects.blender.org/blender/blender/pulls/144490
2025-08-18 20:22:44 +02:00
Brecht Van Lommel
6d6c950750 Fix #144543: Cycles NanoVDB render error with empty volume grid
Thanks to Weizhen for finding the cause.

Pull Request: https://projects.blender.org/blender/blender/pulls/144735
2025-08-18 20:21:44 +02:00
Campbell Barton
ebfa7edeb1 Cleanup: use snake case, replace "m_" prefix with "_" suffix
Follow our own C++ conventions for GHOST.
2025-08-16 16:14:18 +10:00
Jeroen Bakker
f4103acb3f Refactor: Vulkan: Swapchain submission fence
First advance to the next frame and use the same index for all
resources. Previous implementation used a fence of the next frame, what
added confusion why that was actually needed.

Should not make a change in functionality or performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/144615
2025-08-15 13:46:42 +02:00
Campbell Barton
3be9f89ad3 Cleanup: quiet unused warning & correct typo 2025-08-15 18:55:52 +10:00
Jeroen Bakker
1f1098c498 Vulkan: Remove MoltenVK
Blender had some support for using MoltenVK. However there are some key
issues why MotlenVK cannot be used. Bugs have been reported up-stream.
As it doesn't work and holds back regular developments it will be removed
from the main branch.

Any efforts on making Vulkan run on Apple (including KosmicKrisp)
is considered a community effort and can be done in a development
branch.

Pull Request: https://projects.blender.org/blender/blender/pulls/144602
2025-08-15 09:36:38 +02:00
Weizhen Huang
df496eb894 Cycles: use one-tap stochastic interpolation for volume
It has ~1.2x speed-up on CPU and ~1.5x speed-up on GPU (tested on Metal
M2 Ultra).

Individual samples are noisier, but equal time renders are mostly
better.

Note that volume emission renders differently than before.

Pull Request: https://projects.blender.org/blender/blender/pulls/144451
2025-08-14 15:22:44 +02:00
Weizhen Huang
0c371ca3c5 Cycles: use deterministic linear interpolation for velocity
Cubic is too costly, stochastic interpolation is inaccurate.
2025-08-14 15:22:43 +02:00
Jeroen Bakker
7286885789 Vulkan: Update VMA to 3.3.0
Updated to latest release. Has some fixes and a new API for easy
integration with Volk.

Pull Request: https://projects.blender.org/blender/blender/pulls/144434
2025-08-14 13:20:45 +02:00
Nikita Sirgienko
21cba7024c Cycles: oneAPI: Disable L0 copy optimization for several dGPUs
Currently, it was discovered that in the case of several different
Intel dGPUs being present in the system, the experimental L0 copy
optimization does not work correctly in the Intel Driver, which is
causing crashes in the driver and Blender application. So, to avoid
this situation and restore functionality on these platforms,
a workaround was added to disable this extension from being used if
such a configuration is detected. In the future, when this problem is
fully fixed in all Intel Drivers, this workaround can be removed from
the Blender source code to restore some performance that was lost on
configurations of several dGPUs because of this workaround.

Pull Request: https://projects.blender.org/blender/blender/pulls/144262
2025-08-14 12:14:51 +02:00
Sergey Sharybin
3c4e48e8ca Fix: Use of uninitialized variables in Mantaflow
A constructor of the MANTA() constructor is only default-initializing
some of the fields, while initializeRNAMap() access to all of the fields,
causing access to uninitialized variables.

For example, mResXMesh is only initialized within some conditions about
mUsingLiquid and mUsingMesh but is always used to set value in the map.

Additionally fixed re-reference of iterator which equals to end(): the
iterator in such case does not contain value and it should not be accessed.

Pull Request: https://projects.blender.org/blender/blender/pulls/144502
2025-08-14 10:57:27 +02:00
Thomas Dinges
b60ed07236 Cleanup: make format 2025-08-14 07:59:45 +02:00
Campbell Barton
99bcf746a0 Cleanup: remove header added last commit 2025-08-14 15:19:58 +10:00
Campbell Barton
5540b9440a CLI: move VSync from an environment variable to an argument
Add a command line argument --gpu-vsync on/off/auto.

Prefer command line arguments for GPU settings,
as it means the value is error checked and set when Blender starts.

Also refactor GHOST_Context to take a parameter argument which
includes the stereo-visual & debug arguments and includes the newly
added vsync setting. This makes it possible to add GPU context
parameters more easily in the future.

It also removes redundant parsing & setting the VSync setting for
off-screen contexts.

Changes to recent PR !143049.

Ref !144473
2025-08-14 05:16:12 +00:00
Campbell Barton
3198b336e1 GHOST/Wayland: only disable VSync when using the OpenGL backend
Also add a reference to SDL's bug report and some notes.
2025-08-14 01:13:30 +00:00
Weizhen Huang
6eb7075fa1 Fix: Cycles: lcg_state uninitialized before volume density baking
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/144489
2025-08-13 16:10:06 +02:00
Weizhen Huang
d717c78ca4 Revert "Cycles: Store octree parent nodes in a stack"
This reverts commit bccad10b3be75deb0825b9234087e613678af407.
The stack approach seems slower

Pull Request: https://projects.blender.org/blender/blender/pulls/134460
2025-08-13 10:28:53 +02:00
Weizhen Huang
146ac0d9fe Cycles: Store octree parent nodes in a stack 2025-08-13 10:28:50 +02:00
Weizhen Huang
ed48905b41 Cycles: Use analytic formula for homogeneous volume 2025-08-13 10:28:50 +02:00
Weizhen Huang
a4f8e0bfa2 Cycles: Use RGBE for denoised guiding buffers to reduce memory usage
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2025-08-13 10:28:50 +02:00
Weizhen Huang
5cb6014efd Cycles: Volume Scattering Probability Guiding
Guide the probability to scatter in or transmit through the volume.
Only applied for primary rays.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2025-08-13 10:28:50 +02:00
Weizhen Huang
a7283fc1d5 Cycles: Shade volume with null scattering
The distance sampling is mostly based on weighted delta tracking from
[Monte Carlo Methods for Volumetric Light Transport Simulation]
(http://iliyan.com/publications/VolumeSTAR/VolumeSTAR_EG2018.pdf).

The recursive Monte Carlo estimation of the Radiative Transfer Equation is
\[\langle L \rangle=\frac{\bar T(x\rightarrow y)}{\bar p(x\rightarrow
y)}(L_e+\sigma_s L_s + \sigma_n L).\]
where \(\bar T(x\rightarrow y) = e^{-\bar\sigma\Vert x-y\Vert}\) is the
majorant transmittance between points \(x\) and \(y\), \(p(x\rightarrow
y) = \bar\sigma e^{-\bar\sigma\Vert x-y\Vert}\) is the probability of
sampling point \(y\) from point \(x\) following exponential
distribution.

At each recursive step, we randomly pick one of the two events
proportional to their weights:
* If \(\xi < \frac{\sigma_s}{\sigma_s+\vert\sigma_n\vert}\), we sample
scatter event and evaluate \(L_s\).
* Otherwise, no real collision happens and we continue the recursive
process.

The emission \(L_e\) is evaluated at each step.

This also removes some unused volume settings from the UI:

* "Max Steps" is removed, because the step size is automatically specified
by the volume octree. There is a hard-coded threshold `VOLUME_MAX_STEPS`
to prevent numerical issues.
* "Homogeneous" is automatically detected during density evaluation

An option "Unbiased" is added to the UI. When enabled, densities above
the majorant are clamped.
2025-08-13 10:28:50 +02:00
Weizhen Huang
8c36f9ce49 Cycles: Compute volume transmittance using telescoping 2025-08-13 10:28:50 +02:00
Weizhen Huang
b2b2d9a4f3 Cycles: Render volume by ray marching through octrees
One octree per volume per shader based on the density. In preparation
for the null scattering
2025-08-13 10:28:50 +02:00
Weizhen Huang
4e65ab4490 Cycles: Create one box for vdb mesh instead of many
Due to numerical issues this was creating many wrong self-overlapping.
It was necessary for skipping empty regions, but not any more with the
volume Octree approach
2025-08-13 10:28:50 +02:00
Weizhen Huang
b20b4218d5 Cycles: Always add world as object
but only enable the light when the world is used for NEE.

World object index will be needed for volume stack.
2025-08-13 10:28:50 +02:00
Weizhen Huang
c0843f0649 Cleanup: Cycles: remove unused function 2025-08-13 10:28:50 +02:00
Weizhen Huang
872528814e Cycles: do not sample direct light when ray segment is invalid
Since we sample the same light for distance sampling and equiangular
sampling, the sample is invalid anyway, so just avoid sampling direct
light for distance sampling too.
2025-08-13 10:28:50 +02:00
Jesse Yurkovich
0240a1f32f Cleanup: CMake: Modernize bf_intern_openvdb dependencies
This follows the other CMake "modernization" commits, this time for
`bf_intern_openvdb` and the OpenVDB dependency itself.

The difference with this one is that `intern/openvdb` becomes an
"optional" dependency itself. This is because downstream consumers often
want to include this dependency rather than openvdb directly, so this
target must also be optional. Optional, in this case, means the target
always exists but may be entirely empty.

Summary
- If you are using BKE APIs to access openvdb features, then use the
  `bf::blenkernel` target
- If you are only using `intern/openvdb` APIs then use the
  `bf::intern::optional::openvdb` target (rare)
- For all other cases, use the `bf::dependencies::optional::openvdb`
  target (rare)

context: https://devtalk.blender.org/t/cmake-cleanup/30260
Pull Request: https://projects.blender.org/blender/blender/pulls/137071
2025-08-12 21:26:38 +02:00
Miguel Pozo
7169a39b79 Fix: GPU Tests on Windows
Use RAII for `GHOST_WindowClass`.

For the main Blender executable, only one `GHOST_System` is ever
created. But when running tests, this can happen multiple times (eg,
GPUOpenGLTest and GPUOpenGLWorkaroundsTest).
This results in `GHOST_SystemWin32` trying to register
`GHOST_WindowClass` multiple times, so `RegisterClassW` fails with
`ERROR_CLASS_ALREADY_EXISTS`.

Pull Request: https://projects.blender.org/blender/blender/pulls/144231
2025-08-12 15:20:01 +02:00
Clément Foucault
cae6c6d81a GPU: Remove Shader Draw Parameter workaround
With 5.0 we start requiring this extension for GL and VK.
All of our target hardware supports it with up to date
drivers.

Some old drivers were disabling this extension because of
buggy behavior. We simply drop support for them in 5.0.

This allows us to remove a lot of code and the last
shader create info override done at startup. This will
unlock more refactoring of the shader create info into
static classes to reduce binary size and other benefits.

## TODO:
- [x] Remove checks for ARB_shader_draw_parameters
- [x] Remove checks for ARB_clip_control
- [x] Check for the extension on startup for OpenGL
- [x] Check for the extension on startup for Vulkan
- [x] ~~Add user facing popup message about minimum
      requirements not being met.~~ Done using the same
      popup as old hardware.

Pull Request: https://projects.blender.org/blender/blender/pulls/142334
2025-08-12 14:04:41 +02:00
Jeroen Bakker
42c3f35780 Vulkan: Swap to system memory for device local memory
This PR will swap device local memory to system ram. It relies on
VK_EXT_external_memory and VK_EXT_pageable_device_local_memory
extensions to be supported by the system.

Most platforms support these extensions.

Pull Request: https://projects.blender.org/blender/blender/pulls/144422
2025-08-12 11:51:40 +02:00
Campbell Barton
66803e4441 Cleanup: use function style casts 2025-08-12 02:46:51 +00:00
Campbell Barton
729b76f454 Cleanup: use str.format to format strings in Python
Also replace redundant `{!s}` with `{:s}`.
2025-08-12 10:21:38 +10:00
Campbell Barton
c00dfded27 Cleanup: consistently hyphenate the term "swap-chain" 2025-08-12 10:12:19 +10:00
Campbell Barton
ab1027c777 Cleanup: capitalization of the term "VSync"
Follow the convention widely used by AMD/Intel/Nvidia.
2025-08-12 10:03:28 +10:00
Brecht Van Lommel
dce6269d1f Fix #143714: Cycles OptiX fails to render linear and ribbon curves together
This case was not accounted for previously, but is now possible when
the new curves object has curves with type poly.

Pull Request: https://projects.blender.org/blender/blender/pulls/144087
2025-08-11 19:36:26 +02:00