Commit Graph

3765 Commits

Author SHA1 Message Date
Xavier Hallade
90a10dcd50 Cycles: Adjust inlining attributes for oneAPI device
Now ccl_device sets inlining and ccl_device_inline forces inlining.
This matches more closely with what is currently done for cuda and metal
backends.
I've measured from 1% to 6% overall performance improvement in rendering
benchmark scenes on Arc B580, as well as a small decrease in compile
time.
2025-03-03 18:20:02 +01:00
Alaska
fb7b53143e Merge branch 'blender-v4.4-release' 2025-02-27 12:03:30 +13:00
Alaska
d840d249b3 Cycles: Re-enable HIPRT point cloud rendering
Previously point cloud rendering was disabled on the HIPRT backend due
to unexpected performance regressions introduce by it.

With the recent update to HIP SDK 6.3 and HIPRT 2.5, these performance
regressions have been resolved and so this commit re-enables
point cloud rendering on HIPRT.

Pull Request: https://projects.blender.org/blender/blender/pulls/134902
2025-02-27 00:01:35 +01:00
Xavier Hallade
a5d8bd2e29 Cycles: Drop inline hint on light_tree_pdf
Dropping the inlining hint for `light_tree_pdf` and reverting to the
default inlining thresholds for DPC++ compiler gives a ~4% speedup on
classroom and other scenes on Arc B580.

Pull Request: https://projects.blender.org/blender/blender/pulls/135042
2025-02-26 20:14:05 +01:00
Weizhen Huang
7b3f7ccae0 Merge branch 'blender-v4.4-release' 2025-02-26 15:51:55 +01:00
Lukas Stockner
9254532b8b Fix #129306: Cycles: Principled coat doesn't pass furnace test
This implements three improvements to the energy preservation and albedo
scaling logic, which help the Principled BSDF pass the white-furnace test
when using the coat layers at high roughness.

Specifically, at roughness 0.3, the albedo scaling brings it from 60% at
the edge to 95%, and with the energy preservation it's 99.8%.

Pull Request: https://projects.blender.org/blender/blender/pulls/134620
2025-02-26 15:47:21 +01:00
Weizhen Huang
9ee9a2b789 Fix #135145: object visible to volume scatter when ray visibility is off
The comment was added in e0857ad152, and volume scatter visibility is
supported since cdd1d5a93c.

Pull Request: https://projects.blender.org/blender/blender/pulls/135168
2025-02-26 15:45:58 +01:00
Brecht Van Lommel
655ccf1d7a Fix #135086: Light ray visibility not taken into account without light tree
Re-enable tests that were temporarily disabled for this.

Caused by #134846, e813e46327
2025-02-25 17:24:04 +01:00
Brecht Van Lommel
e813e46327 Cycles: Refactor lights to be objects
This is an intermediate steps towards making lights actual geometry.
Light is now a subclass of Geometry, which simplifies some code.

The geometry is not added to the BVH yet, which would be the next
step and improve light intersection performance with many lights.

This makes object attributes work on lights.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/134846
2025-02-24 23:44:14 +01:00
Lukas Stockner
8cb5e05c48 Cleanup: Cycles: Deduplicate kernel attribute code using templating
The attribute handling code in the kernel is currently highly duplicated since
it needs to handle five different data types and we couldn't use templates
back then.
We can now, so might as well make use of it and get rid of ~1000 lines.

There are also some small fixes for the GPU OSL code:
- Wrong derivative for .w component when converting float2/float3->float4
- Different conversion for float2->float (CPU averages, GPU used to take .x)
- Removed useless code for converting to float2, not used by OSL

Pull Request: https://projects.blender.org/blender/blender/pulls/134694
2025-02-20 19:28:45 +01:00
Sergey Sharybin
c114ac97be Merge branch 'blender-v4.4-release' 2025-02-20 17:36:37 +01:00
Sahar A. Kashi
6363181af9 Cycles: HIP-RT 2.5 integration and gfx12 support
This change brings the following improvements on the user level
- Support of GPUs with gfx12 architecture
- New HIP-RT library which in addition to the gfx12 support brings
  various bug-fixes.

The known limitation of gfx12 is that OpenImageDenoiser does not yet
support this GPU architecture. This means that while Cycles will use the
full advantage of the gfx12 (including hardware accelerated ray-tracing),
denoising will only be possible on CPU, or secondary gfx11 or below GPU.
This is something that requires a change in OIDN and it is to late to do
it for Blender 4.4, but it is something to look forward for Blender 4.5.

The gfx12 changes for the pre-compiled kernels is rather trivial,
so it comes together (in the same PR) as the bigger HIP-RT change.

On the development side this change brings the following improvements:
- One step compile and link (much simpler CMake rules)
- Embedding BVH binaries in hiprt dll (which makes it easier to package
  and load, without relying on special path configuration)

Co-authored-by: Sahar Kashi <sahar.kashi@amd.com>
Co-authored-by: Sergey Sharybin <sergey@blender.org>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/133129
2025-02-20 17:34:14 +01:00
Lukas Stockner
a6a183ab4d Merge branch 'blender-v4.4-release' 2025-02-15 19:56:23 +01:00
Lukas Stockner
0177537c9a Fix #129279: Cycles: Matrix-typed attributes not working in OptiX OSL
The issue here is that the individual components of TypeDesc are 8-bit each,
but the code was applying a 4-bit mask. It just so happens that the only
case where this matters is TypeDesc::MATRIX44, since its value is 16.
2025-02-15 19:31:07 +01:00
Alaska
870f92c6f9 Merge branch 'blender-v4.4-release' 2025-02-15 13:25:13 +13:00
Alaska
bcec81c4be Fix: Overflow when using light falloff node on distant lights
In Cycles lights can be given a light falloff node to control their
light falloff.

This worked by multiplying the light's strength by different
combinations of the ray length, which would be FLT_MAX for
distant lights. This resulting in almost every configuration of the
light falloff node overflowing when used on distant lights, which is
undesirable.

This commit fixes this issue by ignoring most of the functions of the
light falloff node when used on a distant light.

And in the process fixes a small discrepancy between SVM and OSL when
using the light falloff node on distant lights.

Pull Request: https://projects.blender.org/blender/blender/pulls/134539
2025-02-15 01:23:12 +01:00
Alaska
212d22e039 Merge branch 'blender-v4.4-release' 2025-02-14 17:10:41 +13:00
Alaska
fee2f10208 Fix: Incorrect ray depth on emission in Cycles OSL
This commit fixes a issue where ray depth for emissive objects
(E.g. Lights) was incorrect when using the ray depth output of the
light path node in Cycles OSL.

Pull Request: https://projects.blender.org/blender/blender/pulls/134496
2025-02-14 05:09:08 +01:00
Brecht Van Lommel
68a510fe9b Merge branch 'blender-v4.4-release' 2025-02-12 21:50:28 +01:00
Nikita Sirgienko
2bab4ae370 Cycles: oneAPI: Optimize texture access by using GPU HW sampler
The current usage of software-based texture operations in
the oneAPI implementation puts additional register pressure on
the GPU compiler during register allocation. And it also creates
code that requires maintenance. This commit is intended to address
this situation by utilizing a recently productized SYCL bindless
texture API to enable HW-based texture operations using
Intel GPUs' hardware sampler.

This currently translates to 1-11% rendering speedups (scene-specific)
on my Arc A770 and Arc B580. At the moment, there are small
performance regressions with NanoVDB texture operations on Arc B580
and small performance regressions in shade surface MNEE and Raytrace
kernels on Arc A770, but they look recoverable and will be handled
in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/133457
2025-02-12 21:47:34 +01:00
Nikita Sirgienko
a0b7ad436b Cleanup: Cycles: oneAPI: Switch to non-experimental work item API
There is now a non-experimental API for this_work_item functionality, so
let's use it for better code quality and also to avoid the deprecation
warning during compilation.

No functional or performance changes are expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/133472
2025-02-12 21:46:22 +01:00
Xavier Hallade
89f70855e0 Cycles: oneAPI: Enable kernels compression
This is done using zstd with compression level 19 so it's aligned with
the other backends that had it enabled in
4bde68cdd6.

Pull Request: https://projects.blender.org/blender/blender/pulls/134049
2025-02-12 21:45:16 +01:00
Brecht Van Lommel
ff6ec94226 Merge branch 'blender-v4.4-release' 2025-02-10 19:56:17 +01:00
Brecht Van Lommel
f63c192543 Fix: Cycles OptiX with OSL 1.14 failure in some render tests 2025-02-10 19:34:24 +01:00
Brecht Van Lommel
2f44765bc8 Merge branch 'blender-v4.4-release' 2025-02-10 16:52:04 +01:00
Brecht Van Lommel
d9ea0e0a29 Fix: Cycles oneAPI kernel not rebuilding when the compiler is updated
This is not a complete solution because there may be indirect changes
to the compiler other than the binary that require a rebuild, but this
should catch the simple cases at least.
2025-02-10 16:41:10 +01:00
Weizhen Huang
b76fbb285e Cycles: Change the integration measure in Huang Hair from gamma to h
To align better with the pixel and reduce the samples needed.

The paper was using gamma because the jacobian |d_gamma/d_h| approaches
infinity at the boundaries, but it seems that clamping at 0.999 is
enough for numerical stability.

In practice I did not notice a change in the noise level, but it
simplifies the range computation and renders faster due to reduced
sample amount.

Co-authored-by: Olivier Maury <omaury@meta.com>

Ref: !129616

Pull Request: https://projects.blender.org/blender/blender/pulls/134130
2025-02-10 14:58:26 +01:00
Sergey Sharybin
4e9f85b76f Merge branch 'blender-v4.4-release' 2025-02-10 14:55:57 +01:00
Patrick Mours
5810c94f95 Cycles: Add Blackwell to Cycles CUDA binaries architectures
Enables building of a Cubin for GPUs based on Blackwell architecture
if CUDA toolkit version 12.8 or higher is installed.
Only added sm_120 to the default set, since it is the one relevant for
consumer GPUs (RTX 5090 etc.) that are generally used with Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/134170
2025-02-10 14:55:28 +01:00
Campbell Barton
e659e87a67 Cleanup: cmake formatting, sort file lists 2025-02-10 19:40:06 +11:00
Alaska
a32b8b546d Merge branch 'blender-v4.4-release' 2025-02-08 01:25:00 +13:00
Alaska
3791001b1c Fix: Object info random on lights do not work in Cycles OSL
This commit adds the `light:random` attribute to OSL, allowing the
object info node to now match between SVM and OSL when using the
random output on a light.

Pull Request: https://projects.blender.org/blender/blender/pulls/134095
2025-02-07 13:23:51 +01:00
weizhen
19fa8e5e77 Merge branch 'blender-v4.4-release' 2025-02-06 18:44:04 +01:00
weizhen
0f8eed340e Fix: Cycles: Compilation issue with OSL on GPU 2025-02-06 18:42:46 +01:00
Weizhen Huang
1d24c8c927 Merge branch 'blender-v4.4-release' 2025-02-06 16:24:16 +01:00
Weizhen Huang
b26221a06a Fix #74979: Cycles: Support Normal texture for bump mapping on triangles
The derivatives of the normal were simply not computed.

The offsetted normals are computed by perturbating the barycentric
coordinates. At triangle boundaries, the normals are extrapolated,
so discontinuities might be visible.

Currently only supported on triangles.

Pull Request: https://projects.blender.org/blender/blender/pulls/133769
2025-02-06 16:22:19 +01:00
Weizhen Huang
8e4d5a47d7 Cleanup: Cycles: add utility function is_circular() for Huang Hair
Pull Request: https://projects.blender.org/blender/blender/pulls/134129
2025-02-05 18:44:04 +01:00
Weizhen Huang
f22bfc46d1 Cleanup: Cycles: use utility struct Interval to improve readability 2025-02-05 18:44:03 +01:00
Weizhen Huang
d2db9927ed Fix #86648: reduce ray differentials size for bump mapping
Use sub-pixel differentials for bump mapping helps with reducing
artifacts when objects are moving or when textures have high frequency
details.

Currently we scale it by 0.1 because it seems to work good in practice,
we can adjust the value in the future if it turns out to be impractical.

Ref: #122892

Pull Request: https://projects.blender.org/blender/blender/pulls/133991
2025-02-05 13:39:27 +01:00
Weizhen Huang
f4e4f19af2 Cleanup: Cycles: improve comments and variable names of bump-related functions
- Rename dx/dy -> dfdx/dfdy to match the actual computed quantity
- Add template functions to compute dfdx/dfdy on triangles for sharing
  among different data types
- Add documentation to some functions
- Some code shuffling that makes it easier to scale dfdx/dfdy in the
  future
- Some other trivial changes
2025-02-05 13:39:27 +01:00
Alex
c6d7bee181 Cycles: Burley diffuse closure for MaterialX compatibility
Add Burley diffuse to OSL for MaterialX compatibility. It is OSL only and
isn't a closure that will be looked for in SVM.

Pull Request: https://projects.blender.org/blender/blender/pulls/133845
2025-02-04 19:38:56 +01:00
Brecht Van Lommel
f80f97ca0d Refactor: Cycles: Rename rcp to reciprocal
To avoid symbol conflicts with upcoming HIP changes. Also remove
unused implementations for float4 and float8.

Pull Request: https://projects.blender.org/blender/blender/pulls/134045
2025-02-04 18:59:24 +01:00
Weizhen Huang
1b2ed045c1 Fix: Cycles: Wrong differentials of curve attributes
The barycentric coordinates u/v are aligned with the curve, but the
local coordinate system is created from the geometry normal and can
differ from uv.

Pull Request: https://projects.blender.org/blender/blender/pulls/133882
2025-02-03 10:58:25 +01:00
Weizhen Huang
e9c39a6dcd Fix: Cycles: Wrong differentials of Wireframe nodes for bump mapping
Bump map differentials are computed in `svm_node_set_bump()`, other
shader nodes should just evaluate at shifted locations.

Pull Request: https://projects.blender.org/blender/blender/pulls/133876
2025-02-03 10:57:34 +01:00
Lukas Stockner
0677e19fa0 Fix: Cycles: Wrong motion transform interpolation when using velocity
The issue here is that originally, the step count for the geometry's
motion and the object transform's motion were tied together, so a
single variable is used to store that step count.
However, when using the velocity attribute, it's possible for the step
counts to differ, which will lead to an incorrect interpolated object
transform in the kernel.

Pull Request: https://projects.blender.org/blender/blender/pulls/133788
2025-01-31 00:47:55 +01:00
Alex
0fdf916de2 Cycles: Sheen BSDF compatibility for MaterialX
Pull Request: https://projects.blender.org/blender/blender/pulls/133797
2025-01-30 11:15:43 +01:00
Alex
4c7129be72 Cycles: OSL subsurface_bssrdf compatibility for MaterialX
Pull Request: https://projects.blender.org/blender/blender/pulls/133612
2025-01-30 08:51:44 +01:00
Lukas Stockner
c997e61414 Cycles: Bump minimum OSL version to 1.13.4
That version has a bunch of API changes, so by dropping support for older
versions we can remove old compatibility code.
Also, that version is required for OptiX support, so building a fully-featured
Cycles wasn't possible with older OSL anyways.

Pull Request: https://projects.blender.org/blender/blender/pulls/133746
2025-01-29 21:17:21 +01:00
Campbell Barton
bd1ded952b Cleanup: spelling in comments 2025-01-29 12:31:19 +11:00
Lukas Stockner
a6e7bf2095 Cycles: Support Ray Depth attributes for OptiX OSL
Following the ShaderGlobals refactor, we can now easily pass IntegratorState
along on the GPU side as well, so let's implement these missing attributes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133689
2025-01-29 01:01:08 +01:00