Commit graph

11866 commits

Author SHA1 Message Date
Philipp Oeser
1925c62d5f Fix #106425: Mantaflow guiding with domains is broken
Caused by e968b4197b / 67e23b4b29

Since culprit commits, we are not running `MANTA::initGuiding` /
`fluid_alloc_guiding` if guiding is meant to be pulled from other
domains (it does work with effectors though). This is because atm. only
the `FLUID_DOMAIN_ACTIVE_GUIDE` flag sets `mUsingGuiding` to true
(activated in `update_obstacleflags`, so only for effectors).

So to fix this, we have to ensure that `MANTA::initGuiding` runs (also
if guiding is pulled from domains), but also make sure we dont run into
the crashes from T102257.

It seems that the real reason we were getting crashes in T102257 is that
67e23b4b29 made it so that resetting the cache (including a call to
`fluid_modifier_reset_ex`) in `fluid_modifier_processDomain` happens
**after** `FluidDomainSettings.active_fields` have been updated (this
happens in `update_flowsflags` & `update_obstacleflags`).
But `fluid_modifier_reset_ex` also resets
`FluidDomainSettings.active_fields`. If we then update pointers later in
`fluid_modifier_processDomain`, we never get anything in the guiding
related pointers for the new `mCurrentID` (specifically `mPhiGuideIn`
will be a nullptr). This is the real reason `initGuiding()` runs a
second time (it does once for `fluid_modifier_init` then again as a
consequence of the call to `manta_guiding`).

This patch proposes to move the resetting process from 67e23b4b29
**above** the refreshing of the `FluidDomainSettings.active_fields`,
this way these field stay intact, we do get the first run of
`initGuiding()` from `fluid_modifier_init`, manta pointers get updated
with intact fields afterwards (so we then get a valid `mPhiGuideIn`),
which then prevents the second run from `manta_guiding` to actually call
the python script again.

The fix from e968b4197b is then not needed and reverted in this patch.

This should be good for LTS I think.

Pull Request: https://projects.blender.org/blender/blender/pulls/117067
2024-02-14 16:11:37 +01:00
Brecht Van Lommel
e0bc6794cf Cleanup: make format 2024-01-11 14:54:41 +01:00
bsavery
9673fa2720 Cycles: add ROCm 6 compatibility for HIP
ROCm 6 brings some changes to the HIP API. This pull request is meant to be
backward and forward compatible.

That is Blender could be compiled with either ROCM 6 or 5 and run on either.
The main change is the hipMemoryType enum, which we check based on the
runtime version to use the correct enum values.

Without this, HIP will not work on Windows with upcoming 23.40 driver.

Pull Request: https://projects.blender.org/blender/blender/pulls/116713
2024-01-03 18:17:18 +01:00
Patrick Mours
6b09a0277b Fix #113325: Zero-sized curve leads to OptiX error
Empty hair geometry in Cycles may still report having one curve, even when
there are no actual segments in that curve. This caused an attempt to build
an acceleration structure with zero primitives, which due to other setup
OptiX rejected with an error. Fix that by checking the number of segments
rather than the number of curves in the hair geometry, since the former will
always be zero for empty geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/115044
2023-12-06 15:25:04 +01:00
Brecht Van Lommel
3952869b90 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-11-14 13:31:19 +01:00
Sergey Sharybin
9e09f60cf2 Fix #112935: Wrong window order handling on macOS 14
The issue was caused by the custom code which was ensuring that closing
About window does not leave application without any key
windows.

Turns out that the windowWillClose is executed when menu is closed,
forcing the custom code to ensure a key window.

The solution is to only perform manual re-ordering if the closing window
was a key window. This both keeps old behavior of ensuring there is a
key window after closing About, and solves the ordering issues when a
window is created or activated via menus.

Pull Request: https://projects.blender.org/blender/blender/pulls/113515
2023-11-14 13:30:33 +01:00
Alaska
ee2e231adc Fix #111277: NaN in Vector Displacement leading to render errors
Fixes NaN in Vector Displacement node caused by the normalization of
0, 0, 0 vectors.

This fixes both visual rendering issues and an "illegal address" error
on the GPU. The "illegal address" error came from the Light Tree
Sampling code not handling the NaN normals well, leading to weird code
paths being taken, eventually leading to a kernel_assert and a
user facing illegal address error.

In Blender 3.5+, this fixes two errors (visual artifacts and errors on
the GPU when using the light tree). In Blender 3.3 it only fixes one
(visual artifacts) because 3.3 doesn't have the light tree. The commit
message should be adjusted to represent that

Pull Request: https://projects.blender.org/blender/blender/pulls/111294
2023-09-13 13:41:02 +02:00
Brecht Van Lommel
a66d09f2b5 Fix T103960: build issue with GCC 13 in Cycles thread code 2023-09-13 12:49:28 +02:00
Sebastian Parborg
11c94fcb23 Fix ffmpeg warnings due to missing header include 2023-06-16 15:26:54 +02:00
Timo Gurr
7227e11f21 Fix: Build with FFmpeg 6.0
Pull Request #105377
2023-06-16 15:26:31 +02:00
Sebastian Parborg
edf31df7e8 Fix support for building with ffmpeg < 5.0
Seems like the new audio channel api was not as backwards compatible as we thought.
Therefore we need to reintroduce the usage of the old api to make older ffmpeg version be able to compile Blender.

This change is only intended to stick around for two releases or so. After that we hope that most Linux distros ship
ffmpeg >=5.0 so we can switch to it.

Reviewed By: Sergey

Differential Revision: http://developer.blender.org/D16408
2023-06-16 15:13:51 +02:00
Brad Smith
4b8e980848 Build: fix NetBSD error in guardedalloc
Pull Request: https://projects.blender.org/blender/blender/pulls/108831
2023-06-15 13:27:39 +02:00
Sebastian Parborg
d7deddfc96 Fix building with boost >= 1.81
In boost 1.81 they no longer implicitly include <iostream> anymore.
2023-06-15 13:23:10 +02:00
Brad Smith
789f6911f5 Libmv: Remove FreeBSD sincos() workaround
Pull Request: https://projects.blender.org/blender/blender/pulls/108346
2023-06-15 13:17:44 +02:00
Brad Smith
ca660b09fb Build: fix OpenBSD error in guardedalloc
Pull Request: https://projects.blender.org/blender/blender/pulls/108252
2023-06-15 13:06:05 +02:00
Aldo Bleeker
632af7d253 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-15 15:28:33 +02:00
Brad Smith
e7e359f982 Build: fixes for OpenBSD
Pull Request: https://projects.blender.org/blender/blender/pulls/107666
2023-05-15 14:31:47 +02:00
Erik Abrahamsson
c4b2f6fb6a 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-15 14:25:03 +02:00
Brecht Van Lommel
8f77893d26 Fix #106405: Cycles multi GPU crash with vertex color baking
Avoid division by zero when one of the devices gets no work.
2023-05-15 12:32:39 +02:00
Weizhen Huang
c2b517950a Fix #106394: motion triangles could have unnormalized normals 2023-04-12 14:12:00 +02:00
Xavier Hallade
581d1f396b Cycles: fix rendering with Nishita Sky Texture on Intel Arc GPUs in 3.3
This is a backport of 1c90f8209d.

Pull Request #104781
2023-02-15 15:11:46 +01:00
Lukas Stockner
faca2c614b Fix T103507: Distant lights partially contribute to wrong lightgroup
The the BSDF-sampling half of MIS next-event estimation for distant lights was
using the background lightgroup instead of the lamp's lightgroup.
2023-01-14 02:34:03 +01:00
Lukas Stockner
d290b8b2b9 Fix T103403: Lightgroup passes can contain lighting on shadow catchers 2023-01-14 02:10:28 +01:00
Philipp Oeser
6191b726aa Fix T103615: OSL image box mapping has flipped textures
This breaks backwards compatibility some in that 3 sides will be mapped
differently now, but difficult to avoid and can be considered a bugfix.

Similar to rBdd8016f7081f.

Maniphest Tasks: T103615

Differential Revision: https://developer.blender.org/D16910
2023-01-12 22:08:01 +01:00
Brecht Van Lommel
3029bd2b0c Fix T102942: Cycles wrong alpha for multi-layer PSD files 2023-01-12 21:59:31 +01:00
Aras Pranckevicius
427b0a0ab2 Fix T101850: Cycles DDS oversaturation when alpha is in use
DDS files coming through OIIO needed a similar treatment as TGA in
T99565; just for DDS OIIO just never set the "unassociated alpha"
attribute. Fixes T101850.

Reviewed By: Brecht Van Lommel
Differential Revision: https://developer.blender.org/D16270
2023-01-12 21:57:00 +01:00
Brecht Van Lommel
d2050c7c36 Fix T102990: OpenVDB files load very slow from network drives
The OpenVDB delay loading of voxel leaf data using mmap works poorly on network
drives. It has a mechanism to make a temporary local file copy to avoid this,
but we disabled that as it leads to other problems.

Now disable delay loading entirely. It's not clear that this has much benefit
in Blender. For rendering we need to load the entire grid to convert to NanoVDB,
and for geometry nodes there also are no cases where we only need part of grids.
2023-01-12 15:40:19 +01:00
Brecht Van Lommel
86abbf7176 Fix macOS build error after recent changes to enable Intel GPUs
This will only work once we upgrade to the macOS 13 SDK.

Ref D16253
2022-11-28 19:21:50 +01:00
Morteza Mostajab
f9f834068e Cycles: Allow Intel GPUs under Metal
Known Issues:
- Command buffer failures when using binary archives (binary archives is disabled for Intel GPUs as a workaround)
- Wrong texture sampler being applied (to be addressed in the future)

Ref T92212

Differential Revision: https://developer.blender.org/D16253
2022-11-28 19:20:41 +01:00
Michael Jones
3e247f0f76 Cycles: Enable MetalRT pointclouds & other fixes
Differential Revision: https://developer.blender.org/D16499
2022-11-28 19:20:29 +01:00
Michael Jones
021c8c7cd0 Cycles: Tweak inlining policy on Metal
This patch optimises the Metal inlining policy. It gives a small speedup
(2-3% on M1 Max) with no notable compilation slowdown vs what is already
in master. Previously noted compilation slowdowns (as reported in T100102)
were caused by forcing inlining for `ccl_device`, but we get better
rendering perf by relying on compiler heuristics in these cases.

Backported to 3.3 because this also fixes a test failure.

Differential Revision: https://developer.blender.org/D16081
2022-11-28 19:18:36 +01:00
Sayak Biswas
3e41332798 Cycles: enable AMD RDNA3 GPUs and upgrade HIP compiler
* Enable AMD RDNA3 GPUs
* Fix T100891: performance regression with RDNA2 cards
* Workaround new compiler issue with Vega, by using -O1

Differential Revision: https://developer.blender.org/D16507
2022-11-28 15:01:19 +01:00
Germano Cavalcante
e968b4197b Fix T102257: Crash when making an Object as Effector set to Guide and trying to scrub the timeline
rB67e23b4b2967 revealed the bug. But the bug already existed before,
it just wasn't triggered.

Apparently the problem happens because the python code generated in
`initGuiding()` cannot be executed twice.

The second time the `initGuiding()` code is executed, the local python
variables are removed to make way for the others, but the reference to
one of the grids in a `Solver` object (name='solver_guiding2') is still
being used somewhere. So an error is raised and a crash is forced.

The solution is to prevent the python code in `initGuiding()` from being
executed twice.

When `FLUID_DOMAIN_ACTIVE_GUIDE` is in `fds->active_fields` this
indicates that the pointer in `mPhiGuideIn` has been set and the guiding
is already computed (does not need to be computed again).

Maniphest Tasks: T102257

Differential Revision: https://developer.blender.org/D16416
2022-11-28 15:00:10 +01:00
Germano Cavalcante
29bc410c8a Fix T89399: Mouse wrapping causes erratic movement
As mentioned in T89399, "the source of this bug is that cursor wrap
moves the cursor, but when it later checks the mouse position it hasn't
yet been updated, so it re-wraps".

As far as I could see, this happens for two reasons:
1. During the first warp, there are already other mousemove events in the queue with an outdated position.
2. Sometimes Windows occasionally and inexplicably ignores `SetCursorPos()` or `SendInput()` events. (See [1])

The solution consists in checking if the cursor is inside the bounds right after wrapping.
If it's not inside, it indicates that the wrapping either didn't work or the event is out of date.
In these cases do not change the "accum" values.

1. f317d619cc/src/video/windows/SDL_windowsmouse.c (L255))

Maniphest Tasks: T89399

Differential Revision: https://developer.blender.org/D15707
2022-11-28 14:31:02 +01:00
Brecht Van Lommel
ee8d32b1d9 Fix T101669: Cycles artifacts in bump map baking
After barycentric convention changes, the differentials used for bump mapping
were wrong leading to artifacts with long thin triangles.
2022-11-28 14:16:57 +01:00
Lukas Stockner
d5acb2b2fe Fix T94136: Cycles: No Hair Shadows with Transparent BSDF 2022-11-28 12:29:03 +01:00
Thomas Dinges
b7b9e670ce Fix T101020: Cycles Add Performance Preset is broken 2022-11-24 10:19:26 +01:00
Lukas Stockner
15b2b53b87 Fix T92416: First render with unknown image colorspace looks different
The issue here was that the Barbershop benchmark scene was saved with a
custom OCIO config, which leads to some textures having a unknown
colorspace when loading with a default installation.

This is automatically fixed by Blender during image loading, but since
Cycles queried the colorspace before actually loading the image, it
didn't get the updated value in the first render.

To fix this, just re-query the colorspace after the image is loaded.

Note that non-packed images still get treated as raw data if the
colorspace is unknown, but this is at least consistent and doesn't
magically change when you press F12 a second time.

Differential Revision: https://developer.blender.org/D16427
2022-11-17 16:31:41 +01:00
Brecht Van Lommel
9f5a2d8788 Fix Cycles build error on 32bit x86 2022-10-31 20:29:50 +01:00
Sergey Sharybin
2b2fc6d759 Fix missing OpenMP in Linux builds
OpenSubdiv OpenMP detection was interfering, but we don't use it there
anymore so just remove that code.
2022-10-31 20:29:50 +01:00
Brecht Van Lommel
94ec66c2f2 Fix T99565: Cycles reading TGA files with alpha different than Blender
Thanks to Lukas for tracking down the cause in OIIO.
2022-10-26 11:53:29 +02:00
Lukas Stockner
30774f01cd Fix T98672: Noise texture shows incorrect behaviour for large scales
This was a floating point precision issue - or, to be more precise,
an issue with how Cycles split floats into the integer and fractional
parts for Perlin noise.
For coordinates below -2^24, the integer could be wrong, leading to
the fractional part being outside of 0-1 range, which breaks all sorts
of other things. 2^24 sounds like a lot, but due to how the detail
octaves work, it's not that hard to reach when combined with a large
scale.

Since this code is originally based on OSL, I checked if they changed
it in the meantime, and sure enough, there's a fix for it:
5c9dc68391

So, this basically just ports over that change to Cycles.

The original code mentions being faster, but as pointed out in the
linked commit, the performance impact is actually irrelevant.

I also checked in a simple scene with eight Noise textures at
detail 15 (with >90% of render time being spent on the noise), and
the render time went from 13.06sec to 13.05sec. So, yeah, no issue.
2022-10-26 11:37:45 +02:00
Lukas Stockner
5ff62df238 Cycles: Fix floor intrinsic for ARM Neon 2022-10-26 11:37:12 +02:00
Campbell Barton
9f8ece70ee Fix T101776: wrong logic for GLX setSwapInterval
Regression in 93e4b15767.
2022-10-26 11:14:14 +02:00
Lukas Stockner
3d7f298e9a Fix T101651: Cycles crashes when failing to initialize render device
The issue here was that PathTraceWork was set up before checking if
any error occurred, and it didn't account for the dummy device so
it called a non-implemented function.

This fix therefore avoids creating PathTraceWork for dummy devices
and checks for device creation errors earlier in the process.
2022-10-26 10:13:11 +02:00
Lukas Stockner
7e942b2a1e Partially fix T101702: OSL Shaders with boolean inputs crash
OSL (like Cycles) has no internal boolean type, instead an integer
input can be flagged to be shown as a boolean in the UI.
Cycles reacts to this by creating a boolean socket on the Blender
side, but as a result incorrectly called the boolean overload of the
set function even though the internal type is an integer.

There's another unrelated crash in the GPU viewport shader code that
appears to apply to every OSL node that outputs a shader, and the file
in T101702 triggers both, so this is only a partial fix for the report.
2022-10-26 10:11:55 +02:00
Hans Goudey
fcc291bbf9 Fix T101025: Cycles motion blur crash with changing point cloud size
Caused by 410a6efb74 which didn't properly use the
smallest size between the Cycles and Blender point clouds.
2022-10-26 09:46:15 +02:00
Michael Jones
2653775c66 Cycles: Disable binary archives on macOS < 13.0
(Cherry pick D16082)
An bug with binary archives was fixed in macOS 13.0 which stops some spurious kernel recompilations. In older macOS versions, falling back on the system shader cache will prevent recompilations in most instances (this is the same behaviour as in Blender 3.1.x and 3.2.x).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16141
2022-10-04 19:09:29 +01:00
Xavier Hallade
a6c27ea49d Cycles: increase min-supported driver version for Intel GPUs
Windows drivers 101.3430 fix an important GUI-related crash and it's
best to prevent users from running into it.
Linux drivers weren't affected but still had relevant gpu binary
compatibility fixes, so it makes sense to keep the min-supported version
aligned across OSes.
2022-09-30 14:42:09 +02:00
Brecht Van Lommel
753dea79a3 UI: add preference to disable touchpad multitouch gestures
Available on Windows and macOS, where such gestures are supported.
For Windows, disabling this option restores touchpad behavior to
match Blender 3.2.

Ref T97925

Differential Revision: https://developer.blender.org/D16005
2022-09-26 23:04:41 +02:00