9508 Commits

Author SHA1 Message Date
Brecht Van Lommel
aab29c1ba6 Merge branch 'blender-v5.0-release' 2025-10-17 16:42:22 +02:00
Brecht Van Lommel
acb20247a5 Cycles: Remove HIP-RT stability warning now that this has been fixed
Ref #147247
2025-10-17 16:33:27 +02:00
salipour
b491002a9d Fix: Cyles HIP-RT random crashes editing the scene
Perform delayed freeing of the geometry BVHs similar to OptiX.

Previously BLAS memory was allocated in the device class as part of
device_update, but released in the BVHHIPRT destructor which gets called
when deleting geometry outside of device_update.

To avoid the GPU accessing unmapped memory, do a delayed free of this
memory in the device class as part of either device_update or device
destruction. This ensures it is in sync with other device memory changes.

Fix #148276
Fix #139013
Fix #138043
Fix #140763

Pull Request: https://projects.blender.org/blender/blender/pulls/147247
2025-10-17 16:32:23 +02:00
Jonas Holzman
77d508564a Merge branch 'blender-v5.0-release' 2025-10-16 20:30:07 +02:00
Jonas Holzman
8b6a0f677f Fix: Stack-buffer-overflow when running the "Save System Info" operator
The Cycles cpu/device.cpp `device_cpu_capabilities()` function used to
fill out a string of supported CPU capabilities separated with spaces,
with some trailing-space cleaning logic at the end of the function.

However, if no check succeeded, and especially after commit 2bf6d0fd71
which left only one check and removed the need for removing trailing
spaces, the check would run against an empty string, resulting in an
unsigned 0 - 1 operation which would then cause an out of bound access
catched by ASan.

Fixed by removing the now superflous trailing space cleaning logic and
simplifying to a direct return.

Pull Request: https://projects.blender.org/blender/blender/pulls/148227
2025-10-16 20:24:38 +02:00
Brecht Van Lommel
ab7c817509 Merge branch 'blender-v5.0-release' 2025-10-16 18:03:58 +02:00
Brecht Van Lommel
74b7d663e1 Build: Avoid excessive number of threads with CUDA split compile
Only use this feature when building for 1 or 2 CUDA architectures.
Otherwise CMake will build the binaries in parallel, and NVCC will then
also launch multiple threads for each binary.

We could add more manual control for this, but the main use case for
this is local builds and an automatic heuristic seems more likely to
help than an option that developers or users might not discover.

For minimal memory usage WITH_CYCLES_CUDA_BUILD_SERIAL still exists
to use only 1 thread for CUDA compilation.

Pull Request: https://projects.blender.org/blender/blender/pulls/147303
2025-10-16 18:00:39 +02:00
Brecht Van Lommel
6e96f1cca8 Fix: Cycles HIP shadow transparency bugs after recent changes
Just tweaking code to sidestep the apparently compiler bug.

This introduces a performance regression, which we'll fix in
another PR.

Ref #147989

Pull Request: https://projects.blender.org/blender/blender/pulls/148155
2025-10-16 17:59:00 +02:00
Lukas Stockner
ae7226d0a7 Merge branch 'blender-v5.0-release' 2025-10-16 15:39:28 +02:00
Damien Picard
0a0d3678a6 Cycles: OSL Camera: Use title case for parameters in the UI
This is an alternate solution to !146889 to improve labels in the
camera UI, while being much less invasive. It doesn't take custom
labels into account, but it simply uses the parameter names with title
case.

Pull Request: https://projects.blender.org/blender/blender/pulls/148141
2025-10-16 15:38:59 +02:00
u3dreal
b597c0f1ed Fix: Cycles: IES interpolation artifacts at angular boundaries
Fixes artifacts in IES data interpolation where edge samples (e.g., v == 0 or
h_i == h_num-1) were clamped to 0.0f instead of valid intensity values.
2025-10-16 15:38:38 +02:00
Lukas Tönne
443ced685e Merge branch 'blender-v5.0-release' 2025-10-16 12:15:44 +02:00
Michael Jones
5c3a6745a2 Cycles: Forward compatibility for Metal "FastIntersection" flag
Follow on from PR #141891. The `MTLAccelerationStructureUsagePreferFastIntersection` flag didn't exist until Xcode 26.0, so we ensure that it is defined for forward-compatibility. The runtime `if (@available(macos 26.0, *))` checks still remain.

Pull Request: https://projects.blender.org/blender/blender/pulls/147561
2025-10-16 11:50:28 +02:00
Weizhen Huang
82892b6f08 Merge branch 'blender-v5.0-release' 2025-10-15 11:24:11 +02:00
weizhen
6c241737e8 Fix: Cycles volume performance issue on Nvidia
Pass by value instead of reference partially fixes the performance issue
mentioned in #147921

Pull Request: https://projects.blender.org/blender/blender/pulls/147989
2025-10-15 11:23:52 +02:00
Xavier Hallade
3753c70b9c Cycles: Use LIB to pass Windows SDK libraries paths to oneAPI compiler
Related to https://projects.blender.org/blender/blender/pulls/147994 in
which clang-cl builds failed passing the Windows SDK libraries paths to
the compiler.

The previous CMake implementation tried to reverse engineer these paths
at CMake configuration time but failed with `clang-cl`.

The environment variables set by vcvars that could have been useful
aren't always available when cmake is called, so now we keep the `LIB`
environment variable intact at compile time and pass the other
additional compiler libraries paths - that are better defined at CMake
configuration time - separately through `-L` compiler arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/148035
2025-10-14 18:36:37 +02:00
Hans Goudey
1d372bdc8b Refactor: Split CustomData attribute and newer attribute headers
Avoid including DNA_customdata_types.h everywhere we include the
attributes header. Over time the older attribute header should be
used less and less.

Part of #122398

Pull Request: https://projects.blender.org/blender/blender/pulls/147980
2025-10-13 15:38:26 +02:00
Lukas Stockner
5af14bb572 Merge branch 'blender-v5.0-release' 2025-10-13 15:10:13 +02:00
Raimund Klink
30fd6537b9 Cycles: Disable the render time pass for GPU
Also, extend the description in the UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/147054
2025-10-13 15:09:40 +02:00
Sergey Sharybin
ea6a97113b Merge branch 'blender-v5.0-release' 2025-10-13 14:40:41 +02:00
Alaska
de16ed4e8c Cycles: Improve performance on uneven GPU renders
When a Cycles render is uneven (E.g. a small portion of the image takes
significantly longer to render than the rest of the image), then GPUs
typically suffer from poor performance due to low occupancy unless a
large number of samples is scheduled to compensate for that small
complex region.

Due to how Cycles render scheduler is setup, Cycles tries to
increase GPU occupancy by increasing the number of scheduled samples,
but also balance render preview update time by scaling back
the number of scheduled samples based on the previous workloads time
per sample to try and fit within the target update time.

However using the previous workloads time per sample to scale back the
scheduled number of samples gives suboptimal results because the
previous workloads time per sample is usually not representative of the
new time per sample that occurs as GPU occupancy increases, because
increasing GPU occupancy typically results in reduced time per samples.

This commit improves on this issue by assuming that increasing GPU
occupancy linearly improves performance, and adjusts the function
that scales back the sample count to fit within a specific update
window to use this assumption. This leads to Cycles increasing the
amount of work scheduled onto the GPU quicker at the beginning of
uneven/low occupancy scenes, generally leading to improved performance,
especially when rendering at low sample counts or with strict
time limits.

Ref #147954

Pull Request: https://projects.blender.org/blender/blender/pulls/147950
2025-10-13 14:40:01 +02:00
Weizhen Huang
b4cd23d0fe Merge branch 'blender-v5.0-release' 2025-10-13 12:15:33 +02:00
Weizhen Huang
0b0ea916ff Fix #147846: Cycles: Viewport not updating when changing global step rate
Should also update when the global multiplier changes

Pull Request: https://projects.blender.org/blender/blender/pulls/147968
2025-10-13 12:14:48 +02:00
Damien Picard
9d0266280f Cycles: OSL Camera: Allow mm as parameter unit, use as cam distance
Commit 6c6d1a9b63 allowed several units to OSL camera shaders'
parameters. Only meters 'm' were supported as distance units, because
others cannot be converted automatically into the shader' unit.

This commit allows using 'mm' in addition to 'm', and makes the
Blender property use a 'DISTANCE_CAMERA' subtype. This assumes that
someone using 'mm' specifically wants to use the value for camera
parameters, which means it can be used as is, without any conversion
in the shader.

The camera templates were updated to use a focal length in mm.

Pull Request: https://projects.blender.org/blender/blender/pulls/147347
2025-10-13 02:52:16 +02:00
Damien Picard
a2f94ab1ad Fix #147062: OSL Camera: Aperture size depends on focal length
In OSL custom cameras, the current aperture size depends on the focal
length of the Blender camera, even though it is not usable by the
shader. This gives incoherent values to the depth of field.

To ignore this factor, this commit makes the custom camera behave the
same as the orthographic camera, by not being multiplied by the focal
length.

To compensate for that, the multiplication must happen inside the
shader. This adjustment was done in the advanced camera shader
template.

Pull Request: https://projects.blender.org/blender/blender/pulls/147346
2025-10-13 00:23:25 +02:00
Nikita Sirgienko
38adb8f1a4 Cycles: oneAPI: Fix duplicated GPU device entries on some setups
In some hardware configurations, it is possible that DPC++ or
Intel Drivers wrongfully report all devices twice. It is already
being worked on internally, and the fixes will be available in
the future - but for now, we need a workaround for this problem
in Blender as well, to ensure that our end-users are not impacted.

Pull Request: https://projects.blender.org/blender/blender/pulls/147731
2025-10-10 17:25:29 +02:00
Patrick Mours
b168a833af Cycles: Fix OptiX context log no longer showing up
Commit 8392ca915b removed
WITH_CYCLES_LOGGING, but missed that the OptiX context log was
conditionally compiled depending on that definition, so this fixes
that.

Pull Request: https://projects.blender.org/blender/blender/pulls/147706
2025-10-10 13:15:23 +02:00
Damien Picard
7ec15a3a98 I18n: Use rpt_ instead of tip_ to translate reports
This was the case in:
- FBX add-on
- Cycles OSL
2025-10-09 12:09:56 +02:00
Nikita Sirgienko
b133019f9f Cycles: oneAPI: use ocloc 101.8132 on Windows
This new version of the graphics compiler improves performance
for the majority of supported Intel devices and adds support
for upcoming Intel hardware. Such an upgrade also requires
an increase in the minimal supported driver version on Windows,
which is why these changes are combined together with
the ocloc upgrade.

Previously set minimal version 101.6557 was increased to 101.8132.

Pull Request: https://projects.blender.org/blender/blender/pulls/147460
2025-10-08 13:36:08 +02:00
Campbell Barton
01806a62e3 Cleanup: spelling (make check_spelling_*) 2025-10-07 10:19:46 +11:00
Nikita Sirgienko
c07454a3d7 Cycles: oneAPI: Update UI about minimal driver version on Linux
These changes are already in place de facto, as the check for
the minimal driver version in the Blender code was already
updated. This commit simply adds the UI update, which I
initially forgot to perform.

Pull Request: https://projects.blender.org/blender/blender/pulls/147459
2025-10-06 20:44:20 +02:00
Christoph Neuhauser
72f098248d Cycles: Add Vulkan/oneAPI graphics interop
This PR adds Vulkan/oneAPI graphics interop to Cycles. Just like for
CUDA and HIP interop, persistent memory mapping is used, as there could
potentially be some overhead of continuously mapping/unmapping buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/144442
2025-10-06 18:16:56 +02:00
Sean Stirling
e12ddede24 Cycles: Disable jumptablerdata cxx option for ARM64 devices compiled with MSVC.
This change disables an x64 specific flag for ARM64 devices when compiling with MSVC.

Pull Request: https://projects.blender.org/blender/blender/pulls/147276
2025-10-06 17:10:08 +02:00
Nikita Sirgienko
49414a72f6 Cycles: oneAPI: Add new arch codes for upcoming Intel hardware
Pull Request: https://projects.blender.org/blender/blender/pulls/147221
2025-10-04 22:34:54 +02:00
Hans Goudey
a68d39e9d9 Cleanup: Formatting
Run `make format` after the library update in the previous commit.
2025-10-02 12:55:42 -04:00
Thomas Dinges
66224d69b0 Deps: Library changes for Blender 5.0
This commit includes the changes to the build system, updated hashes to the actual new libraries as well as a required test update.

* DPC++ 6.2.0 RC
* freetype 2.13.3
* HIP 6.4.5010
* IGC 2.16.0
* ISPC 1.28.0
* libharu  2.4.5
* libpng 1.6.50
* libvpx 1.15.2
* libxml2 2.14.5
* LLVM 20.1.8
* Manifold 3.2.1
* MaterialX 1.39.3
* OpenColorIO 2.4.2
* openexr 3.3.5
* OpenImageIO 3.0.9.1
* openjpeg 2.5.3
* OpenShadingLanguage 1.14.7.0
* openssl 3.5.2
* Python 3.11.13
* Rubber Band 4.0.0
* ShaderC 2025.3
* sqlite 3.50.4
* USD 25.08
* Wayland 1.24.0

Ref #138940

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Co-authored-by: Kace <lakacey03@gmail.com>
Co-authored-by: Sebastian Parborg <sebastian@blender.org>
Co-authored-by: Anthony Roberts <anthony.roberts@linaro.org>
Co-authored-by: Jonas Holzman <jonas@holzman.fr>

Pull Request: https://projects.blender.org/blender/blender/pulls/144479
2025-10-02 18:34:11 +02:00
Stefan Werner
083aad8a45 Cycles: Specialization constants for Embree/SYCL
Making heavier use of specialization constants in SYCL for Embree.
This reduces code size of the intersection kernels and bring
performance improvement up to 9% in some scenes on
Intel GPUs.

Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/141559
2025-10-02 16:44:24 +02:00
Weizhen Huang
04166ea0ea Cycles: support printf in Metal 15.0
For metal version after 3.2 it's possible to log debugging messages, it
works similar to `printf()`, except for a few differences:
- `%s` is not supported,
- `double` doesn't exist, so no casting to double for `%f`,
- no `\n` needed at the end of the format string.

To see the print in the console, environment variables `MTL_LOG_LEVEL`
should be set to `MTLLogLevelDebug`, and `MTL_LOG_TO_STDERR` should be
set to `1`. See
https://developer.apple.com/documentation/metal/logging-shader-debug-messages

Right now `printf()`, `print_float()`, `print_float2()`,
`print_float3()` and `print_float4()` are supported.

Thanks to @fclem for finding this out.

Pull Request: https://projects.blender.org/blender/blender/pulls/146585
2025-10-01 14:25:44 +02:00
Brecht Van Lommel
b92c96e39b Cleanup: Compiler warnings when building without fluids or openvdb
Pull Request: https://projects.blender.org/blender/blender/pulls/146996
2025-09-30 14:02:16 +02:00
marcopavanello
390f053e32 Fix #146630: Single Scattering Sky has darker pixels near horizon
Store the ground fading of Single Scattering sky directly in the LUT.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/146659
2025-09-29 20:56:32 +02:00
Lukas Stockner
fc5c6ab374 Fix #146223: Cycles: Wrong output with multi-device OSL rendering
We used to set shader->osl_surface_ref during shader compilation and then
pushed it into the shared vectors.

This worked as long as everything was serial - but after the multithreading
change, we a) compile everything and then b) build the shared vectors since
just pushing into them from multiple threads would not work.

However, if there are multiple devices, then each shader will be compiled
multiple times - so in the end, shader->osl_surface_ref etc. will be set
to the last device's value. Then, we end up pushing that value into every
device's vectors, which breaks for the earler devices.

The fix is simple - just preallocate the vectors and pass the correct index
into the compilation function. This way, each thread can safely store its
result and we can get rid of shader->osl_surface_ref entirely.

Note that while multiple shaders are compiled in parallel, the loop over
devices for a given shader is serial, so there's no concern of conflicts
over other shader internals.

Pull Request: https://projects.blender.org/blender/blender/pulls/146617
2025-09-29 03:12:18 +02:00
Amogh Shivaram
2bd06093c7 Cycles: Thin film iridescence for metals
Applies thin film iridescence to metals in Metallic BSDF and Principled BSDF.

To get the complex IOR values for each spectral band from F82 Tint colors,
the code uses the parametrization from "Artist Friendly Metallic Fresnel",
where the g parameter is set to F82. This IOR is used to find the phase shift,
but reflectance is still calculated with the F82 Tint formula after adjusting
F0 for the film's IOR.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Co-authored-by: Weizhen Huang <weizhen@blender.org>
Co-authored-by: RobertMoerland <rmoerlandrj@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/141131
2025-09-29 02:58:20 +02:00
Damien Picard
6c6d1a9b63 Cycles: OSL Camera: Improve Property UI
This expands Cycles' support for handling OSL property metadata for
Custom camera parameters and translating it to Blender's UI.

Specifically, it adds support for:
- Translation inputs (`string vecsemantics = "POINT"`)
- Normal inputs (`string vecsemantics = "NORMAL"`)
- File inputs (`string widget = "filename"`)
- Angle inputs (`string unit = "radians"`)
- Distance inputs (`string unit = "m"`)
- Time inputs (`string unit = "s"` or `string unit = "sec"`)
- Enum inputs (`string widget = "mapper", string options = "left:0|right:1"`)

It also sets the default value correctly, and corrects a warning string to
also mention cameras in addition to nodes as possible users of OSL shaders.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/146736
2025-09-29 02:20:23 +02:00
Nikita Sirgienko
d36eea7fa7 Fix #129596: Always use multithreaded BVH building in Cycles again
The workaround of forcing BVH building into single thread
execution on the Blender side is not needed anymore,
because the problem was properly fixed in the upstream
since Embree upgrade in Blender 4.5

This reverts commit c0f0e2ca6f.

Pull Request: https://projects.blender.org/blender/blender/pulls/146859
2025-09-27 21:07:39 +02:00
Weizhen Huang
2b0a1cae06 Cycles: Add an option to use ray marching for volume rendering
Null Scattering currently has performance and noise issues, and it will
take time to address them. For now add the previous Ray Marching back as
an option.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/146317
2025-09-26 12:14:45 +02:00
Brecht Van Lommel
78ae7ec392 Render: Rename render passes for clarity
In very old OpenEXR version there was a limit on the channel names, which meant
the pass names needed to be short like "DiffDir". Change them to be longer like
"Diffuse Direct".

* This breaks forward compatibility. Old Blender version will lose links when
  reading compositing node setups with such passes, but #146571 will fix it
  for 4.5 LTS.
* Add-ons, scripts and compositing setups in other applications that rely on these
  names will also break.
* The find_by_type function for render passes has also been removed, as this was
  already deprecated and replaced by find_by_name.
* We assume spaces in the name are ok, since we have passes with them already
  and have not seen reports about compatibility issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/142731
2025-09-25 18:04:14 +02:00
Brecht Van Lommel
57342a51f8 Fix: Cycles: Ubsan warnings with new voronoi texture hashing
Signed integer overflow is undefined, but works reliably enough for us
anyway, so just silence it like the Blender implementation already does.

This also caused some tests like cycles_displacement_cpu to run much slower
(3s -> 42s) due to the overhead of detecting and ignoring repeated warnings.

Pull Request: https://projects.blender.org/blender/blender/pulls/146783
2025-09-25 17:48:22 +02:00
Brecht Van Lommel
689f182792 Cycles: Make adaptive subdivision a non-experimental feature
* Add adaptive subdivision properties natively on the subdivision surface
  modifier, so that other engines may reuse them in the future. This also
  resolve issues where they would not get copied properly.
* Remove "Feature Set" option in the render properties, this was the last
  experimental one.
* Add space choice between "Pixel" and "Object". The latter is new and can
  be used for object space dicing that works with instances. Instead of
  a pixel size an object space edge length is specified.
* Add object space subdivision test.

Ref #53901

Pull Request: https://projects.blender.org/blender/blender/pulls/146723
2025-09-25 16:18:50 +02:00
Michael Jones
a14fe128fc Fix: Cycles: MetalRT motion curves setup bug
MTLAccelerationStructureMotionCurveGeometryDescriptor.controlPointCount should specify the per-step control point count. Although the previous initialisation wasn't manifesting as incorrect behaviour it was technically wrong.

Pull Request: https://projects.blender.org/blender/blender/pulls/146568
2025-09-23 12:19:44 +02:00
Weizhen Huang
8d6b935466 Fix #144711: Cycles: rescale throughput when density is above the majorant
The one-sample Monte Carlo estimator of the radiative transfer equation
is
       <L> = T(t) / p(t) * (L_e + σ_s * L_s + σ_n * L),
Which means we can also use another p(t) than majorant * exp(-majorant * t)
for sampling the distance. Thus, we use the baked σ_max for distance
sampling, but adjust the majorant when we encounter a density that is
larger than σ_max.

Note that this is not really unbiased because such scaling is not always
applied, but seems to work well in practice when the majorant is
reasonable.

Pull Request: https://projects.blender.org/blender/blender/pulls/146589
2025-09-23 11:17:19 +02:00