Commit Graph

14044 Commits

Author SHA1 Message Date
Werner, Stefan
c85f77531f Fix: Compiler warning about format string
Don't pass string class into printf("%s"), only char* allowed.
2024-06-20 13:27:41 +02:00
Aras Pranckevicius
c059eb73d9 Merge branch 'blender-v4.2-release' 2024-06-20 14:06:20 +03:00
Luya Tshimbalanga
a9fe638972 Fix: Cycles runtime compile using outdated HIP parameters
This commit resolves an warning message.

Signed-off-by: Luya Tshimbalanga <luya@fedoraproject.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/118401
2024-06-20 12:43:27 +02:00
Jeroen Bakker
4353b7ffba Vulkan: Remove unused code
Vulkan backend has recently switched to a render graph approach. Many
code was left so we could develop the render graph beside the previous
implementation. Last week we removed the switch. This PR will remove
most of the unused code. There might be some left and will be removed
when detected.

Pull Request: https://projects.blender.org/blender/blender/pulls/123422
2024-06-20 11:34:19 +02:00
Bastien Montagne
f3f0d29c51 Merge branch 'blender-v4.2-release' 2024-06-20 11:03:09 +02:00
Bastien Montagne
32ece7d604 Fix (unreported) 'copy' version of MEM_cnew not handling alignment.
Almost certainly not an issue in current codebase (this 'copy' version
of `MEM_cnew` does not seem much used in the first place), but better be
consistent with the 'allocating' version.

Pull Request: https://projects.blender.org/blender/blender/pulls/123445
2024-06-20 11:00:34 +02:00
Bastien Montagne
461ee89b61 Cleanup: Sync 'alignment' checks of guarded allocator with lockfree one.
Sync a bit better the checks on the alignment value between
`MEM_lockfree_mallocN_aligned` and `MEM_guarded_mallocN_aligned`.

The only significant change, in `MEM_guarded_mallocN_aligned`, is the
usage of `ALIGNED_MALLOC_MINIMUM_ALIGNMENT` instead of 'magic value' `8`.
This should not have any effect on 64bits platforms, but on 32bits ones
the minimum alignment would be reduced from `8` to `4` now.

NOTE: we could also consider making these checks part of a utils
function, instead of duplicating them in the codebase.
2024-06-20 11:00:33 +02:00
YimingWu
ef1d5c629b Fix #123212: Support LSGT key for X11.
The LSGT (GrLess) key is not processed in X11 while it's processed in
Win32. This attempts to fix the behaviour.

Pull Request: https://projects.blender.org/blender/blender/pulls/123354
2024-06-20 08:01:43 +02:00
Campbell Barton
295ffeeb02 Merge branch 'blender-v4.2-release' 2024-06-19 19:40:18 +10:00
Campbell Barton
50bb98fba5 Fix #123339: Blender fails to build with older versions of wayland
Follow up to [0] which only addressed one of the issues.

[0]: bc7cb481dab9d0f9c22d4c59e90930be9a3a6511
2024-06-19 19:36:10 +10:00
Sergey Sharybin
dc88f53f21 Merge branch 'blender-v4.2-release' 2024-06-19 10:42:42 +02:00
Alaska
10737d719e Cleanup: Correct Cycles code comment
The code comment references a variable that was removed during the
review process of !123341

Pull Request: https://projects.blender.org/blender/blender/pulls/123409
2024-06-19 10:42:13 +02:00
Omar Emara
4f51033708 Nodes: Implement Gabor noise
This patch implements a new Gabor noise node based on [1] but with the
improvements from [2] and the phasor formulation from [3].

We compare with the most popular existing implementation, that of OSL,
from the user's point of view:

  - This implementation produces C1 continuous noise as opposed to the
    non continuous OSL implementation, so it can be used for bump
    mapping and is generally smother. This is achieved by windowing the
    Gabor kernel using a Hann window.

  - The Bandwidth input of OSL was hard-coded to 1 and was replaced with
    a frequency input, which OSL hard codes to 2, since frequency is
    more natural to control. This is even more true now that that Gabor
    kernel is windowed as opposed to truncated, which means increasing
    the bandwidth will just turn the Gaussian component of the Gabor
    into a Hann window. While decreasing the bandwidth will eliminate
    the harmonic from the Gabor kernel, which is the point of Gabor
    noise.

  - OSL had three discrete modes of operation for orienting the kernel.
    Anisotropic, Isotropic, and a hybrid mode. While this implementation
    provides a continuous Anisotropy parameter which users are already
    familiar with from the Glossy BSDF node.

  - This implementation provides not just the Gabor noise value, but
    also its phase and intensity components. The Gabor noise value is
    basically sin(phase) * intensity, but the phase is arguably more
    useful since it does not suffer from the low contrast issues that
    Gabor suffers from. While the intensity is useful to hide the
    singularities in the phase.

  - This implementation converges faster that OSL's relative to the
    impulse count, so we fix the impulses count to 8 for simplicitly.

  - This implementation does not implement anisotropic filtering.

Future improvements to the node includes implementing surface noise and
filtering. As well as extending the spectral control of the noise,
either by providing specialized kernels as was done in #110802, or by
providing some more procedural control over the frequencies of the
Gabor.

References:

[1]: Lagae, Ares, et al. "Procedural noise using sparse Gabor
convolution." ACM Transactions on Graphics (TOG) 28.3 (2009): 1-10.

[2]: Tavernier, Vincent, et al. "Making gabor noise fast and
normalized." Eurographics 2019-40th Annual Conference of the European
Association for Computer Graphics. 2019.

[3]: Tricard, Thibault, et al. "Procedural phasor noise." ACM
Transactions on Graphics (TOG) 38.4 (2019): 1-13.

Pull Request: https://projects.blender.org/blender/blender/pulls/121820
2024-06-19 09:33:32 +02:00
Campbell Barton
a9447cf09a Cleanup: spelling in comments 2024-06-19 10:03:37 +10:00
Lukas Stockner
97b06c429f Cycles: Fix multiscattering Oren-Nayar at glancing angles, update tests 2024-06-18 22:57:52 +02:00
Brecht Van Lommel
a26fd603b0 Merge branch 'blender-v4.2-release' 2024-06-18 21:19:24 +02:00
Lukas Stockner
5e40b9bb5c Cycles: Switch to energy-preserving multiscattering Oren-Nayar BSDF
This multiscattering term comes from the OpenPBR specification and nicely
preserves energy while correctly modeling increased saturation at high
roughness.

Preparation for adding a diffuse roughness option to the Principled BSDF.

To me, the difference in output and computation seems small enough to
not need an enum for the old behavior.

Note that this also switches sampling to cosine-weighted, in my tests this
gives lower noise. I also checked doing MIS between cosine and uniform,
using the A term as a weight for how often to use cosine (since that term
is Lambertian diffuse), but always using cosine was better.
A nice consequence of that is that you don't get a huge noise jump when
going from 0.0 to 0.01 roughness.

Pull Request: https://projects.blender.org/blender/blender/pulls/123345
2024-06-18 21:07:21 +02:00
Alaska
56bb8b2b3c Fix #123324: Improve Cycles camera bounding box size calculation
Cycles runs a check to see if the camera is possibly inside a
volumetric object by seeing if the bounding box of the camera
and volumetric object intersect.

If the calculation is wrong (Cycles says the camera is outside the
volume when it's inside it), then the volume will not render properly.

This commit resolves most of these issues by making the camera
bounding box larger than before, taking into consideration
features like:

1. The impact DOF could have on the camera ray start position and how
that should impact the bounding box size.
2. Taking into consideration near clipping, which was missed from the
orthographic camera due to a oversight in a previous commit
(08cc73a9bb).

Pull Request: https://projects.blender.org/blender/blender/pulls/123341
2024-06-18 17:35:16 +02:00
Clément Foucault
8cd282e48c Merge branch 'blender-v4.2-release' 2024-06-18 15:35:17 +02:00
Patrick Mours
56c1163c21 Fix: Cycles OptiX wrong stack size for OSL pipeline
The callables generated by OSL reference other external functions
(defined in the OSL services module), in which case OptiX cannot
calculate the right stack size just based on the callable alone, it needs to
know all functions linked together in the pipeline to get to an accurate
result. `optixProgramGroupGetStackSize` has an optional pipeline
argument for this purpose, so make use of that to ensure the correct
stack size is calculated.

Ref #122779

Pull Request: https://projects.blender.org/blender/blender/pulls/123368
2024-06-18 15:27:14 +02:00
Campbell Barton
033a3f09b6 Merge branch 'blender-v4.2-release' 2024-06-18 20:38:38 +10:00
Campbell Barton
bc7cb481da Fix #123339: Blender fails to build with older versions of wayland 2024-06-18 20:37:25 +10:00
Campbell Barton
08ddd98d73 Merge branch 'blender-v4.2-release' 2024-06-18 19:50:40 +10:00
Anthony Roberts
794a8f35fa Windows: Update GPU error message on ARM64
This makes it more verbose, and a little clearer that devices prior to 8cx Gen3 are not supported in  >=v4.0. It makes the error message from #113674 more prominent than just being printed to cout.

Spurred by an email I got from someone trying to run blender on a Surface Pro X, and getting the not very helpful (to old devices) error.

Pull Request: https://projects.blender.org/blender/blender/pulls/122732
2024-06-18 11:47:01 +02:00
Campbell Barton
c5217b1377 Merge branch 'blender-v4.2-release' 2024-06-18 12:14:46 +10:00
Campbell Barton
0554ec7ec7 Cleanup: spelling in comments 2024-06-18 12:09:40 +10:00
Miguel Pozo
dde2aa5417 Merge branch 'blender-v4.2-release' 2024-06-17 18:56:59 +02:00
Alaska
08cc73a9bb Fix #123249: Orthographic DOF is influenced by near clip
Fix an issue where the DOF distance in orthographic mode is
specified distance + near clip distance, which can lead to
unpredicable results.

Pull Request: https://projects.blender.org/blender/blender/pulls/123267
2024-06-17 17:45:55 +02:00
Alaska
274da96722 Render: Clamp minimum DOF focus distance
Clamp DOF focus distance to a minimum of 1e-5.
This is to primarily stop focus distances of 0 being used
which would lead to issues in future code changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/123310
2024-06-17 17:42:38 +02:00
Lukas Stockner
d0f0e38bf2 Merge branch 'blender-v4.2-release' 2024-06-15 22:06:51 +02:00
Lukas Stockner
e118fe6e47 Cycles: Fix directional artifacts in blue noise sampling pattern
The base-4 Owen scrambling hash needs a seed value that's somewhat random-
looking, so the default value of 0 causes problems. Hashing the input seed
avoids this.

To avoid changing the noise pattern in pre-4.2 scenes, this hash is only
applied to blue-noise patterns.

Pull Request: https://projects.blender.org/blender/blender/pulls/123274
2024-06-15 22:05:18 +02:00
Campbell Barton
78e65fc480 Merge branch 'blender-v4.2-release' 2024-06-15 14:19:07 +10:00
Campbell Barton
8ab246ddde Build: fix linking FFMPEG & x265 on Linux 2024-06-15 14:15:53 +10:00
Brecht Van Lommel
eab14b0a0c Merge branch 'blender-v4.2-release' 2024-06-14 16:56:00 +02:00
Brecht Van Lommel
a87907b425 Fix #123201: Cycles OSL bump mapping broken
After the last OSL update, the Normal input to the auto generated Bump
node was getting a constant value instead of the normal.
2024-06-14 16:54:44 +02:00
Jeroen Bakker
07ea6a5c23 Vulkan: Enable render graph
This PR hooks up the vulkan backend with the render graph
for drawing. It can run Blender better than the previous
implementation so we also flipped it to be the default
implementation.

**Some highlights**
- Adds support for framebuffer load/store operations
- Adds support for framebuffer subpass transitions
- Fixes workbench shadows
- Performance is just below OpenGL performance when comparing
  fps. But the screen feels more fluent when using complex
  scenes.
- Current performance is without doing any optimizations so
  will improve in the future.
- EEVEE will not crash but has artifacts and many parts that
  require more work.

**Related to**
- #121648
- #118330

**Known Limitation**
- Similar to previous implementation resources can be freed when
  still in use crashing Blender. This is typically the case when
  playing back an animation or updating a material icon.

**Next steps**
- Remove old implementation
- Get EEVEE to work
- Fix double resource freeing
- Improve performance by identifying hotspots and change them

Pull Request: https://projects.blender.org/blender/blender/pulls/121787
2024-06-14 08:46:33 +02:00
Harley Acheson
52f42b02f0 Merge branch 'blender-v4.2-release' 2024-06-13 10:55:09 -07:00
Brecht Van Lommel
90f09f016e Fix: Incorrect call to cuCtxPopCurrent
cuDevicePrimaryCtxRetain does not push the context onto the stack,
unlike cuCtxCreate.
2024-06-13 19:41:20 +02:00
Brecht Van Lommel
d72c4f0096 Fix: Cycles build issues when disabling various kernel features 2024-06-13 19:41:19 +02:00
Weizhen Huang
5bb7dc82ae Merge branch 'blender-v4.2-release' 2024-06-13 16:03:31 +02:00
Weizhen Huang
e639c3d6e2 Fix #74816: crash in Cycles light distribution due to integer overflow
`num_distribution` in `KernelIntegrator` has type `int`, which holds a
maximal value of 2147483647. However, when computing the distribution,
`size_t` is used, which can go beyond this value and result in a
negative value when converted to `int`.

This PR handles this case as an error, stops rendering and suggests
alternative solutions.

Also early return when `use_light_tree`. The block was there because
`num_distribution` was needed for light tree before bfd1836861.

Pull Request: https://projects.blender.org/blender/blender/pulls/123177
2024-06-13 15:57:11 +02:00
Bastien Montagne
de713122f3 Merge branch 'blender-v4.2-release' 2024-06-13 12:17:10 +02:00
Damien Picard
f87d4e4e40 I18n: Extract and disambiguate a few messages
Extract
- Cycles denoiser enum.
- Extensions user preferences UI.
- Node operator poll message from new node function.

Improve
- Split "(Enabled|Disabled) on startup, overriding the preference."
into two messages.

Disambiguate
- "Add" when describing the action of adding something should use the
  Operator context.
- "Dimensions", in noise textures.
- "Transform" as a noun, the matrix transform type of Geometry Nodes,
  as opposed to the verb to move things in space.
- "Parent" as a noun or verb (the parent of an object, to parent an
  object to another).

Some issues reported by Satoshi Yamasaki, deathblood, and Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/122969
2024-06-13 12:15:55 +02:00
Brecht Van Lommel
ed66bd4245 Merge branch 'blender-v4.2-release' 2024-06-12 20:07:24 +02:00
Brecht Van Lommel
87dae7d800 Build: Clean up oneAPI cmake messages
* Always define root directories in LIBDIR even when not needed,
  to silence some warnings.
* Only show warnings about not finding libs when oneAPI is enabled.
* Prefix message for context.
2024-06-12 19:21:43 +02:00
Brecht Van Lommel
3a7a9c60df Cleanup: Compiler warning building without OIDN 2024-06-12 18:29:49 +02:00
Brecht Van Lommel
397b96ed2e Fix #121819: OpenColorIO GLSL error after recent change, only apply to Metal 2024-06-12 18:29:49 +02:00
Brecht Van Lommel
f969208405 Fix #121819: OpenColorIO Metal GLSL error with grading curve 2024-06-12 18:10:46 +02:00
Sergey Sharybin
a10cfeda7c Merge branch 'blender-v4.2-release' 2024-06-12 18:06:32 +02:00
Sergey Sharybin
e67c95c8c4 Fix: Cycles renders black on AMD Metal
A mistake in the #122015 which lead to discrepancy between
CPU and GPU states: TargetConditionals.h always defines the
target CPU, and defines it to either 1 or 0.

The proper way of checking it is to `#if TARGET_CPU_ARM64`.

Some examples can be seen there:

  https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary

Pull Request: https://projects.blender.org/blender/blender/pulls/123140
2024-06-12 18:06:06 +02:00