Commit Graph

7812 Commits

Author SHA1 Message Date
Lukas Stockner
81f127a7e4 Fix refraction BSDF color when using OSL 2023-06-05 01:01:19 +02:00
William Leeson
215925e04c FIX #108019: Detect absence of ray tracing support on late 2015 iMac
On an iMac (Retina 5K, 27-inch, Late 2015) it crashed when rendering using Cycles. This was due to the fact that it incorrectly detected that the machine supported ray tracing. This uses the device.supportsRaytracing flag to fill in the use_hardware_raytracing flag for the device.
2023-06-02 10:23:06 +02:00
Sergey Sharybin
50ba227740 Fix #108316: CUDA error rendering Attic scene
The light tree dependent on the first threshold to evaluate to 1
when picking up an emitter.

Pull Request: https://projects.blender.org/blender/blender/pulls/108323
2023-05-30 11:44:33 +02:00
Michael Jones
bdf5649f36 Cycles: Remove redundant MetalRT workaround & add two useful DebugFlags
This patch removes a workaround for an issue that is now understood to be undefined behaviour (and fixed by #108176). It also adds two useful debug flags that we would like to be available in Blender 3.6.

Pull Request: https://projects.blender.org/blender/blender/pulls/108322
2023-05-30 11:12:05 +02:00
Lukas Stockner
67d0ba4f80 Fix #108211: Incorrect Transmission Color pass due to merged Glass closure 2023-05-30 00:02:05 +02:00
Brecht Van Lommel
080484a5c8 Fix #108125: Cycles generates NaN in render passes with low roughness
Slightly increase threshold to avoid division by zero.
2023-05-26 12:18:06 +02:00
Brecht Van Lommel
9419f5a289 Fix #107932: crash attempting to load invalid OpenVDB file path on macOS
Add catch all exceptions similar as was done for OpenEXR in #107184, and
also properly handle errors in Hydra delegate.
2023-05-24 17:47:27 +02:00
Michael Jones
4a26f51a55 Cycles: MetalRT: Metal binary archives don't support linked functions
This patch fixes an undefined behaviour where we were trying to use linked functions with binary archives. This isn't supported yet. At best this will fail silently, but this is not guaranteed in future. To fix this we simply disable binary archives if any linked functions are involved. The impact of this is that the `SHADE_SURFACE_RAYTRACE` and `SHADE_SURFACE_MNEE` kernels will fall back to the file system cache when MetalRT is enabled. The file system cache will occasionally be purged due to factors beyond Blender's control.

Pull Request: https://projects.blender.org/blender/blender/pulls/108176
2023-05-23 13:42:25 +02:00
Xavier Hallade
23de320878 Cycles: fix multi-device rendering with oneAPI and Hardware Raytracing
Only Embree CPU BVH was built in the multi-device case. However, one
Embree GPU BVH is needed per GPU, so we now reuse the same logic as in
the other backends.

Pull Request: https://projects.blender.org/blender/blender/pulls/107992
2023-05-22 15:26:58 +02:00
Xavier Hallade
3695f0dffc Cycles: fix device settings update for Multi-device
Hardware Raytracing wasn't properly disabled or enabled in the
subdevices of the multi-device.

This construct:
foreach ( DeviceInfo &info,
  (device.multi_devices.size() != 0 ?
    device.multi_devices : vector<DeviceInfo>({device}))
)
was a nice trap - it was giving a copy to iterate on.

Pull Request: https://projects.blender.org/blender/blender/pulls/107989
2023-05-22 10:14:35 +02:00
Campbell Barton
bf36a61e62 Cleanup: spelling in comments & some corrections 2023-05-20 21:17:09 +10:00
Nikita Sirgienko
bafd82c9c1 Cycles: oneAPI: use local memory for faster shader sorting
Co-authored-by: Stefan Werner <stefan.werner@intel.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/107994
2023-05-17 11:07:57 +02:00
Nikita Sirgienko
04fc6fd8a7 Cycles: avoid doing zero-sized allocations with partitioned shader sorting 2023-05-17 11:07:56 +02:00
Nikita Sirgienko
b8173278b0 Cycles: oneAPI: set correct work group sizes for kernels that have a predefined one 2023-05-17 00:02:12 +02:00
Nikita Sirgienko
a17d07ee87 Cycles: oneAPI: Fix prevented execution with sycl runtime > 20230323
NanoVDB headers have unused code using "double" type, which is not supported on Arc GPUs.
Recent DPC++ changes enforced runtime verifications:
7663dc201d
which prevents execution when such type has been present even if unused.
This is a solution to avoid double to be compiled at all, similar as how it is done for Metal.
2023-05-17 00:00:52 +02:00
Brecht Van Lommel
f0701bdf73 Refactor: add reduce functions for float2 for consistency
Pull Request: https://projects.blender.org/blender/blender/pulls/107970
2023-05-16 13:56:08 +02:00
Xavier Hallade
66df452df2 Cycles: oneAPI: enable hardware raytracing by default 2023-05-15 16:36:51 +02:00
Xavier Hallade
5c57b9aa79 Cleanup: avoid warning on unused argument in cycles_device 2023-05-15 07:35:03 +02:00
Weizhen Huang
3d96cab01f Fix wrong area light pdf in Cycles MNEE
Area light sampling use special techniques to reduce noise with small
spread angles; the change in sampled area was not taken into
consideration when computing the pdf in MNEE.

Pull Request: https://projects.blender.org/blender/blender/pulls/107897
2023-05-12 23:07:28 +02:00
Weizhen Huang
9870d8fd27 Fix missing Jacobian in rect area light pdf when in volume segment 2023-05-12 22:40:02 +02:00
Brecht Van Lommel
078b2d7174 Fix #107777: Cycles baking of Shadow not working anymore
After the removal of the Shadow pass this no longer worked. Now it works by
marking the object as a shadow catcher and returning the Shadow Catcher pass.

The result is different than before, since it also takes into account indirect
light now and uses a different method to weight the contribution of lights that
is adaptive to the light strength.
2023-05-12 21:00:52 +02:00
Brecht Van Lommel
36e5157693 Cleanup: remove redundant lerp function, mix already does the same 2023-05-12 21:00:52 +02:00
Weizhen Huang
1a1f06bd9a Fix #107365: keep ls->D fixed in MNEE for area light with zero spread 2023-05-12 20:09:23 +02:00
Sebastian Parborg
84c5953882 Add the sm_89 arch to the default CUDA binaries
Without this, support for newer NVIDIA cards will not be compiled with pre-compiling the CUDA binaries.

Includes changes needed for the buildbot building pipeline.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/107585
2023-05-12 16:30:23 +02:00
Xavier Hallade
5ec2495550 Cycles: oneAPI: enable Hardware Raytracing for Raytrace/MNEE kernels
We do so if Embree 4.1+ is present.
2023-05-12 14:17:50 +02:00
Weizhen Huang
8e70ab9905 Fix #107603: queried the area of an empty bounding box 2023-05-11 11:18:12 +02:00
Sebastian Herholz
d864b5ce28 Cycles: BSDF ensuring that eval, pdf and label are intialized to zero and None 2023-05-09 15:40:05 +02:00
Brad Smith
322dab936f Build: fixes for OpenBSD
Pull Request: https://projects.blender.org/blender/blender/pulls/107666
2023-05-09 13:19:16 +02:00
Campbell Barton
3958ae7241 Cleanup: use STRNCPY, SNPRINTF macros 2023-05-09 14:08:19 +10:00
Weizhen Huang
6a7ca67a98 Fix #107725: ray-offset was incorrectly applied on motion triangles
79f1cc601c introduces a ray-offset to improve ray tracing precision near
triangle edges, but motion triangles still read the static vertices,
causing incorrect intersection detection

Pull Request: https://projects.blender.org/blender/blender/pulls/107748
2023-05-08 19:11:11 +02:00
Brecht Van Lommel
d1bfda16bb Cycles: re-enable HIP on Linux
Using the new ROCm 5.5 compiler.

Ref #104786

Pull Request: https://projects.blender.org/blender/blender/pulls/107662
2023-05-05 19:36:55 +02:00
Michael Jones
25fe9d74c9 Cycles: Fix hang when MSL->AIR compilation fails
Follow up to [#100066](https://projects.blender.org/blender/blender/pulls/105122/files). Scenes that do pre-render work on the GPU (e.g. the bake unit tests) will still hang if there are MSL compile failures. This patch adds a loop break out in case of an error.

Pull Request: https://projects.blender.org/blender/blender/pulls/107657
2023-05-05 18:52:54 +02:00
Brecht Van Lommel
0ffde36fe7 Refactor: flatten light tree in recursive function
This will make further changes for light linking easier, where we want to
build multiple trees specialized for each light linking set.

It's also easier to understand than the stack used previously.

Pull Request: https://projects.blender.org/blender/blender/pulls/107560
2023-05-05 16:32:59 +02:00
Campbell Barton
ba3d7499fa Cleanup: spelling, use term polygons in polygon callbacks 2023-05-05 09:46:28 +10:00
Hans Goudey
d0705bd697 Mesh: Split MLoopTri poly indices into a separate array
For derived mesh triangulation information, currently the three face
corner indices are stored in the same struct as index of the mesh
polygon the triangle is part of. While those pieces of information are
often used together, they often aren't, and combining them prevents
the indices from being used with generic utilities. It also means that
1/3 more memory has to be written when recalculating the triangulation
after deforming the mesh, and that the entire triangle data has to be
read when only the polygon indices are needed.

This commit splits the polygon index into a separate cache on `Mesh`.
The triangulation data isn't saved to files, so this doesn't affect
.blend files at all.

In a simple test deforming a mesh with geometry nodes, the time used
to recalculate the triangulation reduced from 2.0 ms to 1.6 ms,
increasing overall FPS from 14.6 to 15.

Pull Request: https://projects.blender.org/blender/blender/pulls/106774
2023-05-04 15:39:10 +02:00
Lukas Stockner
9ebe819579 Fix #107577: Cycles crash with denoising and Ashikhmin-Shirley BSDF 2023-05-04 03:14:20 +02:00
Nikita Sirgienko
1dcc8e6ffa Fix #107356: Cycles: improve oneAPI error handling 2023-05-03 12:06:08 +02:00
Campbell Barton
6b9a500a3a Cleanup: disambiguate terms "name", "file" & "str" / "string"
- Rename name/filename/path to filepath when it's used for full paths.
- Rename name/path to dirpath when it refers to a directory.
- Rename file to filepath or path (when it may be a file or dir).
- Rename ImBuf::name & anim::name to filepath.
2023-05-03 15:26:14 +10:00
Erik Abrahamsson
5b876b810f Fix #106776: Volume cube won't render in Cycles
In some cases the Geometry Nodes Volume Cube generates
a Volume grid that doesn't contain any leaf nodes. This can happen
when only tiles are needed to represent the volume.

This PR changes the `empty_grid` check function to also check if
there are any active tiles in the grid before returning `true`.

Pull Request: https://projects.blender.org/blender/blender/pulls/107551
2023-05-02 20:13:58 +02:00
Campbell Barton
a0db0a5580 Cleanup: move comments wrapped with MultiLine control statements
In some cases comments at the end of control statements were wrapped
onto new lines which made it read as if they applied to the next line
instead of the (now) previous line.

Relocate comments to the previous line or in some cases the end of the
line (before the brace) to avoid confusion.

Note that in quite a few cases these blocks didn't read well
even before MultiLine was used as comments after the brace caused
wrapping across multiple lines in a way that didn't follow
formatting used everywhere else.
2023-05-02 09:54:48 +10:00
Campbell Barton
6859bb6e67 Cleanup: format (with BraceWrapping::AfterControlStatement "MultiLine") 2023-05-02 09:37:49 +10:00
Aldo Bleeker
d68ed238b9 Cycles: solve compilation errors with OptiX 7.7
* User simpler API names that accept both PTX and OptiX-IR
* New argument for optixProgramGroupGetStackSize, leave to default
* Remove OptixPipelineLinkOptions::debugLevel that does nothing

Pull Request: https://projects.blender.org/blender/blender/pulls/107450
2023-05-01 12:07:26 +02:00
Jesse Yurkovich
97222519de Fix #106945: IES file parsing failures
There were two issues here preventing the proper display of the IES
files in question.

The primary one was that these lights are actually vertical. Their
profiles actually point upwards from 90deg to 180deg but our parser was
trying hard to adjust it to start at 0deg incorrectly.

Lastly, the files in question ended with the parser in the `eof`
state - they are "missing" the final carriage return that other IES
files tend to have but other viewers don't seem to mind. Change the
`eof` check instead for a better one that will indicate if any parsing
errors occurred along the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/107320
2023-04-28 23:29:04 +02:00
Brecht Van Lommel
5b69be00a6 Fix Cycles MetalRT not working after recent oneAPI changes
Forgot to initialize the device info.
2023-04-28 19:54:49 +02:00
Xavier Hallade
252b0a023e Cycles: use intrinsics for fast_rint
MSVC can't optimize it out and even keeps an external call to CRT
function rintf: https://godbolt.org/z/Ex9vjf8vj

It does translate to a real speedup on windows on some scenes, here are the ratios I had on my 13900K:
classroom	101.53%
junkshop	100.71%
monster	100.76%
attic	107.98%
bistro	113.00%

Pull Request: https://projects.blender.org/blender/blender/pulls/107371
2023-04-28 18:49:46 +02:00
Sergey Sharybin
7738f93d56 Cycles: Support newer version of sse2neon
Since the version v1.5.0 of sse2neon the functionality for denormals
flushing is implemented in the library. This commit makes it so the
_MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE are used from
the ss2neon if available.

This solves macro re-definition when a newer sse2neon is used.

The change is implemented in a way that both current and new sse2neon
are supported.
2023-04-28 17:36:02 +02:00
Sergey Sharybin
86a14faf69 Fix CUDA/OptiX compilation error in Cycles
Apparently, it does not seem to support hex notation for
floating point values.

Pull Request: https://projects.blender.org/blender/blender/pulls/107424
2023-04-28 10:51:03 +02:00
Sergey Sharybin
02b5c04b2b Fix intersection distance offset in Cycles
The intersection distance offset in Cycles could have returned
a denormal floating point value for the input values of 0 (and
for the denormal input value).

This could lead to a situation when ray is unable to be advanced
when it hits an edge between two triangles: the intersection will
keep bouncing between two adjacent triangles. This is because the
ray->tmin is compared inclusively, and 0 >= <denormal zero>.

The solution is to return the smallest possible normalized floating
point value from the intersection_t_offset if the input is zero
or a denormal value (which is covered by the same t == 0 check).

This fix is hard to measure on the user level. The old code did
not cause any infinite traversal loop because of the way how the
integration is organized (some kernels offset ray.P, others check
for the number of bounces). It is possible that this fixes some
corner cases of noise: i.e. if some shadow rays falsefully were
considered occluded due to reached maximum number of bounces.

The actual problematic case was discovered during working on a
prototype which had an in-lined intersection loop with the ray
tmin offset.

Pull Request: https://projects.blender.org/blender/blender/pulls/107364
2023-04-26 11:36:37 +02:00
Campbell Barton
db1af0e325 Cleanup: spelling in comments 2023-04-26 16:14:07 +10:00
Sahar A. Kashi
557a245dd5 Cycles: add HIP RT device, for AMD hardware ray tracing on Windows
HIP RT enables AMD hardware ray tracing on RDNA2 and above, and falls back to a
to shader implementation for older graphics cards. It offers an average 25%
sample rendering rate improvement in Cycles benchmarks, on a W6800 card.

The ray tracing feature functions are accessed through HIP RT SDK, available on
GPUOpen. HIP RT traversal functionality is pre-compiled in bitcode format and
shipped with the SDK.

This is not yet enabled as there are issues to be resolved, but landing the
code now makes testing and further changes easier.

Known limitations:
* Not working yet with current public AMD drivers.
* Visual artifact in motion blur.
* One of the buffers allocated for traversal has a static size. Allocating it
  dynamically would reduce memory usage.
* This is for Windows only currently, no Linux support.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref #105538
2023-04-25 20:19:43 +02:00