Commit Graph

13820 Commits

Author SHA1 Message Date
Weizhen Huang 92c4a5fa09 Fix Principled Hair Huang wrong TIR condition
`cos_theta_t` was not initialized for TIR case

Thanks Christophe Hery for spotting the bug
2024-02-23 12:28:23 +01:00
Weizhen Huang 65d910aef7 Fix wrong roughness in Principled Hair Huang trrt+ component 2024-02-23 12:28:08 +01:00
Jeroen Bakker 5698fb2049 RenderDoc: Set Capture Title
Adds an option to set the capture title when using renderdoc
`GPU_debug_capture_begin` has an optional `title` parameter to set
the title of the renderdoc capture.

Pull Request: https://projects.blender.org/blender/blender/pulls/118649
2024-02-23 10:57:37 +01:00
Brecht Van Lommel b0b1c55a49 Merge branch 'blender-v4.1-release' 2024-02-22 19:08:48 +01:00
Alaska 56bfd56735 Fix: Cycles incorrect rendering of certain negative strength lights
This fixes an issue where lights that make use of constant negative strength
emission shaders would render with the absolute of their strength.

Pull Request: https://projects.blender.org/blender/blender/pulls/118541
2024-02-22 19:06:22 +01:00
Hans Goudey caf567e241 Cleanup: Resolve unused variable warning in GHOST EGL code 2024-02-22 12:45:57 -05:00
Weizhen Huang a3f0ff6184 Cycles: make Principled Hair Huang a near- and far-field model
for a camera ray, compute the actual range of the hair width that the
current pixel covers, and only integrate that subset, to prevent a
ribbon-like appearance in close-up looks.
When the hair covers less than one pixel on the screen or when the ray
is not camera ray, the model works the same as before.

Pull Request: https://projects.blender.org/blender/blender/pulls/116094
2024-02-22 18:18:14 +01:00
Weizhen Huang 8a47c6b169 Cleanup: simplify computation of `h_to_gamma()` in Principled Hair Huang 2024-02-22 18:18:13 +01:00
Weizhen Huang 1906a14cf3 Refactor: pre-compute valid integration interval in Principled Hair Huang
The valid interval from incoming direction was shared between
`...eval_r()` and `...eval_residual()`, so compute that in `...eval()` instead.
The valid interval from outgoing direction was computed for
`...eval_r()` to further reduce the integration interval. This part is
removed because the check `dot(wo, wm) > 0` is relatively cheap inside the loop.
2024-02-22 18:18:13 +01:00
Weizhen Huang c592fa14f1 Cycles: adjust normal in Principled Hair Huang to be orthogonal to the tangent
The geometry normal of the curve might not be precisely orthogonal to
the tangent due to interpolation. Previously, the tangent was adjusted
to be orthogonal to the normal. However, the normal is linearly
interpolated, which is less accurate than the tangent computed using Catmull-Rom.
This commit keeps the tangent and adjust the normal instead, besides
better accuracy, it ensures a smooth transition when the cross-section
shifts between circular and elliptical.
2024-02-22 18:18:13 +01:00
Weizhen Huang 1d8ec32473 Fix Cycles area light using MIS when the spread is zero
area light with zero spread was introduced in bf18032977. Such paths can
only be sampled with NEE, so MIS should not be used.
This fixes the discrepancy when Direct Light Sampling is set to MIS or NEE.

Pull Request: https://projects.blender.org/blender/blender/pulls/118584
2024-02-22 17:10:46 +01:00
Weizhen Huang 69f26a7c18 Fix assigning value to nullptr 2024-02-22 15:45:33 +01:00
Weizhen Huang 5782555c47 Merge branch 'blender-v4.1-release' 2024-02-22 12:26:37 +01:00
Weizhen Huang 0007c7a6b2 Fix #115997: Emission sampling setting ignored when not using light tree
if emission sampling is not set, we do not use MIS weight when sampling
from the BSDF, but we were still drawing samples from the light,
resulting in double contribution.

Pull Request: https://projects.blender.org/blender/blender/pulls/118534
2024-02-22 12:24:12 +01:00
Weizhen Huang 6f4ef97962 Cleanup: avoid implicit conversion from int to float 2024-02-22 12:09:58 +01:00
Weizhen Huang ca389c7b56 Fix Principled Hair Huang wrong TIR condition
`cos_theta_t` was not initialized for TIR case

Thanks Christophe Hery for spotting the bug
2024-02-22 12:09:58 +01:00
Weizhen Huang 0550d864f1 Fix wrong roughness in Principled Hair Huang trrt+ component 2024-02-22 12:09:58 +01:00
Brecht Van Lommel ca8a7c7054 Merge branch 'blender-v4.1-release' into main 2024-02-21 18:35:59 +01:00
Brecht Van Lommel 4c708a8c3e Linux: Avoid XDG_RUNTIME_DIR warnings running headless Blender
Pull Request: https://projects.blender.org/blender/blender/pulls/118530
2024-02-21 18:35:15 +01:00
Brecht Van Lommel 873472b747 Linux: Improve headless EGL initialization messages
When it succeeds, don't print an error message. When it fails, print
errors for both display and headless attempts.

Pull Request: https://projects.blender.org/blender/blender/pulls/118530
2024-02-21 18:35:10 +01:00
Bastien Montagne 4e544e5e59 Merge branch 'blender-v4.1-release' 2024-02-21 18:19:01 +01:00
Jacques Lucke 8ea425d95d Fix #118402: enforce expected minimum alignment in MEM_CXX_CLASS_ALLOC_FUNCS
This `operator new` added in ecc3e78d78
are only called if the alignment is greater than `__STDCPP_DEFAULT_NEW_ALIGNMENT__`.
This is generally 8 or 16 depending on the platform. `MEM_mallocN` does
guarantee 16 byte alignment currently (in fact it's usually not 16 byte aligned
because of `MemHead`). Now `MEM_mallocN_aligned` is used with the default
alignment, even if we don't know that the type does not require it.

An alternative would be to pass the alignment to `MEM_CXX_CLASS_ALLOC_FUNCS`,
but that would be more intrusive.

Pull Request: https://projects.blender.org/blender/blender/pulls/118568
2024-02-21 18:14:11 +01:00
Campbell Barton 63f482d550 Merge branch 'blender-v4.1-release' 2024-02-21 14:10:00 +11:00
Campbell Barton 479b46ca93 Fix #117896: Key-modifiers on window activation fails under Wayland
Register the last held key when activating a window
(not only modifiers keys) under Wayland.

This resolves a bug where holding the D-key and clicking on a window
wouldn't activate grease pencil drawing.
2024-02-21 14:09:04 +11:00
Jacques Lucke 4c15ce5ad5 Merge branch 'blender-v4.1-release' 2024-02-20 18:45:07 +01:00
Jacques Lucke ecc3e78d78 Fix #118402: support overaligned types in MEM_CXX_CLASS_ALLOC_FUNCS
Previously, the alignment of structs that use `MEM_CXX_CLASS_ALLOC_FUNCS`
were not taken into account when doing the allocation. This can cause some data
to be mis-aligned and leads to crashes when cpu instructions or code expect the
data to be aligned.

The fix is to provide an overload of `operator new` that accepts the alignment as parameter.

More info: https://en.cppreference.com/w/cpp/language/new (search for `align_val_t`).

Pull Request: https://projects.blender.org/blender/blender/pulls/118526
2024-02-20 18:44:26 +01:00
Lukas Stockner 06b42313a6 Cleanup: Cycles: Replace cos with cosf 2024-02-20 02:57:29 +01:00
Harley Acheson 9e852d9471 UI: Mac Incorrect Hand Cursor for Move
On the MacOS platform, use openHandCursor for GHOST_kStandardCursorMove
not pointingHandCursor. This cursor is meant to indicate an item that
you can move or adjust. The pointingHandCursor is meant for links to
documents, web pages, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/118423
2024-02-19 18:00:36 +01:00
Brecht Van Lommel 0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
2024-02-19 15:59:59 +01:00
Hans Goudey 81a63153d0 Despgraph: Rename "copy-on-write" to "copy-on-evaluation"
The depsgraph CoW mechanism is a bit of a misnomer. It creates an
evaluated copy for data-blocks regardless of whether the copy will
actually be written to. The point is to have physical separation between
original and evaluated data. This is in contrast to the commonly used
performance improvement of keeping a user count and copying data
implicitly when it needs to be changed. In Blender code we call this
"implicit sharing" instead. Importantly, the dependency graph has no
idea about the _actual_ CoW behavior in Blender.

Renaming this functionality in the despgraph removes some of the
confusion that comes up when talking about this, and will hopefully
make the depsgraph less confusing to understand initially too. Wording
like "the evaluated copy" (as opposed to the original data-block) has
also become common anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/118338
2024-02-19 15:54:08 +01:00
Brecht Van Lommel 05f6a32b18 Merge branch 'blender-v4.1-release' into main 2024-02-19 13:18:27 +01:00
bartus 5d06b7b906 Cycles: Add support for OpenPGL 0.6.0
Replace PGLFieldArguments with FieldConfig class for this version.

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

Pull Request: https://projects.blender.org/blender/blender/pulls/118328
2024-02-19 12:36:04 +01:00
Harley Acheson 4acbda91f8 Merge branch 'blender-v4.1-release' 2024-02-17 11:30:55 -08:00
Harley Acheson a677518cb5 Fix #118351: Pixel Shift with Win32 Clipboard DibV5 Image Transfer
My misreading of the Microsoft BITMAPV5HEADER specification causes a
shift of three pixels when transferring between applications using this
format. This does not occur when moving within or between Blender
instances. This PR just removes the incorrect 12-byte offset. Note
that many applications prefer PNG transfers over DibV5 so testing this
might be non-obvious.

Pull Request: https://projects.blender.org/blender/blender/pulls/118417
2024-02-17 20:29:41 +01:00
Campbell Barton c47c1275a9 Merge branch 'blender-v4.1-release' 2024-02-17 14:57:07 +11:00
Campbell Barton a8ca12f2a8 Fix #118233: No preference to disable multi-touch gestures on Wayland
Support this preference for Wayland, following macOS & WIN32 support.
2024-02-17 14:55:12 +11:00
Brecht Van Lommel 7453c5ed67 Merge branch 'blender-v4.1-release' into main 2024-02-16 19:31:31 +01:00
Raul Fernandez 324ff4ddef macOS: Remove unnecessary checks now that minimum version is macOS 11.2
MacOS minimum version is now 11.2 we no longer need to check for lower API versions.

Pull Request: https://projects.blender.org/blender/blender/pulls/118388
2024-02-16 19:03:23 +01:00
Campbell Barton 07ff3bcb70 GHOST/Wayland: support dropping text
This matches X11's support for GHOST_kDragnDropTypeString.

Dropping URL's from a web-browser uses this mime-type.
2024-02-16 14:27:00 +11:00
Campbell Barton 82c753a940 GHOST/Wayland: drag & drop cleanup, minor changes
- Don't generate a drop event when the drop data failed to read.
- Remove redundant drop-buffer duplication.
2024-02-16 14:26:58 +11:00
Campbell Barton 67481dcd47 Merge branch 'blender-v4.1-release' 2024-02-15 21:22:56 +11:00
Campbell Barton 4b7d44d015 Fix incorrect use of sizeof() for Wayland
The size of the string in bytes happened to match the the pointer size
on 64bit systems, nevertheless the logic was wrong would would fail on
32bit systems. Also use a character to search the string instead of a
single character string.
2024-02-15 20:56:45 +11:00
Hans Goudey e6c919830c Cleanup: Remove unused logging macros that free the input string 2024-02-14 21:08:58 -05:00
Campbell Barton bdd40f167e Merge branch 'blender-v4.1-release' 2024-02-15 11:03:42 +11:00
Hans Goudey a52323d711 Cleanup: Move BKE_duplilist.hh to C++ 2024-02-14 10:51:46 -05:00
Brecht Van Lommel 088ae8d905 Build: Remove LLVM linking no longer needed by OSL
These are now included in the OSL shared libraries, so no reason to
link against it.

The CMake code for WITH_LLVM remains in case it is useful in the future,
but is not enabled by any Blender feature now.

Pull Request: https://projects.blender.org/blender/blender/pulls/118229
2024-02-14 12:06:52 +01:00
Campbell Barton 156fffbfde Merge branch 'blender-v4.1-release' 2024-02-14 14:29:55 +11:00
Brecht Van Lommel dd382be067 Fix #118020: Cycles OptiX OSL crashes
Turns out we were not building OSL with OptiX enabled anymore.
Also check now if the OSL builds has OptiX support and if not
disable it in Cycles.

Building OSL with support for this (still) does not require
either the OptiX SDK or CUDA, it only needs LLVM.

Pull Request: https://projects.blender.org/blender/blender/pulls/118234
2024-02-14 03:40:01 +01:00
Damien Picard 1410615079 Nodes: expose multi-input sockets to custom nodes in the Python API
Currently the multi-input sockets are not exposed to the custom nodes
Python API. This makes some features cumbersome to implement if one
wants a node to process an arbitrary number of inputs.
One workaround is to make inputs duplicate themselves when a link is
created, but a proper multi-input would be easier to use for both
add-on developers and users.

This commit exposes a new `use_multi_input` boolean parameter when
creating a new node socket. This makes it possible to declare a
multi-input, while still leaving the existing `is_multi_input`
property read-only so that existing nodes cannot be made unstable.

The parameter is optional so existing scripts stay compatible. It also
raises an error when used on output sockets, since it makes no sense
for those to be multi-input.

The Custom Node Tree Python template was updated to reflect this
change by making one of the inputs of the custom node multi-input.

Pull Request: https://projects.blender.org/blender/blender/pulls/114474
2024-02-12 20:28:56 +01:00
Nikita Sirgienko c48ea92429 Merge branch 'blender-v4.1-release' 2024-02-12 18:16:19 +01:00
Attila Afra 7b8c438715 Fix: Set OIDN GPU memory limit for all filters 2024-02-12 18:13:23 +01:00
Campbell Barton 3dbbc013de Cleanup: spelling in comments 2024-02-10 22:35:35 +11:00
Thomas Dinges 30a22b92ca Cycles: Rename SSE4.1 kernel to SSE4.2
This commit updates all defines, compiler flags and cleans up some code for unused CPU capabilities.

There should be no functional change, unless it's run on a CPU that supports sse41 but not sse42. It will fallback to the SSE2 kernel in this case.

In preparation for the new SSE4.2 minimum in Blender 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/118043
2024-02-09 17:25:58 +01:00
Brecht Van Lommel 01f2c32700 Merge branch 'blender-v4.1-release' into main 2024-02-09 15:16:55 +01:00
Brecht Van Lommel 1e1a8d5c8f Fix: Cycles denoise fails with multi tile render and Use GPU off 2024-02-09 15:11:21 +01:00
Brecht Van Lommel f98468c988 Fix: Cycles uses GPU device for denoise even if disabled for scene 2024-02-09 15:02:46 +01:00
JonasDichelle f2e27ef7b6 Cycles: Override World option per View Layer
This feature is useful for many production scenarios as it allows for the
creation of separate render passes with specific worlds. This would help
workflows that require different skies or other backgrounds for compositing.

Ref #117919

Pull Request: https://projects.blender.org/blender/blender/pulls/117920
2024-02-09 12:16:16 +01:00
Sergey Sharybin 4196cbd175 Merge branch 'blender-v4.1-release' 2024-02-08 17:03:19 +01:00
Miguel Pozo 74b8f99b43 Render: Merge EEVEE and Cycles motion blur settings
Merge duplicated motion blur settings between Cycles and EEVEE,
and move them to `RenderData`/`scene.render`:
* `scene.cycles.motion_blur_position` -> `scene.render.motion_blur_position`
* `scene.eevee.use_motion_blur` -> `scene.render.user_motion_blur`
* `scene.eevee.motion_blur_position` -> `scene.render.motion_blur_position`
* `scene.eevee.motion_blur_shutter` -> `scene.render.motion_blur_shutter`

On the C/C++ side, this also renames `RenderData::blurfac` to
`RenderData::motion_blur_shutter`.

Pull Request: https://projects.blender.org/blender/blender/pulls/117913
2024-02-08 16:49:18 +01:00
Michael Jones 322a2f7b12 Cycles: Future-proof ordering of AppleGPUArchitecture enum
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/117982
2024-02-08 16:31:52 +01:00
Nikita Sirgienko 0ed2d3e260 Merge branch 'blender-v4.1-release' 2024-02-08 14:54:13 +01:00
Nikita Sirgienko 9d0b811da6 Fix #117931: Swap oidn device when changing "Use GPU" during viewport render 2024-02-08 14:53:12 +01:00
Campbell Barton 510a7ff452 Merge branch 'blender-v4.1-release' 2024-02-08 12:42:23 +11:00
Koranir bba1893f67 Fix crash with fractional scaling on Wayland with NVIDIA graphics
Ref: !117531
2024-02-08 12:34:35 +11:00
Campbell Barton 67c12236e6 GHOST/WIN32: remove start time offset from getMilliSeconds
This isn't necessary and has been removed from macOS & X11,
Wayland never did this.

Besides removing the offset GetTickCount() has been replaced by
GetTickCount64 to prevent 32bit rollover when high resolution timers
aren't supported.

Ref !117618
2024-02-08 08:53:34 +11:00
Attila Afra e7dcad8599 Fix: Release all OIDN GPU resources when recreating denoiser 2024-02-07 19:44:40 +01:00
Brecht Van Lommel bd8a44e169 Lights: Option to use old point light falloff
Add new "Soft Falloff" option on point and spot light that uses
the old light behavior from Blender versions before 4.0. Blend
files saved with those older versions will use the option.

This option is enabled by default on new lights.

Fix #114241

Co-authored-by: Weizhen Huang <weizhen@blender.org>
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/117832
2024-02-07 19:07:11 +01:00
Attila Afra 8e80b44796 Cycles: Fix initial OIDN GPU denoiser quality 2024-02-07 17:54:50 +01:00
Attila Áfra c1f55288e9 Fix: Cycles OIDN GPU denoiser bugs
- Incorrect accurate prefiltering of albedo and normal (lower than expected quality)
- Changing the prefiltering mode has no immediate effect
- Default memory limit is too high (more than OIDN default)
- Memory limit is applied only to the main filter
- Quality setting applied only to the main filter

Pull Request: https://projects.blender.org/blender/blender/pulls/117930
2024-02-07 13:34:35 +01:00
Nikita Sirgienko 06dc5363a9 Cycles: Denoise on CPU by default for offline render 2024-02-07 09:43:28 +01:00
Nikita Sirgienko 057b80dc9e Cycles: Log devices that are supported by OIDN 2024-02-06 23:40:57 +01:00
Nikita Sirgienko b2678156fa Cycles: Unify logging for devices discovery 2024-02-06 23:40:57 +01:00
Stefan Werner 31d55e87f9 Cycles: Metal support for OpenImageDenoise
This is supported on Apple Silicon GPUs and macOS 13.0+.

Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Co-authored-by: Attila Afra <attila.t.afra@intel.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/116124
2024-02-06 21:13:23 +01:00
Nikita Sirgienko 280b5c89ae Cycles: Set quality parameter for OIDN
OpenImageDenoise API exposes two modes, high quality and balanced.
This currently only has effect on Nvidia devices, on which it
provides a noticeable performance improvement without visible
difference in quality. This change sets quality to balanced for
the viewport, and high quality for final frame rendering, as
it's what makes the most sense.

Ref #115045

Co-authored-by: Werner, Stefan <stefan.werner@intel.com>
Pull Request: #115265
2024-02-06 20:58:17 +01:00
Nikita Sirgienko c174fd4e06 Cycles: Fix Python error in has_oidn_gpu_devices
Was introduced during refactoring in bc886857f3
2024-02-06 20:26:05 +01:00
Nikita Sirgienko 0100547515 Cycles: Gray out hardware raytracing checkboxes when not available
HWRT checkboxes visibility in the Cycles settings wasn't uniform across devices.
With this change, we unify it and gray out these in case HWRT isn't available.

Pull Request: https://projects.blender.org/blender/blender/pulls/117904
2024-02-06 20:06:13 +01:00
Hans Goudey d9266853c2 Cleanup: Make format 2024-02-06 12:42:26 -05:00
Nikita Sirgienko bc886857f3 Cycles: Option to disable OpenImageDenoise GPU per scene
To reduce memory usage if needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/117874
2024-02-06 17:46:21 +01:00
Damien Picard fa77e9142d UI: fix and improve a few messages
- "can not" -> "cannot" in many places (ambiguous, also see
  Writing Style guide).
- "Bezier" -> "Bézier": proper spelling of the eponym.
- Tool keymaps: make "Uv" all caps.
- "FFMPEG" -> "FFmpeg" (official spelling)
- Use MULTIPLICATION SIGN U+00D7 instead of MULTIPLICATION X U+2715.
- "LClick" -> "LMB", "RClick" -> "RMB": this convention is used
  everywhere else.
- "Save rendered the image..." -> "Save the rendered image...": typo.
- "Preserve Current retiming": title case for property.
- Bend status message: punctuation.
- "... class used to define the panel" -> "header": copy-paste error.
- "... class used to define the menu" -> "asset": copy-paste error.
- "Lights user to display objects..." -> "Lights used...": typo.
- "-setaudio require one argument" -> "requires": typo.

Some issues reported by Joan Pujolar and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/117856
2024-02-05 17:08:17 +01:00
Alaska a3183fb95f Fix #117771: Incorrect Cycles texture position on emissive triangles
Pull Request: https://projects.blender.org/blender/blender/pulls/117801
2024-02-05 13:56:18 +01:00
Nikita Sirgienko cab974920f Cycles: Remove incorrect dead code for CUDA 32bit textures
Pull Request: https://projects.blender.org/blender/blender/pulls/117818
2024-02-05 13:53:51 +01:00
Brecht Van Lommel 3b1230d318 Cycles: Remove workaround for failing bake tests
This appear to no longer be needed, and this type of memory does not
work with OpenImageDenoise.

Ref #116124
2024-02-05 12:19:21 +01:00
Lukas Stockner b10507ab63 Fix #117586: Cycles: World Lightgroup not updated when creating/deleting LGs 2024-02-04 16:30:55 +01:00
Lukas Stockner 8d7ecd0856 Cycles: Use high value for Transparent BSDF PDF
The transparent BSDF is singular, so MIS shouldn't be applied.

Fixes #117657.
2024-02-04 00:35:54 +01:00
Jacques Lucke 319b911784 Cleanup: move hash and ghash utils to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/117761
2024-02-02 19:55:06 +01:00
Campbell Barton 8b827a5bb5 Cleanup: spelling in comments 2024-02-02 10:48:22 +11:00
Brecht Van Lommel 1f142b3d44 Fix: Cycles MIS disabled unnecessarily with transparency, causing fireflies
This is a leftover from when there was a global option for transparent
shadows, but since it's now per material this makes no sense anymore.

Solution found by Olivier Maury.

Pull Request: https://projects.blender.org/blender/blender/pulls/117735
2024-02-01 21:23:28 +01:00
Sergey Sharybin 71253e1bb0 Fix Cycles baking forcing denoising of combined pass
This is mistake in the PR #117483

Simple solution: make the pass configuration logic to only disable
denoising, and never allow to enable it.

Pull Request: https://projects.blender.org/blender/blender/pulls/117723
2024-02-01 14:40:50 +01:00
Hans Goudey 7fa5fc02b7 Cleanup: Move BLF headers to C++ 2024-01-31 14:04:56 -05:00
Xavier Hallade 4d4f8bbfe4 Cycles: set num_sort_partition_elements to 8192 for oneAPI
The default value of 65536 wasn't optimal on Intel GPUs, switching to
8192 gives a 0 to 15% performance improvement depending on the scenes.
2024-01-31 17:25:34 +01:00
Xavier Hallade 18a20f373f Cycles: increase min Intel GPU driver version on Windows
With drivers 101.4972 to 101.5085, some Arc and Meteor Lake devices
ignore the prebuilt GPU binaries and since the addition of Meteor Lake
binaries, fail caching newly generated ones on Windows.
This got fixed in drivers 101.5186 so it's preferable to require these
new drivers to be used.
2024-01-31 12:49:30 +01:00
Alaska 58b9240c82 Cycles: Separate the caustics controls for Generalized Schlick
This allows users to turn off reflective and refractive caustics
separately from each other when using the Generalized Schlick material.

This will impact the Principled BSDF and Glass BSDF, along with some
custom OSL scripts.

Pull Request: https://projects.blender.org/blender/blender/pulls/117617
2024-01-30 10:31:32 +01:00
Alaska 7aca9a1ebb Fix #117611: Cycles NaN in microfacet BSDF with IOR 1.0
Pull Request: https://projects.blender.org/blender/blender/pulls/117622
2024-01-29 15:26:36 +01:00
Campbell Barton dab6515374 Cleanup: remove references to start time in X11
Missed from recent removal.
2024-01-29 11:53:43 +11:00
Campbell Barton a73419363c GHOST/SDL: use SDL_GetTicks64 to prevent wrapping the 32 bit uint time 2024-01-29 11:47:46 +11:00
Campbell Barton 05807b0662 GHOST/X11: remove start-time offset from getMilliSeconds
Remove since this isn't needed, not done by other platforms.
2024-01-29 11:47:45 +11:00
Campbell Barton 18eb7e7502 Cleanup: correct doc-strings for GHOST_GetMilliSeconds
Wayland, macOS & SDL weren't using the start-time of the process.

The start-time offset isn't needed so it's similar to forward the
systems method of accessing the time in milliseconds.
2024-01-29 11:47:43 +11:00
Campbell Barton be7f89a9f5 Cleanup: spelling in comments 2024-01-29 11:47:42 +11:00
Lukas Stockner 82811cf489 Cycles: Support Type-A IES files
Seems to be a fairly niche type, but some people (apparently mostly in the automotive space) use it.

Also improves the handling of IES files in general and lets Cycles accept IES files that are technically violating the spec - which seems to be most of them...

Pull Request: https://projects.blender.org/blender/blender/pulls/114689
2024-01-29 01:03:47 +01:00
Alaska e6a3d46fe5 Cycles: Improve handling of Principled BSDF Caustics settings
Improve the handling of Principled BSDF Caustics from Metallic
and Transmissive components, improving consistency between SVM and OSL,
and offering more predictable results.

Pull Request: https://projects.blender.org/blender/blender/pulls/115081
2024-01-29 00:37:12 +01:00
Pierrick Bouvier a3d915310b Build: Fix some excessive Visual Studio compile times
While investigating Blender compilation time for windows-arm64, we
identified two compilation units that were taking a long time to compile
(~1h each). This affects windows-x64 builds as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/117534
2024-01-28 12:12:52 +01:00
Brecht Van Lommel 38647b6dc2 Fix: suspicious time-stamp console warnings on macOS
Use the correct current time API function that matches NSEvent timestamp.
2024-01-27 00:22:49 +01:00
Sergey Sharybin 6f681105ec Cycles: Skip denoising during bake when pass does not support denoising
This changes fixes the slowdown when baking data passes like Normal with
the denoiser enabled on scene settings.

When baking to 4K textures denoising could take considerable amount of
time, which is better be avoided.

Pull Request: https://projects.blender.org/blender/blender/pulls/117483
2024-01-25 15:56:20 +01:00
Alaska ddc0aceefd Cycles UI: Hide HIP-RT settings on Linux
Hide the HIP-RT setting on Linux since it's not supported there yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/117492
2024-01-25 15:16:13 +01:00
Brecht Van Lommel 8087dd9e96 Cleanup: Cycles: use one fewer object struct member for motion data 2024-01-24 20:17:13 +01:00
Brecht Van Lommel 5b6f2ef5a2 Cleanup: Cycles: rename some legacy names to new ones 2024-01-24 20:17:13 +01:00
Brecht Van Lommel b689027b3a Fix #114028: Cycles displace splits faces with smooth and flat faces
Cycles can use a per face flag to determine if a face is smooth or flat,
and there is no need to use corner normals in such cases. So revert to
not doing that as before, which also saves a bit of memory.

There is a pre-existing issue where faces are split by sharp edges and
autosmooth, which is not solved by this. It's only fixing the regression.
2024-01-24 19:55:31 +01:00
Stefan Werner d16d2bbd3a Cycles: Adding OIDN support for CUDA and OptiX devices
Small changes to turn on support and to build OIDN with the CUDA backend.

Co-authored-by: Werner, Stefan <stefan.werner@intel.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115828
2024-01-24 08:19:39 +01:00
Hans Goudey 99f9084bee Cleanup: Replace some CLAMP macros with C++ functions
Pull Request: https://projects.blender.org/blender/blender/pulls/117460
2024-01-23 21:10:33 +01:00
salipourto dd7a7791d7 Cycles: Remove and update deprecated compiler options for HIP
Pull Request: https://projects.blender.org/blender/blender/pulls/117428
2024-01-23 20:28:39 +01:00
Stefan Werner 4f58cffb4e Cycles: Use default CUDA context instead of creating a new one
This allows for Cycles and OIDN to share the same context.

Co-authored-by: Werner, Stefan <stefan.werner@intel.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/117230
2024-01-23 15:31:45 +01:00
Lukas Stockner b5a9c98e04 Fix #117081: Wrong Roughness when baking Principled BSDF
The pre-4.0 Principled BSDF had a special diffuse BSDF that contained
the roughness value from the node. Since 4.0, the regular Diffuse BSDF is used,
so we need to ignore it when determining the roughness value for baking.
2024-01-23 01:20:12 +01:00
Hans Goudey 0618de49ad Cleanup: Replace MIN/MAX macros with C++ functions
Use `std::min` and `std::max` instead. Though keep MIN2 and MAX2
just for C code that hasn't been moved to C++ yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/117384
2024-01-22 15:58:18 +01:00
Campbell Barton 5b59be81ba Cleanup: spelling in comments 2024-01-22 12:44:56 +11:00
Aras Pranckevicius a705259b4b Cleanup: move imbuf .h files to .hh 2024-01-19 20:29:38 +01:00
Brecht Van Lommel cb787a458b Build: use C++17 for CUDA kernels when supported
This helps with compatibility with recent clang versions as host compiler.

Pull Request: https://projects.blender.org/blender/blender/pulls/117311
2024-01-19 15:19:33 +01:00
ESASHIKA Kaoru c0bc49f035 GHOST: Support for Additional 3Dconnextion Devices
Add support for additional 3Dconnextion devices, specifically the Space
Mouse Pro Wireless when connected directly and for the wireless
connection.

Pull Request: https://projects.blender.org/blender/blender/pulls/116393
2024-01-18 17:48:35 +01:00
Hans Goudey da6b45f9b8 Cleanup: Make format 2024-01-16 10:56:55 -05:00
Eugene Kuznetsov 10dfa07e36 Linux: Use huge pages in jemalloc to speed up allocations
Enable huge pages for jemalloc. This requests the Linux kernel to use
huge (2 MB) pages for large allocations. This has the effect of speeding
up first accesses to those allocations, and possibly also speeds up future
accesses by reducing TLB faults.

By default, 4 KB pages are used unless the user enables huge pages through
a kernel parameter or an obscure sysfs setting.

For Cycles benchmarks, this gives about a 5% CPU rendering performance
improvement. It likely also improves performance in other areas of Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/116663
2024-01-16 16:37:40 +01:00
Harley Acheson 0f8c8e475a UI: Improved Default GetWindowUnderCursor Behavior
For default GetWindowUnderCursor (when there is not a platform-specific
version), search windows in reverse order. This is because in most
cases with overlapping windows the one that is on top was created after
those that are below it.

Pull Request: https://projects.blender.org/blender/blender/pulls/111489
2024-01-15 20:27:47 +01:00
sjfricke c9c01724b9 Vulkan: Add shaderClipDistance feature
Various GLSL shaders use gl_ClipDistance and without the feature
enabled validation layers errors are triggered

Pull Request: https://projects.blender.org/blender/blender/pulls/116530
2024-01-15 15:02:19 +01:00
Philipp Oeser 4da32e9334 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-01-15 12:31:44 +01:00
Damien Picard 3bd41cf9bc I18n: Go over TIP_ and IFACE_ usages, change to RPT_ when relevant
The previous commit introduced a new `RPT_()` macro to translate
strings which are not tooltips or regular interface elements, but
longer reports or statuses.

This commit uses the new macro to translate many strings all over the
UI.

Most of it is a simple replace from `TIP_()` or `IFACE_()` to
`RPT_()`, but there are some additional changes:
- A few translations inside `BKE_report()` are removed altogether
  because they are already handled by the translation system.
- Messages inside `UI_but_disable()` are no longer translated
  manually, but they are handled by a new regex in the translation
  system.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:32 +01:00
Campbell Barton 3aa3743b6e Fix hang on startup under Wayland & LIBDECOR with the VULKAN backend
Create a dummy buffer so LIBDECOR initializes the window configuration.
2024-01-12 11:31:10 +11:00
Hans Goudey 6438d0ad1f Cleanup: Grammar in comments 2024-01-11 11:01:50 -05:00
salipourto b358b89faa Fix #116810: Cycles HIP OpenImageDenoise device not available
Fixed the order of setting device id and querying OIDN.
This check needs info.id to be set.

Pull Request: https://projects.blender.org/blender/blender/pulls/117006
2024-01-11 15:28:43 +01:00
Jacques Lucke a94146b82c Cleanup: move BKE_pointcloud.h to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/116990
2024-01-11 10:54:47 +01:00
Campbell Barton 7a4f7a1d51 Cleanup: spelling in comments, comment blocks 2024-01-11 16:46:46 +11:00
Alaska 1f4cf2676f Cycles UI: Fix missing CPU settings under certain conditions
Fixes an issue where CPU specific render settings (e.g. path guiding)
would be hidden when GPU Compute has been selected for rendering,
but a GPU hasn't been selected in preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/116123
2024-01-10 19:52:06 +01:00
Brecht Van Lommel b0d919181d Fix #116792: Cycles render issue velocity attribute and motion steps > 1
In this case the object transform can use more motion steps, but the
geometry needs to have its motion steps fixed since the velocity
attribute completely overrides them.
2024-01-10 19:19:23 +01:00
Brecht Van Lommel dda8d0920a Fix #116211: Cycles light linking incorrect with transparent objects 2024-01-10 18:06:28 +01:00
Jacques Lucke 522f9c9834 Volumes: improve tree access token api
There was one functional issue with the previous API which was its
use in `VolumeGrid<T>::grid_for_write(tree_token)`. The issue was
that the tree token had to be received before the grid is accessed.
However, this `grid_for_write` method might create a copy of the
`VolumeGridData` internally and if it does, the passed in `tree_token`
corresponds to the wrong tree.

The solution is to output the token as part of the method. This has two
additional benefits:
* The API is more safe, because one can't pass an r-value into the methods
  anymore. This generally shouldn't be done, because the token should
  live at least as long as the OpenVDB tree is used and shouldn't be freed
  immediatly.
* The API is a bit simpler, because it's not necessary to call the
  `VolumeGrid.tree_access_token()` method anymore.
2024-01-10 15:20:29 +01:00
Campbell Barton 89ad66fbbd Fix #1092563: invalid event timestamps on X11 after 49 days uptime
Regression from [0] based on the incorrect assumption that X11's
Time was a uint64. Despite the `Time` type being 8 bytes,
the value wraps at UINT32_MAX.

Details:

- GHOST_SystemX11::m_start_time now uses CLOCK_MONOTONIC instead of
  gettimeofday(..) since event times should always increase.
- Event timestamps now accumulate uint32 rollover.

[0]: efef709ec7
2024-01-09 12:05:31 +11:00
Hans Goudey 468e0f873f Cleanup: Fix spelling mistakes in recent spelling fix commit
0ba83fde1f
2024-01-08 12:52:54 -05:00
Sergey Sharybin 4d2f012049 Fix #115862: Shadow linking causes error on GPU
When a mesh light is shadow-linked to something with a specific
shader network it was possible that the emission_sd_storage was
not bit enough for sampling.

The shade_dedicate_light kernel only evaluates emission of either
light or mesh emitter and then resumes the regular path tracer.
There is no need to store closures.

This change makes it so a smaller storage is used, and also
passes flag to the shader evaluation function indicating that
closures are not to be stored.

Pull Request: https://projects.blender.org/blender/blender/pulls/116907
2024-01-08 18:03:23 +01:00
Campbell Barton 214f942258 Fix crash reading an empty clipboard under Wayland 2024-01-08 23:32:30 +11:00
Brecht Van Lommel 0e4da8d55f Fix macOS ARM build failing with make lite
OpenImageIO headers have a dependency on Imath headers when not on x86_64.
2024-01-08 13:14:34 +01:00
Campbell Barton 617f7b76df Cleanup: comment block formatting 2024-01-08 11:31:43 +11:00
Campbell Barton 0ba83fde1f Cleanup: spelling in comments 2024-01-08 11:24:37 +11:00
Hans Goudey e90d844dd7 Cleanup: Grammar in comments
"it's own" -> "its own" again. Start new sentences properly.
2024-01-06 09:02:56 -05:00
Hans Goudey d6cfd7d1f4 Cleanup: Remove unnecessary keywords from C++ headers
- Remove unnecessary `struct`
- Use `using` instead of `typedef`
- Remove `void` from `(void)` as function arguments
2024-01-04 15:07:48 -05:00
Michael Jones 31001b67fd Cycles: Enable floating point atomic support in Metal
Utilises native floating point atomic operations if available. Supported in Metal 3.0+ onwards.
Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/116786
2024-01-04 17:08:29 +01:00
Brecht Van Lommel ac70bc3611 Fix: temporarily disable Cycles patch map assert to avoid failing test
After recent 4.1 libraries update update for macOS ARM.
2024-01-04 04:06:19 +01:00
Brecht Van Lommel 364beee159 Tests: add option to build one binary per GTest file
Bundling many tests in a single binary reduces build time and disk space
usage, but is less convenient for running individual tests command line
as filter flags need to be used.

This adds WITH_TESTS_SINGLE_BINARY to generate one executable file per
source file. Note that enabling this option requires a significant amount
of disk space.

Due to refactoring, the resulting ctest names are a bit different than
before. The number of tests is also a bit different depending if this
option is used, as one uses gtests discovery and the other is organized
purely by filename, which isn't always 1:1.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/114604
2024-01-03 18:35:50 +01:00
bsavery d2e91fb0d7 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:16:07 +01:00
Sergey Sharybin d86d86f729 Fix heap buffer overflow in Cycles IES parser
The IES parser in Cycles would lead to heap buffer overflow error
when non-supported or invalid data is provided to it.

The error was caused by the way how stirng is copied to vector
skipping the last null-terminator. Later C-style string utilities
are used for parsing, and they expect the data to be null-terminated.

It is unclear why data needs to be stored as vector: storing it as
string simplifies initialization.

Easiest to reproduce the issue is to use Blender build with address
sanitizer enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/116752
2024-01-03 18:00:41 +01:00
Brecht Van Lommel f63accd3b6 Cleanup: move CMake test utility functions into testing.cmake
Combining functions from macros.cmake and Modules/GTestTesting.cmake.
It was unusual to have Blender specific code in the Modules folder.

Pull Request: https://projects.blender.org/blender/blender/pulls/116719
2024-01-03 14:49:11 +01:00
Brecht Van Lommel d377ef2543 Clang Format: bump to version 17
Along with the 4.1 libraries upgrade, we are bumping the clang-format
version from 8-12 to 17. This affects quite a few files.

If not already the case, you may consider pointing your IDE to the
clang-format binary bundled with the Blender precompiled libraries.
2024-01-03 13:38:14 +01:00
Brecht Van Lommel 4ce14a639f Revert "Cleanup: move CMake test utility functions into testing.cmake"
This breaks execution of some Windows tests.

This reverts commit 4190a61020.
2024-01-02 19:06:39 +01:00
Sergey Sharybin 4657d541c8 Fix use-after-free in Cocoa GHOST system creation
The use-after-free is triggered when the GHOST system is created
multiple timers during the application timelife which happens in
the integration tests.

The solution is to release the application delegate and set it
to nil when the GHOST system is being destroyed. This ensures that
all subsequent GHOST systems properly initialize application
delegate, and that there is no application delegate which points
to a freed system.

The original issue was noticed by a flackey behavior of the
bf_gpu_tests test which was failing at random. The issue could
be reliably reproduced by running this test with ASAN enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/116717
2024-01-02 17:19:54 +01:00