Commit Graph

3420 Commits

Author SHA1 Message Date
Brecht Van Lommel
d015e98ee6 Fix Cycles ASAN error with boolean kernel arguments 2023-12-12 13:27:36 +01:00
Campbell Barton
dc2d7a4707 License headers: conform copyright to SPDX 2023-12-12 13:03:26 +11:00
Brecht Van Lommel
f9d69da432 Build: remove Cycles build options to disable RTTI
This was required for OSL, which used to be compiled entirely without
RTTI for LLVM. However OSL now only compiles a private part of its code
without RTTI, so this no longer necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/116035
2023-12-11 14:42:51 +01:00
Brecht Van Lommel
6cdb43195e Refactor: replace NanoVDB kernel side implementation by own code
The NanoVDB headers are not compatible with Metal due to missing address
space qualifiers. We currently have a big patch for NanoVDB header
files, which is difficult to update for OpenVDB 11. Instead extract a
few hundred lines of code from NanoVDB to do just what we need.

Pull Request: https://projects.blender.org/blender/blender/pulls/115992
2023-12-10 19:37:36 +01:00
Brecht Van Lommel
8ba474dc4f Refactor: replace NanoVDB SampleFromVoxels by own code
This makes the GPU tricubic implementation more efficient. The dense
grid code implemented this in terms of trilinear lookups that are
hardware accelerated, but for NanoVDB this just causes unnecessary voxel
reads. Instead match the CPU code.

Pull Request: https://projects.blender.org/blender/blender/pulls/115992
2023-12-10 19:37:36 +01:00
Brecht Van Lommel
798a0b301e Cycles: update OSL to work with version 1.13.5
This keeps compatibility with older stable versions, but not
older unreleased versions in the 1.13.x series.

Ref #113157

Pull Request: https://projects.blender.org/blender/blender/pulls/116004
2023-12-10 17:08:47 +01:00
Brecht Van Lommel
1c50dd8bb8 Revert "Fix: Cycles: inconsistent normal checks when sampling and evaluating BSDF"
While this code is suspect, better to go back to the old state for now,
as there is no simple fix that doesn't introduce other issues.

Fix #115022
Fix #115414

This reverts commit 063a9e8964.
2023-11-27 17:01:59 +01:00
Brecht Van Lommel
3475ddce46 Fix #115424: Cycles object space normal map wrong with backfaces 2023-11-27 17:01:59 +01:00
Alaska
59a1148ac0 Fix #115206: Sheen renders incorrectly when viewed head on
Fixes an issue where the sheen would render incorrectly when
the normal of the surface is parallel to the incoming direction.

Co-authored-by: Lukas Stockner <lukas.stockner@freenet.de>

Pull Request: https://projects.blender.org/blender/blender/pulls/115286
2023-11-27 11:34:02 +01:00
Campbell Barton
1eff48a838 Cleanup: spelling in code 2023-11-27 10:55:39 +11:00
Campbell Barton
27c660707d Cleanup: spelling in comments, variables 2023-11-27 09:54:36 +11:00
Sergey Sharybin
6207b83194 Revert "CMake: Give kernel compilation targets access to console"
The side effect which wasn't that obvious from the documentation
is that tasks in the console pool are executed sequentially. This
made the compile-gpu step to take a long time, because the parallel
compilation got disabled.

That was unintended change, so reverting the change.

Instead, for the buildbot, increase the time limit for the step.

This reverts commit 4b891b4afe.
2023-11-22 15:18:12 +01:00
Brecht Van Lommel
8845dba79d Fix Cycles rare assert in ensure_valid_specular_reflection
When the incoming direction is exactly orthogonal to the normal

Ref #115071
2023-11-21 18:39:56 +01:00
Stefan Werner
02b5e27f89 Cycles: Add Intel GPU support for OpenImageDenoise
OpenImageDenoise V2 comes with GPU support for various backends. This adds a new class, OIDNDenoiserGPU, in order to add this functionality into the existing Cycles post processing pipeline without having to change it much. OptiX and OIDN CPU denoising remain as they are. Rendering on a supported Intel GPU will automatically select the GPU denoiser.

Device support is initially limited to the oneAPI devices that are supported by Cycles, but can be extended.

Ref #115045

Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/108314
2023-11-20 11:12:41 +01:00
Hoshinova
0b11c591ec Nodes: Merge Musgrave node into Noise node
This path merges the Musgrave and Noise Texture nodes into a single
combined Noise Texture node. The reasoning is that both nodes
intrinsically do the same thing, which is the layering of Perlin noise
derivatives to produce fractal noise. So the patch de-duplicates code
and unifies the use of fractal noise for the end use.

Since the Noise node had a Distortion input and a Color output, while
the Musgrave node did not, those are now available to the Musgrave types
as new functionalities.

The Dimension input of the Musgrave node is analogous to the Roughness
input of the Noise node, so both inputs were unified to follow the same
behavior of the Roughness input, which is arguable more intuitive to
control. Similarly, the Detail input was slightly different across both
nodes, since the Noise node evaluated one extra layer of noise. This was
also unified to follow the behavior of the Noise node.

The patch, coincidentally fixes an unreported bug causing repeated
output for certain noise types and another floating precision bug
#112180.

The versioning code implemented with this patch ensures backward
compatibility for both the Musgrave and Noise Texture nodes. When
opening older Blender files in Blender 4.1 the output of both nodes are
guaranteed to always be exactly identical to that of Blender files
created before the nodes were merged in all cases.

Forward compatibility with Blender 4.0 is implemented by #114236.
Forward compatibility with Blender 3.6 LTS is implemented by #115015.

Pull Request: #111187
2023-11-18 09:40:44 +01:00
Brecht Van Lommel
7b26c3d517 Merge branch 'blender-v4.0-release' into main 2023-11-09 18:24:05 +01:00
salipourto
13171183fa Fix Cycles HIP RT issues with deformation motion blur
The first problem was triangles with motion blur were all grouped into
one category without separating the ones with and without triangle
motion steps.

The second problem was HIP RT uses the generic motion triangle
intersection function and this function checks prim_visibility buffer.
HIP RT doesn't provide the buffer per primitive but passes it to HIP RT
core per instance.

The buffer name was changed to prim_visibility from visibility to be
the same as what Cycles uses but when the motion triangle intersection
function is called from HIP RT kernels, the instance id is passed to
the function instead of primitive id.

Pull Request: https://projects.blender.org/blender/blender/pulls/114555
2023-11-09 18:22:59 +01:00
Campbell Barton
58ea0e051f Cleanup: spelling in comments 2023-11-09 09:54:28 +11:00
Campbell Barton
6bba008325 Cleanup: format 2023-11-09 09:34:49 +11:00
Michael Jones
051ce95628 Cycles: Use Metal Program Scope Global Built-ins on macOS >= 14.0
This PR simplifies the kernel entrypoints by using [Metal Program Scope Global Built-ins](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf) when available (macOS >= 14.0).

Pull Request: https://projects.blender.org/blender/blender/pulls/114535
2023-11-07 11:20:16 +01:00
Campbell Barton
2b508f7ae3 Cleanup: cmake indentation 2023-11-04 16:41:18 +11:00
Sergey Sharybin
317ee3b6ea Merge branch 'blender-v4.0-release' 2023-10-31 17:29:41 +01:00
Sergey Sharybin
4b891b4afe CMake: Give kernel compilation targets access to console
Done by passing USES_TERMINAL to the add_custom_command().

This allows to see sub-command messages early on, before they
are finished executing.

This should help buildbots to "see" that the kernels are still
being compiled and not kill the build because it did not output
anything in a long time.

Pull Request: https://projects.blender.org/blender/blender/pulls/114327
2023-10-31 17:29:03 +01:00
Lukas Stockner
d15013b583 Merge branch 'blender-v4.0-release' 2023-10-31 05:48:58 +01:00
Alaska
a15f9e49ec Shader: Only clamp undefined or unsupported inputs of Principled BSDF
Adjust clamping of inputs in the Principled BSDF to avoid errors and
inconsistencies between render engines, while trying to leave as many
inputs as possible unclamped for artisitc purposes.

Pull Request: https://projects.blender.org/blender/blender/pulls/112895
2023-10-31 03:14:04 +01:00
Brecht Van Lommel
39107b3133 Revert changes from main commits that were merged into blender-v4.0-release
The last good commit was 8474716abb.

After this commits from main were pushed to blender-v4.0-release. These are
being reverted.

Commits a4880576dc from to b26f176d1a that happend afterwards were meant for
4.0, and their contents is preserved.
2023-10-30 21:40:35 +01:00
Campbell Barton
d31c61edee Cleanup: spelling in comments 2023-10-27 12:13:48 +11:00
Campbell Barton
49218f531a Cleanup: format 2023-10-20 14:20:45 +11:00
Campbell Barton
ce7444fa50 Merge branch 'blender-v4.0-release' 2023-10-20 14:00:36 +11:00
Alaska
686aece797 Shader: Adjust Coat Tint Color intensity based on Coat Weight
The previous formula for adjusting Coat Tint intensity resulted
in strong tints and sudden colour changes when using a low coat weight.

This commit fixes these issues by mixing between a white tint (no tint)
and the chosen tint based on the Coat Weight.

Pull Request: https://projects.blender.org/blender/blender/pulls/113468
2023-10-20 00:34:24 +02:00
Lukas Stockner
173ba71b6b Merge branch 'blender-v4.0-release' 2023-10-19 13:26:22 +02:00
Lukas Stockner
c71e18054c Fix: Cycles: Non-physical layering weights can lead to negative closures 2023-10-19 13:13:48 +02:00
Brecht Van Lommel
813f04d704 Merge branch 'blender-v4.0-release' into main 2023-10-18 22:17:56 +02:00
Brecht Van Lommel
e11f031d62 Fix performance regression on Metal/AMD due to new BSDFs
The increased amount of BSDF code from Principled BSDF v2 and the
microfacet BSDF led to a big performance regression on Metal and AMD.
We have not been able to find a good workaround for all scenes.

This change disables the Principled Hair BSDF code when it is not used
in the scene. This makes common benchmark scenes faster, but
performance is still bad in scenes that do use it.

Ref #112596

Pull Request: https://projects.blender.org/blender/blender/pulls/113904
2023-10-18 22:17:05 +02:00
Campbell Barton
b8ad624006 Cleanup: use doxygen doc-strings, spelling in comments 2023-10-12 09:26:53 +11:00
Brecht Van Lommel
59f8712040 Merge branch 'blender-v4.0-release' into main 2023-10-11 21:14:05 +02:00
Brecht Van Lommel
09046e8121 Fix #113461: Cycles subsurface artifacts with volume interior
Ignore self for the volume stack update from the the subsurface entry to
the exit point. This was meant for other objects only.
2023-10-11 21:13:28 +02:00
Brecht Van Lommel
5baf173609 Fix #113527: Cycles OSL crash with empty closure for layering 2023-10-11 21:12:57 +02:00
Alaska
4f5e684e24 Fix Cycles OSL geometry node point cloud inconsistency
Update the OSL script for the "Geometry" node to follow the correct
Tangent code path when working with point clouds.

There should be no functional change for the end user since the correct
code path was already taken by accident.

Pull Request: https://projects.blender.org/blender/blender/pulls/113472
2023-10-11 21:05:41 +02:00
Xavier Hallade
5aed85dcd7 Cycles: oneAPI: query graphics compiler for supported targets
In case a target isn't supported by the graphics compiler, it will be
filtered out from the target architectures to build for.

Pull Request: https://projects.blender.org/blender/blender/pulls/112669
2023-10-11 18:19:48 +02:00
Xavier Hallade
79b9fff399 Revert "Cycles: oneAPI: query graphics compiler for supported targets"
This reverts commit ad8c5fd441.
As it's currently failing on linux buildbot.
2023-10-11 15:44:55 +02:00
Sergey Sharybin
36e603c430 Cycles: Add option to control smoothing when using bump map
Cycles implements the "Taming the Shadow Terminator" paper by Matt Jen-Yuan
Chiang to solve shadow terminator issues when a bump map is applied, as well
as similar approach for the glossy reflection to ensure ray does not get
reflected to inside of the object.

This correction term is applied unconditionally, which makes it harder to have
full control over shading via normals for stylistic reasons.

This change exposes this corrective term as an option called "Bump Map
Correction" which is available in the shader settings next to the
"Transparent Shadows".

The reason to make it per-shader rather than per-object is to allow flexibility
of a control: it is possible that an object has multiple shaders attached to it,
and only some of them used for bump mapping. Another, and possibly stronger
reason to have it per-shader is ease of assets control: shader brings settings
which are needed for its proper behavior. So if material at some point
decides to take over normals, artists would not need to update settings on
every asset which uses that material.

The option is enabled by default, so there is no changes for existing setups.

Pull Request: https://projects.blender.org/blender/blender/pulls/113480
2023-10-11 15:07:21 +02:00
Xavier Hallade
ad8c5fd441 Cycles: oneAPI: query graphics compiler for supported targets
In case a target isn't supported by the graphics compiler, it will be
filtered out from the target architectures to build for.
2023-10-11 14:59:26 +02:00
Xavier Hallade
c4b49aa391 Cycles: oneAPI: rename target intel arch cmake setting
CYCLES_ONEAPI_SPIR64_GEN_DEVICES -> CYCLES_ONEAPI_INTEL_BINARIES_ARCH
so it's more aligned with the name for the other backends, such as
CYCLES_CUDA_BINARIES_ARCH.
2023-10-11 14:59:26 +02:00
Campbell Barton
137f8dd7bc Cleanup: spelling in comments 2023-10-10 09:44:57 +11:00
Brecht Van Lommel
5bb729b155 Merge branch 'blender-v4.0-release' into main 2023-10-09 19:19:11 +02:00
Alaska
85c4df2c42 Cycles: Update Glass BSDF to generalized_schlick
Update the Glass BSDF to internally use Generalized Schlick fresnel.
This allows for easier expansion of certain features in the future.

There should be no functional change from the users perspective.

Pull Request: https://projects.blender.org/blender/blender/pulls/112701
2023-10-09 19:17:15 +02:00
Campbell Barton
149d80946e Cleanup: CMake formatting 2023-10-07 19:46:38 +11:00
Brecht Van Lommel
1e567d05e9 Merge branch 'blender-v4.0-release' into main 2023-10-06 20:11:54 +02:00
Brecht Van Lommel
c1b4af86b9 Cycles: Speed up principled BSDF when IOR = 1.0
Skip the specular layer of the principled BSDF when IOR=1.0
since it has no visual impact on the material.

Pull Request: https://projects.blender.org/blender/blender/pulls/111586
2023-10-06 20:09:35 +02:00