Commit Graph

7925 Commits

Author SHA1 Message Date
Werner, Stefan
d7794f3540 Cycles: Fixed SYCL build with newer compilers 2023-07-06 15:06:33 +02:00
Brecht Van Lommel
b96c15172b Cycles: remove Point Density Texture support for surfaces
This is only intended for volumes, and including volume features in the
surface kernels negatively impacts GPU rendering performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/109712
2023-07-05 18:05:25 +02:00
Xavier Hallade
d55cdb1b7a Cycles: improve oneAPI requirements text in the UI
Pull Request: https://projects.blender.org/blender/blender/pulls/109644
2023-07-05 12:16:04 +02:00
Sergey Sharybin
bad41885db Cleanup: Mark unused function arguments as such
A lot of such cases got discovered since recent change to CLang's
compiler flags for C++.

Pull Request: https://projects.blender.org/blender/blender/pulls/109732
2023-07-05 12:02:06 +02:00
Campbell Barton
785bd13b9a Cleanup: spelling in comments 2023-07-05 14:09:33 +10:00
Ray Molenkamp
fac69131ab Cleanup: make format 2023-07-04 08:26:24 -06:00
Michael Jones
24ebf489d6 Cycles: Make use of maximum concurrent compilations on Metal
This patch queries the MTLDevice `maximumConcurrentCompilationTaskCount` property (macOS >= 13.3) to spawn more compilation threads if available.

Pull Request: https://projects.blender.org/blender/blender/pulls/109689
2023-07-04 15:01:48 +02:00
Nikita Sirgienko
7c4108567b Cycles: Embree: Resolve padding-related issue during buffer creations 2023-07-04 13:41:45 +02:00
Nikita Sirgienko
e73bb628ee Cycles: Fix Out-Of-Bounds issues during Embree BVH building 2023-07-04 13:41:25 +02:00
Brecht Van Lommel
f4da74ed29 Revert "Cycles: Make use of maximum concurrent compilations on Metal"
This reverts commit 63d3fc2dcbe481ec85dfae517cf6a1318971913c, because it
causes a build error on the buildbot.

Ref #109655
2023-07-03 20:30:22 +02:00
Michael Jones
63d3fc2dcb Cycles: Make use of maximum concurrent compilations on Metal
This patch queries the MTLDevice `maximumConcurrentCompilationTaskCount` property (macOS >= 13.3) to spawn more compilation threads if available.

Pull Request: https://projects.blender.org/blender/blender/pulls/109655
2023-07-03 18:09:13 +02:00
Nikita Sirgienko
7977247995 Cycles: Avoid printing capabilities when there are no devices
Pull Request: https://projects.blender.org/blender/blender/pulls/109511
2023-07-03 13:09:41 +02:00
Nikita Sirgienko
d801ffddff Cycles: oneAPI: Fix execution error with cryptomatte kernel 2023-06-29 14:51:49 +02:00
Ray molenkamp
eff9e2f4ce CMake: plumbing for modern CMake usage
This is the minimal change required to start using modern CMake in the
blender build system. This change is designed to allow small
incremental changes to the build system rather than doing it in one
big bang which would be unmaintainable (for me)

The biggest functional change is, previously all libraries in the
`LIB` section of a `blender_add_lib` call had the `INTERFACE` scope,
which is rarely, if ever the correct scope. This diff changes this to
`PRIVATE`

Concrete implications of this diff :

The `LIB`, `INC` and `INC_SYS` sections of an `blender_add_lib` call
now allow scoping keywords (`PUBLIC`, `PRIVATE,` `INTERFACE`) to
declare the scope of the dependency.

Right now the only library using any modern cmake is
`bf_intern_atomic` which is an header only interface library that will
just advertise its include directories.

This allows us to clean up any `CMakeLists.txt` that adds
`../../../intern/atomic` to its `INC` section to remove it in `INC` by
adding a `PRIVATE bf_intern_atomic` to the `LIB` section.

Pull Request: https://projects.blender.org/blender/blender/pulls/107858
2023-06-27 20:57:50 +02:00
Damien Picard
44d012ce1d I18n: disambiguate a few messages
- "Front"/"Back": 'put something at the front/back' or 'the front/back
  face of something'. (e. g. the Empty Image options, Depth and Side
  option, both use the same strings as enum, which should be avoided
  in some languages).
- "Flip": invert, as in normals, or mirror, as in an image.
- "Path": a path to a resource, in general a file but sometimes a
  datablock, as opposed to a trajectory in space.
- "Join": disambiguate for the Grease Pencil operator, which may use a
  different word as that for meshes.
- "Wave": an ondulating motion, as opposed to a fluid dynamics motion.
- "Step": can mean the distance between two things, or a number of
  times to do something. In this case it is better to use the plural.
- "Edge": generally the edges of a mesh, but can also mean edge
  detection. Additionally, it was used for the option to enable
  Freestyle. This was changed to "Use Freestyle".
- "Boundary": the limit of a grease pencil drawing for filling
  purposes, as opposed to the external limit of a (non-manifold) mesh.
- "Rotations": can be translated to something like "Turns", in the
  context of a spiral.

Pull Request: https://projects.blender.org/blender/blender/pulls/108213
2023-06-26 15:07:06 +02:00
Jeroen Bakker
60a3dbaba9 Cleanup make format 2023-06-26 14:20:31 +02:00
Stephen Luce
659c7f6050 Cycles: remove redundant bounds checks in CPU image sampling
For repeat / extend / mirror mode, both wrap and read_clip functions did
the bounds check. Removing it improves performance between 0.5% and 1.5%
in the classroom scene in one test. Clip mode is unchanged.

Pull Request: https://projects.blender.org/blender/blender/pulls/109304
2023-06-26 14:13:02 +02:00
Weizhen Huang
be06c4b383 Cleanup: minor computational simplification in Cycles area light 2023-06-26 11:47:50 +02:00
Hoshinova
3efc63b398 Fix #109253: Voronoi Smooth F1 breaks when Smoothness is 0
The Voronoi Smooth F1 mode breaks when the Smoothness is 0 for OSL. This is
due to a zero division in the shader.

To fix this, standard F1 is used when Smoothness is 0.

Pull Request: https://projects.blender.org/blender/blender/pulls/109255
2023-06-23 15:56:09 +02:00
Weizhen Huang
fcbf66d51f Cleanup: pre-scale spot light axes to avoid unnecessary division
`spot.dir` is kept normalized because it is used in the light tree.
2023-06-23 15:45:45 +02:00
Xavier Hallade
1489c5a57b Merge branch 'blender-v3.6-release' 2023-06-23 13:12:58 +02:00
Xavier Hallade
6437c0c948 Cycles: oneAPI: avoid crashes from old drivers
During recent testing, the oldest 101.4032 (windows) and <25812 (linux)
drivers led to crashes during JIT compilation, so we bump the
requirement to newer 101.4313 and 25812.14 drivers that do incorporate
the required fixes.

Pull Request: https://projects.blender.org/blender/blender/pulls/109281
2023-06-23 13:12:21 +02:00
Weizhen Huang
37d3daaea6 Cycles: remove clamping of area lights at small spread angles
there is still artifacts at extremely small angles, but should be
unnoticeable due to improved accuracy.
2023-06-22 17:52:41 +02:00
Weizhen Huang
9aaf28954b Cleanup: avoid division in #spot_light_attenuation 2023-06-22 17:19:01 +02:00
Brecht Van Lommel
c7319e6c79 Merge branch 'blender-v3.6-release' into main 2023-06-20 20:49:44 +02:00
salipourto
b84d4dd16d Fix various HIP RT issues
* Motion blur issues due to missing ray time
* Wrong bitcode path for runtime compilation
* Quiet logging

Pull Request: https://projects.blender.org/blender/blender/pulls/109170
2023-06-20 20:47:10 +02:00
Weizhen Huang
a4d792a3ad Cycles/EEVEE: change point light to double-sided sphere light
for energy preservation and better compatibility with other renderes. Ref: #108505

Point light now behaves the same as a spherical mesh light with the same overall energy (scaling from emission strength to power is \(4\pi^2R^2\)).
# Cycles
## Comparison
| Mesh Light | This patch | Previous behavior |
| -------- | -------- | -------- |
| ![mesh_1024](attachments/2900954c-57f8-49c2-b6f3-8fb559b820ac)     | ![sphere_1024](attachments/148241ca-9350-48b6-be04-3933e015424c)     | ![point_1024](attachments/d9b19d54-2b00-4986-ba8c-c4b28f687f09)  |

The behavior stays the same when `radius = 0`.

| This patch | Previous behavior |
| -------- | -------- |
| ![sphere_64](attachments/aa05d59a-146a-4f69-b257-5d09a7f41d4e)     | ![point_64](attachments/69a743be-bc15-454b-92d8-af02f4e8ab07)    |

No obvious performance change observed.

## Sampling
When shading point lies outside the sphere, sample the spanned solid angle uniformly.
When shading point lies inside the sphere, sample spherical direction uniformly when inside volume or the surface is transmissive, otherwise sample cosine-weighted upper hemisphere.
## Light Tree
When shading point lies outside the sphere, treat as a disk light spanning the same solid angle.
When shading point lies inside the sphere, it behaves like a background light, with estimated outgoing radiance
\[L_o=\int f_aL_i\cos\theta_i\mathrm{d}\omega_i=\int f_a\frac{E}{\pi r^2}\cos\theta_i\mathrm{d}\omega_i\approx f_a \frac{E}{r^2}\],
with \(f_a\) being the BSDF and \(E\) `measure.energy` in `light_tree.cpp`.
The importance calculation for `LIGHT_POINT` is
\[L_o=f_a E\cos\theta_i\frac{\cos\theta}{d^2}\].
Consider `min_importance = 0` because maximal incidence angle is \(\pi\), we could substitute \(d^2\) with \(\frac{r^2}{2}\) so the averaged outgoing radiance is \(f_a \frac{E}{r^2}\).
This only holds for non-transmissive surface, but should be fine to use in volume.
# EEVEE
When shading point lies outside the sphere, the sphere light is equivalent to a disk light spanning the same solid angle. The sine of the new half-angle is the tangent of the previous half-angle.
When shading point lies inside the sphere, integrating over the cosine-weighted hemisphere gives 1.0.
## Comparison with Cycles
The plane is diffuse, the blue sphere has specular component.
| Before | |After ||
|---|--|--|--|
|Cycles|EEVEE|Cycles|EEVEE|
|![](attachments/5824c494-0645-461a-b193-d74e02f353b8)|![](attachments/d2e85b53-3c2a-4a9f-a3b2-6e11c6083ce0)|![](attachments/a8dcdd8b-c13c-4fdc-808c-2563624549be)|![](attachments/8c3618ef-1ab4-4210-9535-c85e873f1e45)|

Pull Request: https://projects.blender.org/blender/blender/pulls/108506
2023-06-20 12:23:05 +02:00
Lukas Stockner
a783fe8198 Cycles: Fix some direct lighting leaking into indirect-only bakes
When baking only indirect lighting, light sampling is skipped at the
first bounce. However, light evaluation is still done, so depending
on how the MIS weights end up more or less of the direct lighting
still ends up in the bake.

This is most noticeable with background lighting, but can also be
reproduced with e.g. point lights with a large radius.

Pull Request: https://projects.blender.org/blender/blender/pulls/108955
2023-06-16 03:03:22 +02:00
Brecht Van Lommel
45b9542e6c Merge branch 'blender-v3.6-release' into main 2023-06-15 16:45:15 +02:00
Brecht Van Lommel
0ab58864f3 Fix Cycles Metal AMD crash with shadow caustics, by disabling it
Better to disable than crashing, as we are not expecting a quick fix. The cause
is likely similar to issues with the light tree, which was already disabled.

Ref #104013
2023-06-15 16:33:21 +02:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Kévin Dietrich
f509c213d0 Merge remote-tracking branch 'origin/blender-v3.6-release' into main 2023-06-15 03:41:07 +02:00
Kévin Dietrich
d2b741bebe Fix #107877: Alembic procedural crashes with point clouds
Somehow the implementation for the main function to load point clouds
data was missing although everything else to support point clouds was
there. Compilers were more than happy to convert the IPointsSchema to
another schema type for the compilation to succeed, and the crash
occurs because the points schema does not contain the same data as the
compiler's chosen schema (in this case an ICurvesSchema).

Another crash was found due to the radius array not being properly
initialized and left with a size of 0, when Cycles expects a full array.
2023-06-15 03:40:15 +02:00
Sergey Sharybin
f96f310a9f Merge branch 'blender-v3.6-release' 2023-06-14 18:21:09 +02:00
Sergey Sharybin
3aaf076e8d Fix compilation error with oneAPI disabled and GPU Embree enabled
Happens with systems which do not provide GOLD linker: the linking state
would failing with some missing symbols and print about missing libsycl.so.6.

Seems that BFD linker expects to resolve all symbols, even the indirectly
used ones. This is somewhat counter-intuitive and is not how LLD, GOLD,
or MOLD worls.

The current state of the CMakeLists.txt does request the cycles_bvh to be
linked against SYCL_LIBRARIES. However, the SYCL was only requested to be found
if WITH_CYCLES_DEVICE_ONEAP is true.

Arguably the SYCL_LIBRARIES should only be linked-in into cycles_bvh if
EMBREE_STATIC_LIB, but that does not solve the issue with BFD.

This change makes it so the SYCL is requested to be found if the oneAPI
device is enabled, or if the Embree is detected to require/use SYCL
support.

Pull Request: https://projects.blender.org/blender/blender/pulls/108965
2023-06-14 18:20:45 +02:00
Campbell Barton
c12994612b License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
Campbell Barton
4b8434fabd License headers: add missing header 2023-06-14 16:51:35 +10:00
Lukas Stockner
eb8d56328d Cycles: Disable unused closure types when baking a specific component
When baking e.g. the Diffuse pass, use the existing filter logic to
disable glossy and transmission closures.

This reduces baking time and noise when baking individual components
of complex materials.
2023-06-14 03:13:22 +02:00
Lukas Stockner
f2678b35fa Cleanup: Cycles: Simplify light pass logic in bake_setup_pass 2023-06-14 02:39:24 +02:00
Lukas Stockner
5cd3be42ce Cleanup: Cycles: Use C++ strings in bake_setup_pass 2023-06-14 02:38:35 +02:00
Lukas Stockner
17db86a03f Merge branch 'blender-v3.6-release' 2023-06-14 01:48:26 +02:00
Lukas Stockner
962331c256 Fix #105555: Cycles: Baking only indirect lighting is broken
The problem here was that when direct light contibutions to baking were
disabled, the kernel just skipped all direct lighting evaluation.

However, at secondary bounces, "direct light" would actually end up
being indirect (since there's an extra bounce along the way), but
we're still skipping it.

Therefore, only apply direct lighting skipping at the first bounce.
2023-06-14 01:42:22 +02:00
Hans Goudey
e5ec04d73c Mesh: Move vertex/edge crease to generic attributes
Store subdivision surface creases in two new named float attributes:
- `crease_vert`
- `crease_edge`
This is similar to 2a56403cb0dbcbc1dfb19a9bf7e6434517cbdca9.

The attributes are naming conventions, so their data type and domain
aren't enforced, and may be interpolated when necessary. Editing tools
and the subdivision surface modifier use the hard-coded name. It might
be best if these were edited as generic attributes in the future, but
in the meantime using generic attributes helps.

The attributes are visible in the list, which is how they're now meant
to be removed. They are now interchangeable with any tool that works
with the generic attribute system-- even tools like vertex paint can
affect creases now.

This is a breaking change. Forward compatibility isn't preserved for
versions before 3.6, and the `crease` property in RNA is removed in
favor of making a smaller API surface area with just the attribute API.
`Mesh.vertex_creases` and `Mesh.edge_creases` now just return the
matching attribute if possible, and are now implemented in Python.
New functions `*ensure` and `*remove` also replace the operators to
add and remove the layers for Python.

A few extrude node test files have to be updated because of different
(now generic) attribute interpolation behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/108089
2023-06-13 20:23:39 +02:00
Brecht Van Lommel
8b85c04832 Fix Cycles OSL compiler warning after voronoi changes
After parameter name conflicting with builtin normalize function.
2023-06-13 19:51:49 +02:00
Sergey Sharybin
376467de3c Merge branch 'blender-v3.6-release' 2023-06-13 15:36:38 +02:00
Alaska
623cb023b9 Cycles: Fix light tree sampling of multiple large distant lights
This fixes an issue where the light tree sampling algorithm would
discard light samples from groups of distance lights with an angle
greater than 0 when it shouldn't.

Pull Request: https://projects.blender.org/blender/blender/pulls/108832
2023-06-13 15:36:05 +02:00
Sergey Sharybin
1914dbc3f0 Merge branch 'blender-v3.6-release' 2023-06-13 13:02:20 +02:00
Sergey Sharybin
8013bad084 Fix Cycles on Metal after the recent changes
The address space needs to be specified explicitly.

Pull Request: https://projects.blender.org/blender/blender/pulls/108932
2023-06-13 13:01:58 +02:00
Hoshinova
144ad4d20b Nodes: add Fractal Voronoi Noise
Fractal noise is the idea of evaluating the same noise function multiple times with
different input parameters on each layer and then mixing the results. The individual
layers are usually called octaves.
The number of layers is controlled with a "Detail" slider.
The "Lacunarity" input controls a factor by which each successive layer gets scaled.

The existing Noise node already supports fractal noise. Now the Voronoi Noise node
supports it as well. The node also has a new "Normalize" property that ensures that
the output values stay in a [0.0, 1.0] range. That is except for the F2 feature where
in rare cases the output may be outside that range even with "Normalize" turned on.

How the individual octaves are mixed depends on the feature and output socket:
- F1/Smooth F1/F2:
  - Distance/Color output:
    The individual Distance/Color octaves are first multiplied by a factor of
    `Roughness ^ (#layers - 1.0)` then added together to create the final output.
  - Position output:
    Each Position octave gets linearly interpolated with the combined output of the
    previous octaves. The Roughness input serves as an interpolation factor with
    0.0 resutling in only using the combined output of the previous octaves and
    1.0 resulting in only using the current highest octave.
- Distance to Edge:
  - Distance output:
    The Distance octaves are mixed exactly like the Position octaves for F1/Smooth F1/F2.

It should be noted that Voronoi Noise is a relatively slow noise function, especially
at higher dimensions. Increasing the "Detail" makes it even slower. Therefore, when
optimizing a scene one should consider trying to use simpler noise functions instead
of Voronoi if the final result is close enough.

Pull Request: https://projects.blender.org/blender/blender/pulls/106827
2023-06-13 09:18:12 +02:00
Lukas Stockner
0e593dc7f1 Merge branch 'blender-v3.6-release' 2023-06-13 01:56:11 +02:00