Commit Graph

14561 Commits

Author SHA1 Message Date
Alex
4a4e456e37 Cycles: OSL uniform_edf closure for better MaterialX compatibility
Pull Request: https://projects.blender.org/blender/blender/pulls/133575
2025-01-25 21:17:17 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Brecht Van Lommel
82cc0a3eff Fix #124847: Cycles OSL UDIM wrong extrapolation with negative UV
Pull Request: https://projects.blender.org/blender/blender/pulls/133507
2025-01-23 22:20:52 +01:00
Brecht Van Lommel
63e2adaa79 Fix #127875: Cycles renders image with single UDIM tile wrong
Properly support this case instead of assuming it's not a UDIM.

Pull Request: https://projects.blender.org/blender/blender/pulls/133504
2025-01-23 21:20:01 +01:00
Brecht Van Lommel
1367a89c80 Fix: Cycles persistent data + motion blur render bugs
Objects would randomly appear and disappear, or get swapped with other
objects. This was due to a missing recalc tag, due to the object to
geometry instance mapping being incomplete.

Fix #100580
Fix #107624
Fix #132026
Fix #99281
Fix #110905

Pull Request: https://projects.blender.org/blender/blender/pulls/133490
2025-01-23 15:29:49 +01:00
Brecht Van Lommel
bd0cca5d6d Fix: Cycles Metal RT assert with persistent data render
Pull Request: https://projects.blender.org/blender/blender/pulls/133490
2025-01-23 15:29:41 +01:00
Brecht Van Lommel
14facb987e Fix #132367: Cycles tiled render cancel still does slow denoise
Read the tiles back from disk, but don't run denoiser.

Pull Request: https://projects.blender.org/blender/blender/pulls/133443
2025-01-22 15:54:41 +01:00
Brecht Van Lommel
e98b45beb1 Fix: Cycles CPU render wrong with latest OSL 1.14 2025-01-22 10:59:07 +01:00
Brecht Van Lommel
c749f6c376 Cleanup: Remove unnecessary usage of Boost in the build system
* Some libraries like Alembic and OpenColorIO for a long time removed
  header dependencies on Boost.
* No need to have BOOST_LIBRARIES anymore, only BOOST_PYTHON_LIBRARIES
  is a direct dependency through USD headers.
* OpenVDB is no longer a static library, no need to link its dependencies.

Pull Request: https://projects.blender.org/blender/blender/pulls/133424
2025-01-22 10:02:22 +01:00
Campbell Barton
e8ebbce9c5 Cleanup: update naming for dualcon: rename loop corner_verts
These weren't the equivalent of MLoop's even with the old naming
this was misleading, especially `DualConInput::mloop`.
2025-01-22 19:59:03 +11:00
Campbell Barton
46724ca841 Fix #105164: Blender exits when QuadriFlow solver fails
Replace calls to exit(..) with an error return value.
2025-01-22 19:27:00 +11:00
Brecht Van Lommel
bec8581916 Refactor: Remove Boost from Quadriflow
Extract Boykov-Kolmogorov max flow algorithm from boost::graph. As part
of work towards removing Boost as a Blender dependency.

Together with #133347 this removes the last direct Blender dependency
on Boost.

Pull Request: https://projects.blender.org/blender/blender/pulls/132142
2025-01-22 09:05:38 +01:00
Brecht Van Lommel
139f0d8c32 Refactor: Move translation handling fully into blentranslation
No need to have the extra abstraction, simpler to have it together
in the same module.

Pull Request: https://projects.blender.org/blender/blender/pulls/133347
2025-01-22 09:05:32 +01:00
Brecht Van Lommel
860bfd786e Refactor: Don't modify std::locale::global for translation
Without boost::locale, there seems no particular reason to modify the
global locale, we can just translate strings ourselves.

Other locale facets like numeric and time are also left unchanged
from the default, which is the "C" locale. This appears to match
previous Blender behavior with boost::locale. That protects against
bugs where formatting floats for I/O unexpectedly depends on the
system language.

Pull Request: https://projects.blender.org/blender/blender/pulls/133347
2025-01-22 09:05:29 +01:00
Brecht Van Lommel
820f261371 Refactor: Replace Boost Locale for translation
Use code adapted from boost::locale to implement locale name parsing
and .mo file reading ourselves.

Together with #132142 this removes the last direct Blender dependency
on Boost.

Pull Request: https://projects.blender.org/blender/blender/pulls/133347
2025-01-22 09:00:32 +01:00
Alaska
58b7543ede Fix #132322: Artifacts in Cycles volume rendering with Light tree on some devices
In a previous commit (1), adjustments to light tree traversal were made
to try and skip distant lights when deciding which light to sample
while within a world volume.

The skip wasn't implemented properly, and as a result distant lights
were still included in the light tree traversal in that sitaution.
And due to the way the skip was implemented, there were some
unintialized variables used in the processing of the distant lights
importance which caused artifacts on some platforms.

This commit fixes this issue by reverting the skip of distant lights
in that situation.

(1) blender/blender@6fbc958e89

Pull Request: https://projects.blender.org/blender/blender/pulls/132344
2025-01-22 05:50:32 +01:00
Weizhen Huang
e6645bf06b Fix #131240: Cycles: Negative integration range in Huang Hair
It is possible that the valid range computed from `theta` and the range
visible to the current pixel do not overlap. In this case the hair
section has no contribution.

Pull Request: https://projects.blender.org/blender/blender/pulls/133337
2025-01-21 11:48:45 +01:00
Alaska
b9ebd96539 Fix #133229: Remove camera size optimization from SSS shader in Cycles
In Cycles, the subsurface scattering shader will switch to a
diffuse shader under a few different conditions to improve performance
and reduce noise.

This commit removes the "switch back to diffuse if the scattering
radius is less than a quarter of a pixel" optimization because in some
scenes, this can result in noticable lines as the shader transitions
between subsurface scattering and diffuse.

Pull Request: https://projects.blender.org/blender/blender/pulls/133245
2025-01-21 04:31:43 +01:00
Weizhen Huang
350bd60b11 Fix: Cycles: Metal compilation when include is guarded behind WITH_CYCLES_DEBUG
Happens after f79cae2c59. Seems that Metal pre-processing could not
figure out that the inclusion is guarded behind `#ifdef`, so the
included file is expanded here and never again afterwards.
The pre-processing should be fixed, but for now just always include the file.

Pull Request: https://projects.blender.org/blender/blender/pulls/133336
2025-01-20 19:15:46 +01:00
Weizhen Huang
f79cae2c59 Fix: Cycles: Compilation issue with WITH_CYCLES_DEBUG enabled
Pull Request: https://projects.blender.org/blender/blender/pulls/133303
2025-01-20 16:11:38 +01:00
Stefan Werner
416085d893 Fix: Added missing include to allow Cylces build without Embree 2025-01-20 12:41:19 +01:00
Lukas Stockner
4f0aef1fde Fix #132516: Cycles: No NDC coordinates with OSL on OptiX
This attribute just wasn't implemented on OptiX. Not sure why, adding it works.
2025-01-20 03:42:02 +01:00
Lukas Stockner
2bd71e2fd8 Cleanup: Cycles: Cleanup point cloud attribute update
For other geometry types this was done in bbe6d44928, but for some reason
point clouds were added with the old scheme.
2025-01-20 02:49:35 +01:00
Lukas Stockner
e5ca7ae421 Fix #108215: Cycles: Point Cloud uses wrong position with Persistent Data
The problem here was that the sync code overwrites the point data, but didn't
reset the transform_applied flag, so the rest of the code assumed that the
points are already in world space and didn't apply the transform again.
2025-01-20 02:49:35 +01:00
Jeroen Bakker
58003a9114 Cleanup: Vulkan: Remove non-compatible surface selection
This was useful in the beginning to ensure we supported most surface
configurations. However it seems that there are not that many surface
configurations to support.

Pull Request: https://projects.blender.org/blender/blender/pulls/133186
2025-01-17 10:34:56 +01:00
Jeroen Bakker
80ec04b4ef Cleanup: Vulkan: Use full surface format
GHOST_ContextVK used to pass only the surface texture format to
the GPU backend, it didn't pass the color space. This PR also includes
the color space.

Pull Request: https://projects.blender.org/blender/blender/pulls/133185
2025-01-17 10:28:22 +01:00
Brecht Van Lommel
963c638a5b Fix #131132: Cycles reading packed multilayer EXR wrong
Rewrite Blender image loading to avoid RNA API, which we are moving away
from. This makes it easier to support multilayer EXR.

Pull Request: https://projects.blender.org/blender/blender/pulls/133179
2025-01-17 10:21:44 +01:00
Jonas Holzman
96babd5e9f UI: Support canceling Eyedropper color picking operations
Have `eyedropper_color_sample_fl` return success, in case platform
sampling starts but is canceled (Async return on MacOS). Removes any
chance of returning black color on failures.

Pull Request: https://projects.blender.org/blender/blender/pulls/133124
2025-01-16 04:13:48 +01:00
Alaska
f09fd9bdef Fix #132935: Add sample subset feature to Cycles
Cycles has a sample offset feature allowing users to render X samples
in a single frame on one device, then the remaining Y samples later or
on a different device and combine them back together at the end.

However in most situations the result from using this method was
different, and usually lower quality than rendering all the samples in
one go.

This was because Cycles tunes it's random number sequence for the
number of samples being rendered. And the random number sequence was
being tuned for the wrong number of samples in the case that a user
was using the sample offset.

This commit fixes this issue by adding a "sample subset" feature.
The user specifies the total sample count being rendered across all
devices in the existing `Max Samples` parameter, then specifies per
device which subset of samples will be rendered (E.g. Render samples
0-1024 out of a 0-2048 range).

This commit also contains some additional clean up work
inside Cycles related to the area being changed.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/132961
2025-01-15 07:41:16 +01:00
Hans Goudey
bbc8216951 Cleanup: Formatting 2025-01-14 11:41:03 -05:00
Neko-Asakura
60a3f886c6 macOS: Use NSColorSampler for picking colors outside of the Blender window
#115187 introduced the eyedropper tool for use outside blender on macOS,
but the following issues remain:

1. Users must grant screen capture permission to blender.
2. No visual cue. (cursor icon cannot display as an eyedropper outside
   blender)
3. Users must press `Enter` to activate the picker.
4. `CGWindowListCreateImage` function has been deprecated as of macOS
   14.0

The proposed fix is to use `NSColorSampler` class to select colours
directly from onscreen content. It offers:
1. Permission free (no screen capture permission required).
2. A clear visual cue when selecting colours.

Known issue:
1. Still need press `Enter` to activate the picker.

Pull Request: https://projects.blender.org/blender/blender/pulls/131593
2025-01-14 17:20:41 +01:00
Lukas Stockner
2e12abcc71 Cycles: Fix compilation without OSL 2025-01-13 16:26:44 +01:00
Brecht Van Lommel
96eef81d90 Fix: Cycles assert cancelling render during kernel compilation 2025-01-13 10:07:37 +01:00
Brecht Van Lommel
28ecb6ccf0 Fix #132566: Cycles volume render artifact with high res volume
Avoid integer overflow creating bounding mesh.
2025-01-13 10:07:37 +01:00
Brecht Van Lommel
612cb61199 Cleanup: Cycles: Use simpler make_float3 for single value 2025-01-13 10:07:37 +01:00
Brecht Van Lommel
f2bf9d747e Cleanup: Cycles: Remove some unused kernel entry points on CPU 2025-01-13 10:07:37 +01:00
Brecht Van Lommel
2bf6d0fd71 Cleanup: Cycles: Remove unnecessary SSE4.2 CPU kernel
This is the minimum requirement, so just the regular kernel already
includes these instructions if supported by the CPU architecture.
2025-01-13 10:07:37 +01:00
Jeff Moguillansky
75dc76bceb Vulkan: Add support for dynamic rendering local read
This will add support for `VK_KHR_dynamic_rendering_local_read` when supported.
The extension allows reading from an attachment that has been written to by a
previous command.

Per platform optimizations still need to happen in future changes. Change will
 be limited to Qualcomm devices (in a future commit).

On Qualcomm devices this provides an uplift of 16% when using shader_balls.blend

Pull Request: https://projects.blender.org/blender/blender/pulls/131053
2025-01-13 08:10:31 +01:00
Xavier Hallade
ce463bd6b1 Cycles: oneAPI: optimize device<->host copies
There is a large overhead when doing copies between a device and non-USM host memory.
Using the prepare/release API avoids it, as presented in the optimization guide:
https://www.intel.com/content/www/us/en/docs/oneapi/optimization-guide-gpu/2025-0/optimizing-data-transfers.html

This currently translates to a 4-5% overall rendering speedups on my Arc B580 in most scenes.

Pull Request: https://projects.blender.org/blender/blender/pulls/132859
2025-01-09 21:00:12 +01:00
Alaska
4ca207a145 Cycles: Align Camera data output between SVM and OSL
The `ZDepth` output of the camera data node was different between SVM
and OSL.

SVM would output the `ZDepth`, with negative distances for points
behind the camera. While OSL would output the absolute of the distance,
which resulted in points behind the camera becoming positive.

Align OSL to SVM and allow outputting the negative distance as it
allows users to differentiate between what's in front or behind the
camera.

Pull Request: https://projects.blender.org/blender/blender/pulls/132837
2025-01-09 12:44:52 +01:00
Brecht Van Lommel
1210cc5d52 Fix: Cycles random crash loading images
Add mutex lock to avoid accessing vector while it's getting resized.

Found through a flaky test. Thanks Sergey and Alaska for the help
investigating this.

Pull Request: https://projects.blender.org/blender/blender/pulls/132811
2025-01-08 20:32:31 +01:00
Brecht Van Lommel
f20631f313 Cleanup: Compiler warning building without OpenVDB 2025-01-08 12:14:59 +01:00
Brecht Van Lommel
84ae25c957 Fix #132649: Cycles display memory leak when building without OpenColorIO 2025-01-08 12:14:59 +01:00
Brecht Van Lommel
0cbf808593 Fix #124012: Missing DENOISER_NONE option in Cycles integrator API 2025-01-08 12:14:59 +01:00
Campbell Barton
61a2f7a431 Cleanup: resolve check_spelling & check_licenses warnings 2025-01-08 11:31:43 +11:00
Alaska
65ee136662 Fix: Cycles kernel build failure when building without subsurface scattering
In a recent refactor (1), the subsurface weight was set to be
constant, when it can be modified in the case that `__SUBSURFACE__`
is false, such as when using the adaptive compilation feature.

This commit fixes this issue by rearranging the code so the subsurface
weight is never overwritten.

(1) blender/blender@dd51c8660b

Pull Request: https://projects.blender.org/blender/blender/pulls/132620
2025-01-07 13:43:59 +01:00
Brecht Van Lommel
920e709069 Refactor: Make header files more clangd and clang-tidy friendly
When using clangd or running clang-tidy on headers there are
currently many errors. These are noisy in IDEs, make auto fixes
impossible, and break features like code completion, refactoring
and navigation.

This makes source/blender headers work by themselves, which is
generally the goal anyway. But #includes and forward declarations
were often incomplete.

* Add #includes and forward declarations
* Add IWYU pragma: export in a few places
* Remove some unused #includes (but there are many more)
* Tweak ShaderCreateInfo macros to work better with clangd

Some types of headers still have errors, these could be fixed or
worked around with more investigation. Mostly preprocessor
template headers like NOD_static_types.h.

Note that that disabling WITH_UNITY_BUILD is required for clangd to
work properly, otherwise compile_commands.json does not contain
the information for the relevant source files.

For more details see the developer docs:
https://developer.blender.org/docs/handbook/tooling/clangd/

Pull Request: https://projects.blender.org/blender/blender/pulls/132608
2025-01-07 12:39:13 +01:00
Brecht Van Lommel
a0e03a8d94 Fix #132049: Cycles point clouds with non-uniform scale render wrong
Can't apply transform to them, no code to render ellipsoids like that.

Pull Request: https://projects.blender.org/blender/blender/pulls/132725
2025-01-07 10:57:12 +01:00
Stefan Werner
a79d95099f Cycles: Fix OneAPI crash after unique_ptr refactor
Memory was freed too early, probably a typo.
2025-01-07 09:37:47 +01:00
Campbell Barton
5003253aca Cleanup: spelling & repeated terms 2025-01-07 13:20:19 +11:00