Commit Graph

13023 Commits

Author SHA1 Message Date
Campbell Barton
6704881708 Cleanup: spelling in comments 2023-06-07 21:47:45 +10:00
Weizhen Huang
e3697710d0 Cycles: make light UV available for Texture Coordinate node
The input socket of Image Texture node is connected with the UV output
of Texture Coordinate node by default, the later reads the geometry UV,
which is not available for lights because they have no real geometry.
The current implementation simply retrieves UV from shader data.

Pull Request: https://projects.blender.org/blender/blender/pulls/108691
2023-06-07 12:31:36 +02:00
Weizhen Huang
2ab020cc3c Cycles: enable normal transformation of lights in Vector Transform node
This is added so that some texture pipeline with point light and spot
light could work as before. Some people use the Normal socket from
Texture Coordinate node for texturing light, however the Normal there is
actually the incoming light direction and should be corrected. Using the
Parametric socket from Geometry node + normal transform from world to
object with Vector Transform node delivers the same result as using the
Normal socket from Texture Coordinate node.

Currently for lights only normal transformation works, because only
there we fetch light transform properly. This is a confusing behaviour,
but testing if it's a lamp in all relevant functions could have bad
impact on the performance. A more proper solution would be to change
lights to real objects, which is planned for the future.

![Geometry_Vector_Transform](attachments/fe38895e-85b3-4e7a-873f-12068237f790)

Pull Request: https://projects.blender.org/blender/blender/pulls/108666
2023-06-06 19:07:43 +02:00
Weizhen Huang
ebd431d580 Fix wrong normal transformation in Vector Transform shader node
Normals do not transform the same way as vectors do, see
https://www.pbr-book.org/3ed-2018/Geometry_and_Transformations/Applying_Transformations
2023-06-06 15:17:26 +02:00
Campbell Barton
f31dfa9b74 Merge branch 'blender-v3.6-release' 2023-06-06 09:49:06 +10:00
Campbell Barton
dd1fe31a74 Cleanup: quiet compiler warnings 2023-06-06 09:34:50 +10:00
Bastien Montagne
90a0f39c02 Merge branch 'blender-v3.6-release' 2023-06-05 18:12:35 +02:00
Damien Picard
745baa788d I18n: extract a few messages
- "Invalid" in transformation messages.
- For three messages, translation occured after a string
- concatenation, so the full message was not found.
  Instead, translate a format pattern and format it afterwards.
- Alembic errors when there is an import type mismatch.

Pull Request: https://projects.blender.org/blender/blender/pulls/108212
2023-06-05 18:10:11 +02:00
Weizhen Huang
0e20e2320b Fix compiler error on Metal 2023-06-05 10:53:46 +02:00
Lukas Stockner
888bdc1419 Cycles: Remove MultiGGX code, replace with albedo scaling
While the multiscattering GGX code is cool and solves the darkening problem at higher roughnesses, it's also currently buggy, hard to maintain and often impractical to use due to the higher noise and render time.

In practice, though, having the exact correct directional distribution is not that important as long as the overall albedo is correct and we a) don't get the darkening effect and b) do get the saturation effect at higher roughnesses.

This can simply be achieved by adding a second lobe (https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf) or scaling the single-scattering GGX lobe (https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf). Both approaches require the same precomputation and produce outputs of comparable quality, so I went for the simple albedo scaling since it's easier to implement and more efficient.

Overall, the results are pretty good: All scenarios that I tested (Glossy BSDF, Glass BSDF, Principled BSDF with metallic or transmissive = 1) pass the white furnace test (a material with pure-white color in front of a pure-white background should be indistinguishable from the background if it preserves energy), and the overall albedo for non-white materials matches that produced by the real multi-scattering code (with the expected saturation increase as the roughness increases).

In order to produce the precomputed tables, the PR also includes a utility that computes them. This is not built by default, since there's no reason for a user to run it (it only makes sense for documentation/reproducibility purposes and when making changes to the microfacet models).

Pull Request: https://projects.blender.org/blender/blender/pulls/107958
2023-06-05 02:20:57 +02:00
Chris Blackbourn
35eea10581 Cleanup: format 2023-06-05 12:14:20 +12:00
Lukas Stockner
f4708831ea Fix Principled Hair Absorption Coefficient when using OSL
The additional SocktType::VECTOR argument was being interpreted as flags,
which caused the OSL compiler to skip the input (since the Vector type enum
happens to align with the INTERNAL flag), which caused the OSL shader to
always use the hardcoded default absorption regardless of what was entered.
2023-06-05 01:35:19 +02:00
Lukas Stockner
3a81a93ecf Merge branch 'blender-v3.6-release' 2023-06-05 01:02:19 +02:00
Lukas Stockner
81f127a7e4 Fix refraction BSDF color when using OSL 2023-06-05 01:01:19 +02:00
Campbell Barton
e27bcb6e3e Cleanup: remove redundant struct qualifier 2023-06-04 19:27:38 +10:00
Weizhen Huang
97d9bbbc97 Cycles: more efficient and better-behaved sampling of spherical triangles
uses less inverse trigonometric functions and normalizations.
Also `q` is now guaranteed to be smaller than or equal to 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/108380
2023-06-02 16:57:50 +02:00
Dalai Felinto
390f8fef76 Merge remote-tracking branch 'origin/blender-v3.6-release' 2023-06-02 11:10:45 +02:00
William Leeson
215925e04c FIX #108019: Detect absence of ray tracing support on late 2015 iMac
On an iMac (Retina 5K, 27-inch, Late 2015) it crashed when rendering using Cycles. This was due to the fact that it incorrectly detected that the machine supported ray tracing. This uses the device.supportsRaytracing flag to fill in the use_hardware_raytracing flag for the device.
2023-06-02 10:23:06 +02:00
Campbell Barton
118a47b7f6 Cleanup: quiet warnings
Resolve undeclared function & dangling reference warning.
2023-06-02 12:21:56 +10:00
Sergey Sharybin
eb9209c1f5 Cleanup: Deprecation warning in the FFmpeg
Since avuitl 57.30.100 the pkt_duration is deprecated, and
the duration is to be used instead.

The units seems to match, and also from the avcodec decoder.c
the `frame->pkt_duration = frame->duration;` so does not seem
we need to do any conversion.

The change in FFmpeg is from 2022, which is a bit recent, so
the access to the duration is hidden behind a compatibility
API.

Pull Request: https://projects.blender.org/blender/blender/pulls/108451
2023-05-31 16:41:47 +02:00
Campbell Barton
b2950b2ad7 Fix saving a quit.blend on exit when a file failed to load
When a file passed in from the command line failed to load,
blender would exit & save the quit.blend.

Resolve by adding a `do_user_exit_actions` to WM_exit_ex which is
false in backgrounds mode or when an error has occurred.

---

Back-ported [0] & [1] from main with fix [2] included.

[0]: c803ddab29451addcf6378dea8c062b13c507d72
[1]: d7d1c524e3dc1ac17577bb262ec033db8ae1b8f3
[2]: d3d91b79e0a7d4c083dfb627b3e715fb293efc21
2023-05-31 12:35:22 +10:00
Harley Acheson
de10126b1f Fix: Build Warning of Unused Variable
Removing unused variable in GHOST_SystemWin32.cc

Own code, introduced in #108397
2023-05-30 08:54:28 -07:00
Sergey Sharybin
5c25277f6c Fix #108374: Sun light linking issue on direct sampling
This is a continuation of a fix from the last week in #108311.
The issue was not fully fixed due to a mistake in the regression
test file.

There are two major things which left to be fixed since the
previous patch:

1. Root nodes can not be shared, even if the local and distant
lights belong to the same light set. If the root node is shared
then the flattening will use the same node index for specialized
trees, which is not a desired behavior.

2. The node type needs to be preserved when a new node is
created for a subset of emitters. This is because tree sampling
in kernel will handle distant and local lights differently for
nodes where there are multiple emitters.

Pull Request: https://projects.blender.org/blender/blender/pulls/108427
2023-05-30 17:39:50 +02:00
Sergey Sharybin
db98d9816c Fix #108342: Regression: Cycles: Light group does not work
A couple of mistakes since the light linking commit:

- The +1 got missed in some of the refactors in the branch
- The order of arguments to the shadow path split was wrong

Pull Request: https://projects.blender.org/blender/blender/pulls/108420
2023-05-30 14:23:06 +02:00
Brecht Van Lommel
c5eaaa69bb Merge branch 'blender-v3.6-release' into main 2023-05-30 14:12:52 +02:00
Brad Smith
670da740ba Build: fix OpenBSD error in guardedalloc
Pull Request: https://projects.blender.org/blender/blender/pulls/108252
2023-05-30 13:55:37 +02:00
Brad Smith
0711bae5e7 Libmv: Remove FreeBSD sincos() workaround
Pull Request: https://projects.blender.org/blender/blender/pulls/108346
2023-05-30 13:55:27 +02:00
Sergey Sharybin
5a44922937 Merge branch 'blender-v3.6-release' 2023-05-30 11:47:35 +02:00
Sergey Sharybin
50ba227740 Fix #108316: CUDA error rendering Attic scene
The light tree dependent on the first threshold to evaluate to 1
when picking up an emitter.

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

Pull Request: https://projects.blender.org/blender/blender/pulls/108322
2023-05-30 11:12:05 +02:00
Campbell Barton
d7d1c524e3 Cleanup: pass the exit-code to WM_exit
Callers to WM_exit needed to set G.is_break for a predictable exit-code.
This is error prone as G.is_break may be set based on the user having
pressed escape during event handling.

Instead, pass the exit code as an argument.
2023-05-30 12:55:10 +10:00
Lukas Stockner
d28fe16693 Merge branch 'blender-v3.6-release' 2023-05-30 00:26:45 +02:00
Lukas Stockner
67d0ba4f80 Fix #108211: Incorrect Transmission Color pass due to merged Glass closure 2023-05-30 00:02:05 +02:00
Harley Acheson
c3b58b5f67 Fix #108356: Group Console with App on Taskbar
Set App Id for the process so our console is grouped on the Task Bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/108397
2023-05-29 23:19:12 +02:00
Harley Acheson
e99a2fb61c Merge branch 'blender-v3.6-release' 2023-05-27 18:45:35 -07:00
Harley Acheson
1b7c6cf150 Windows: Do not auto-focus from our console
Although auto-focus only works between a single Blender instance's
child windows, this does include our own console and we don't want
that. Luckily fixing this only requires a single check for null -
because GetFocus() returns null to us for our console.

Pull Request: https://projects.blender.org/blender/blender/pulls/108362
2023-05-28 03:42:13 +02:00
Sergey Sharybin
52015737c9 Fix #108316: CUDA error rendering Attic scene
The light tree dependent on the first threshold to evaluate to 1
when picking up an emitter.

Pull Request: https://projects.blender.org/blender/blender/pulls/108323
2023-05-27 14:19:19 +02:00
Campbell Barton
12d91d4e60 Cleanup: spelling in comments 2023-05-27 15:24:52 +10:00
Campbell Barton
823685db76 Cleanup: consistent doxygen comment blocks
Also remove doxygen block for comments in a functions body.
2023-05-27 15:10:58 +10:00
Sergey Sharybin
82e8f1129c Cleanup: Spelling in Cycles light tree
Pull Request: https://projects.blender.org/blender/blender/pulls/108324
2023-05-26 18:12:57 +02:00
Sergey Sharybin
cc25a37bee Fix #108315: Illegal CUDA address with shadow-linked mesh emitters
A mistake in the intersection picking logic: if a mesh was hit at
least one intersection is to be recorded.

Pull Request: https://projects.blender.org/blender/blender/pulls/108320
2023-05-26 17:36:24 +02:00
Christoph Lendenfeld
074abff87e Merge branch 'blender-v3.6-release' 2023-05-26 17:02:35 +02:00
Jason Fielder
9e83211b8d Fix: Implement shared Metal Command queue to resolve sync bugs
Previously, each GHOST Context instantiated its own Metal device
queue. Commands are only synchronized within a queue, this was the
root cause of a number of flickering issues which had previously
been worked-around with synchronization primitives.

New solution uses a shared queue to simplify dependencies and
alleviate possibility of stalls and bugs when resources are modified
or shared across separate GPU command queues.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108223
2023-05-26 16:00:20 +02:00
Nathan Vegdahl
468cadd51c Cleanup: add comments explaining best usage of Sobol dimensions 2023-05-26 14:34:48 +02:00
Sergey Sharybin
4ca39297ab Fix specialized light tree building for distant lights
On a user level this fixes configuration when a spot light is
linked to an object, and a sun light is not linked to anything.
It used to be making non-linked receivers to be very noisy.

This is because the distant light did not update the node's
light linking settings when they are added to the node.

A simple demo file will be added to the tests suit as
light_link_distant_tree.blend.

Pull Request: https://projects.blender.org/blender/blender/pulls/108311
2023-05-26 13:29:47 +02:00
Sergey Sharybin
d6db9e4193 Cycles: Store light name
Similar to objects, store the name of Blender's side light name
on the Cycles side. This allows to have readable logs where a
name and property is logged (while previously in the logs all
lights will be called lamp).

There is no user-measurable change.

Pull Request: https://projects.blender.org/blender/blender/pulls/108310
2023-05-26 13:03:54 +02:00
Sergey Sharybin
5e971e8d7f Fix hiding receiver disabling light/shadow linking
Turns out it is not enough to check for the receiver/blocker set,
as the object might be hidden. This should not change the light
behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/108307
2023-05-26 12:21:44 +02:00
Brecht Van Lommel
080484a5c8 Fix #108125: Cycles generates NaN in render passes with low roughness
Slightly increase threshold to avoid division by zero.
2023-05-26 12:18:06 +02:00
Brecht Van Lommel
c6aa0217ac Fix #108125: Cycles generates NaN in render passes with low roughness
Slightly increase threshold to avoid division by zero.
2023-05-26 12:16:14 +02:00
Campbell Barton
e7f88c1050 Cleanup: format 2023-05-26 13:30:14 +10:00
Campbell Barton
393d4a6e14 Cleanup: duplicate words in comments
Also use doxygen-comments in files where this is already the convention.
2023-05-26 12:40:06 +10:00
Sergey Sharybin
393da5df78 Cleanup: Remove redundant object fetch in MNEE
The intersection already has proper object assigned.

Pull Request: https://projects.blender.org/blender/blender/pulls/108275
2023-05-25 16:41:35 +02:00
Brad Smith
a50768616f Build: fix OpenBSD error in guardedalloc
Pull Request: https://projects.blender.org/blender/blender/pulls/108252
2023-05-25 15:21:48 +02:00
Campbell Barton
f97660d4ad Cleanup: spelling in comments 2023-05-25 22:50:30 +10:00
Weizhen Huang
bbe5b1e8cf Cleanup: remove unnecessary eval_fac == 0 checks for point lights 2023-05-25 14:23:48 +02:00
Sergey Sharybin
4d2ed350bc Fix #108240: Cycles fails on macOS and AMD GPU
The recent light linking commit changed some includes order,
making compilation to fail on platforms where certain features
are disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/108264
2023-05-25 13:54:58 +02:00
Brecht Van Lommel
e3c5306d4e Fix light linked emissive meshes rendering black for camera rays 2023-05-25 13:49:38 +02:00
Brecht Van Lommel
1d7832a6a4 Fix Make Links showing light link operators for engines other than Cycles 2023-05-25 13:49:38 +02:00
Weizhen Huang
4758299d86 Cleanup: rename functions relating to MNEE light sample update
The original names were `...update_position()`, but no update in
position is performed in these functions, rather, the entries in
`LightSample` are updated. Also make clear that the functions are used
by MNEE.
2023-05-25 12:26:58 +02:00
Harley Acheson
9cf77efaa0 UI: Updated Windows File Registration
Windows file associations using ProgID, needed because of the launcher.
This fixes "pin to taskbar" and Recent Documents lists, allow per-
version jump lists and an "Open with" list with multiple versions.

Pull Request: https://projects.blender.org/blender/blender/pulls/107013
2023-05-24 21:19:56 +02:00
Weizhen Huang
41e49d7ece Refactor: group multiple floats to float2 or float3
Multiple random numbers were passed around separately, making some
argument lists unnecessarily long.
No functional changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/108236
2023-05-24 18:56:58 +02:00
Brecht Van Lommel
f3f2f7fd47 Merge branch 'blender-v3.6-release' into main 2023-05-24 17:59:14 +02:00
Brecht Van Lommel
9419f5a289 Fix #107932: crash attempting to load invalid OpenVDB file path on macOS
Add catch all exceptions similar as was done for OpenEXR in #107184, and
also properly handle errors in Hydra delegate.
2023-05-24 17:47:27 +02:00
Sergey Sharybin
ba3f26fac5 Cycles: light and shadow linking
With light linking, lights can be set to affect only specific objects in the
scene. Shadow linking additionally gives control over which objects acts a
shadow blockers for a light.

Usage:
https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Cycles

Implementation:
https://wiki.blender.org/wiki/Source/Render/Cycles/LightLinking

Ref #104972
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2023-05-24 14:11:47 +02:00
Weizhen Huang
d1dca2d15c Cleanup: remove unused function #light_sample_new_position 2023-05-24 13:36:35 +02:00
Campbell Barton
13c815085b Cleanup: spelling in comments 2023-05-24 11:21:18 +10:00
Hans Goudey
efbcfd8703 Mesh: Remove deprecated argumen to split_faces API function
See 75ad8da1ea6799e3983e4146f4b20dc4bfbb8415
2023-05-23 17:35:33 -04:00
Bastien Montagne
683f7d3f74 Merge branch 'blender-v3.6-release' 2023-05-23 15:07:22 +02:00
Michael Jones
4a26f51a55 Cycles: MetalRT: Metal binary archives don't support linked functions
This patch fixes an undefined behaviour where we were trying to use linked functions with binary archives. This isn't supported yet. At best this will fail silently, but this is not guaranteed in future. To fix this we simply disable binary archives if any linked functions are involved. The impact of this is that the `SHADE_SURFACE_RAYTRACE` and `SHADE_SURFACE_MNEE` kernels will fall back to the file system cache when MetalRT is enabled. The file system cache will occasionally be purged due to factors beyond Blender's control.

Pull Request: https://projects.blender.org/blender/blender/pulls/108176
2023-05-23 13:42:25 +02:00
Sebastian Herholz
493856427d Cycles: bumping OpenPGL minimum version to 0.5 and removing version checks 2023-05-23 13:23:09 +02:00
Jeroen Bakker
4997748e5e Vulkan: Select Compatible Render Surface
In previous implementation the first available render surface was
selected. For NVIDIA platform this was the correct one, but for
AMD and Intel GPUs this was incorrect. This PR goes over all the
available render surfaces and selects a compatible one.

For now when no compatible render surface is found it will still select
the first available one. With the expectation that the screen is drawn
incorrectly and users would report a bug so we can investigate.

Pull Request: https://projects.blender.org/blender/blender/pulls/108169
2023-05-23 11:03:53 +02:00
Sergey Sharybin
793446cbdc BLI: Replace some macros with inlined functions for C++
Covers the macro ARRAY_SIZE() and STRNCPY.

The problem this change is aimed to solve it to provide cross-platform
compiler-independent safe way pf ensuring that the functions are used
correctly.

The type safety was only ensured for GCC and only for C. The C++
language and Clang compiler would not have detected issues of passing
bare pointer to neither of those macros.

Now the STRNCPY() will only accept a bounded array as the destination
argument, on any compiler.

The ARRAY_SIZE as well, but there are a bit more complications to it
in terms of transparency of the change.

In one place the ARRAY_SIZE was used on float3 type. This worked in the
old code because the type implements subscript operator, and the type
consists of 3 floats. One would argue this is somewhat hidden/implicit
behavior, which better be avoided. So an in-lined value of 3 is used now
there.

Another place is the ARRAY_SIZE used to define a bounded array of the
size which matches bounded array which is a member of a struct. While
the ARRAY_SIZE provides proper size in this case, the compiler does not
believe that the value is known at compile time and errors out with a
message that construction of variable-size arrays is not supported.

Solved by converting the field to std::array<> and adding dedicated
utility to get size of std::array at compile time. There might be a
better way of achieving the same result, or maybe the approach is
fine and just need to find a better place for such utility.

Surely, more macro from the BLI_string.h can be covered with the C++
inlined functions, but need to start somewhere.

There are also quite some changes to ensure the C linkage is not
enforced by code which includes the headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/108041
2023-05-23 09:21:45 +02:00
Brecht Van Lommel
7d416ece82 Cleanup: fix compiler warnings 2023-05-22 17:08:50 +02:00
Sebastian Herholz
8d17458569 Cycles: Path Guiding: Adding guiding on glossy surfaces via RIS
Pull Request: https://projects.blender.org/blender/blender/pulls/107782
2023-05-22 16:47:05 +02:00
Xavier Hallade
6cce149144 Merge branch 'blender-v3.6-release' 2023-05-22 15:27:55 +02:00
Xavier Hallade
23de320878 Cycles: fix multi-device rendering with oneAPI and Hardware Raytracing
Only Embree CPU BVH was built in the multi-device case. However, one
Embree GPU BVH is needed per GPU, so we now reuse the same logic as in
the other backends.

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

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

Pull Request: https://projects.blender.org/blender/blender/pulls/107989
2023-05-22 10:14:35 +02:00
Campbell Barton
57f593b7ca Merge branch 'blender-v3.6-release' 2023-05-21 13:50:45 +10:00
Campbell Barton
047ff43ee4 Fix GHOST/Wayland configuring an XDG surface before it was handled
xdg_surface_ack_configure must run once the events have been handled
which is not the case configure runs from the event handling thread.

In practice this could lead to glitches resizing windows, although some
flickering on startup remains on KDE which would be good to resolve.
2023-05-21 13:47:56 +10:00
Campbell Barton
8925ea1890 Merge branch 'blender-v3.6-release' 2023-05-20 21:18:02 +10:00
Campbell Barton
bf36a61e62 Cleanup: spelling in comments & some corrections 2023-05-20 21:17:09 +10:00
Weizhen Huang
51923c09e2 Cycles: implement faster #make_orthonormals()
Pull Request: #106053
2023-05-19 12:13:39 +02:00
Campbell Barton
3a286a735f Merge branch 'blender-v3.6-release' 2023-05-19 19:56:20 +10:00
Campbell Barton
c007e6a346 Fix occasional crash on exit under Wayland
pthread_cancel was sometimes called once the thread had exited,
resolve this by having the function wait to be canceled.
2023-05-19 19:51:42 +10:00
Campbell Barton
9af19822f0 Merge branch 'blender-v3.6-release' 2023-05-19 16:27:42 +10:00
Campbell Barton
2ce7f3ec71 Fix crash on exit under Wayland with multiple windows open
Exiting with multiple overlapping windows (a file selector for e.g.)
reliably crashes.

Closing the windows on exit caused the the keyboard enter handler to be
called with a NULL window surface (wl_surface).

While this doesn't look to be documented anywhere, SDL's code-comments
note this happens when windows have just been closed.
GTK also check surfaces for NULL.
2023-05-19 16:25:56 +10:00
Campbell Barton
3db0bde21d Merge branch 'blender-v3.6-release' 2023-05-19 15:14:27 +10:00
Campbell Barton
2eaacbaa3f Fix memory leak on exit under GHOST/Wayland 2023-05-19 15:10:51 +10:00
Lukas Stockner
8cde7d8f8a Cycles: Merge Anisotropic BSDF node into Glossy BSDF node
Used to be https://archive.blender.org/developer/D17123.

Internally these are already using the same code path anyways, there's no point in maintaining two distinct nodes.

The obvious approach would be to add Anisotropy controls to the Glossy BSDF node and remove the Anisotropic BSDF node. However, that would break forward compability, since older Blender versions don't know how to handle the Anisotropy input on the Glossy BSDF node.

Therefore, this commit technically removes the Glossy BSDF node, uses versioning to replace them with an Anisotropic BSDF node, and renames that node to "Glossy BSDF".

That way, when you open a new file in an older version, all the nodes show up as Anisotropic BSDF nodes and render correctly.

This is a bit ugly internally since we need to preserve the old `idname` which now no longer matches the UI name, but that's not too bad.

Also removes the "Sharp" distribution option and replaces it with GGX, sets Roughness to zero and disconnects any input to the Roughness socket.

Pull Request: https://projects.blender.org/blender/blender/pulls/104445
2023-05-18 23:12:20 +02:00
Sergey Sharybin
406cfd214a Refactor ImBuf buffer access
The goal is to make it more explicit and centralized operation to
assign and steal buffer data, with proper ownership tracking.

The buffers and ownership flags are wrapped into their dedicated
structures now.

There should be no functional changes currently, it is a preparation
for allowing implicit sharing of the ImBuf buffers. Additionally, in
the future it is possible to more buffer-specific information (such
as color space) next to the buffer data itself. It is also possible
to clean up the allocation flags (IB_rect, ...) to give them more
clear naming and not have stored in the ImBuf->flags as they are only
needed for allocation.

The most dangerous part of this change is the change of byte buffer
data from `int*` to `uint8_t*`. In a lot of cases the byte buffer was
cast to `uchar*`, so those casts are now gone. But some code is
operating on `int*` so now there are casts in there. In practice this
should be fine, since we only support 64bit platforms, so allocations
are aligned. The real things to watch out for here is the fact that
allocation and offsetting from the byte buffer now need an explicit 4
channel multiplier.

Once everything is C++ it will be possible to simplify public
functions even further.

Pull Request: https://projects.blender.org/blender/blender/pulls/107609
2023-05-18 10:19:01 +02:00
Campbell Barton
a9358f5274 Fix Blender failing to start in Gnome when X11 isn't available
Only make libdecor a hard-requirement for using Wayland in gnome-shell
when X11 is available, as it's possible to disable Xwayland.

This also fixes window-borders not being used in gnome-shell when
WITH_GHOST_X11 is off.

Now it's possible to test Blender under gnome without libdecor by
uninstalling libdecor & running with DISPLAY environment variable
set to an empty string - useful for troubleshooting issues which
could be caused by libdecor.
2023-05-18 09:33:46 +10:00
Nikita Sirgienko
bafd82c9c1 Cycles: oneAPI: use local memory for faster shader sorting
Co-authored-by: Stefan Werner <stefan.werner@intel.com>

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

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

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

Includes changes needed for the buildbot building pipeline.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/107585
2023-05-12 16:30:23 +02:00
Xavier Hallade
5ec2495550 Cycles: oneAPI: enable Hardware Raytracing for Raytrace/MNEE kernels
We do so if Embree 4.1+ is present.
2023-05-12 14:17:50 +02:00
Jeroen Bakker
b029db5461 Vulkan: AMD Swapchain
This PR enabled the swapchain to be used with AMD GPUs.
The issue is that we had to separate the swapchain into
2 functions and therefore the rendering is also not
controlled at the same time.

Semaphores were finished, before being used and the
driver stalled when waiting for those Semaphores.

This doesn't solve the issue that renderdoc can still
crash the graphics driver.

Pull Request: https://projects.blender.org/blender/blender/pulls/107840
2023-05-11 14:29:38 +02:00
Jeroen Bakker
6a20b0022c Vulkan: Swap Chain
This PR replaces the previous implementation of the swap chain.
The previous implementation was based on a gaming loop where
inside a single function an image is requested, the drawing occurs
and the requested image is presented on screen.

In blender the drawing isn't controlled in a single function and
this approach lead to freezes, missing frames and other
artifacts.

This approach is not be the final approach but a step into a
direction where the acquiring of the next image in the swap chain
is separated from the swapping.

Pull Request: https://projects.blender.org/blender/blender/pulls/107740
2023-05-11 12:51:05 +02:00
Weizhen Huang
8e70ab9905 Fix #107603: queried the area of an empty bounding box 2023-05-11 11:18:12 +02:00
Sebastian Herholz
d864b5ce28 Cycles: BSDF ensuring that eval, pdf and label are intialized to zero and None 2023-05-09 15:40:05 +02:00
Brad Smith
322dab936f Build: fixes for OpenBSD
Pull Request: https://projects.blender.org/blender/blender/pulls/107666
2023-05-09 13:19:16 +02:00
Campbell Barton
3958ae7241 Cleanup: use STRNCPY, SNPRINTF macros 2023-05-09 14:08:19 +10:00
Weizhen Huang
6a7ca67a98 Fix #107725: ray-offset was incorrectly applied on motion triangles
79f1cc601c introduces a ray-offset to improve ray tracing precision near
triangle edges, but motion triangles still read the static vertices,
causing incorrect intersection detection

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

Ref #104786

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

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

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

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

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

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

Pull Request: https://projects.blender.org/blender/blender/pulls/106774
2023-05-04 15:39:10 +02:00
Jeroen Bakker
f428fd8229 Vulkan: Share Device Between Contexts
Previous GHOST_ContextVK would create a logical device for each
context. Blender uses multiple contexts at the same time and wasn't able
to share resources between them as the logical device where different.

This patch will create a single logical device and share them between
multiple contexts. This allows sharing memory/shaders between contexts
and make sure that all memory allocations are freed from the device it
was allocated from.

Some allocations in Blender are freed when there isn't a context, this
was failing in the previous implementation. We didn't noticed it before
as we didn't test multiple contexts.

This patch also moves device specific data structures from VKContext to
VKDevice like the descriptor pools, debug layers etc.

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

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

Pull Request: https://projects.blender.org/blender/blender/pulls/107551
2023-05-02 20:13:58 +02:00
Sergey Sharybin
e3f14b99c3 Refactor: Convert ImBuf to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/107503
2023-05-02 11:32:27 +02:00
Campbell Barton
f154d37335 BLI_path: add a size argument to BLI_path_frame
Resolves potential buffer overflow in
USDVolumeWriter::construct_vdb_file_path which passed in a smaller
fixed size buffer than FILE_MAX.
2023-05-02 17:19:48 +10:00
Campbell Barton
a0db0a5580 Cleanup: move comments wrapped with MultiLine control statements
In some cases comments at the end of control statements were wrapped
onto new lines which made it read as if they applied to the next line
instead of the (now) previous line.

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

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

Pull Request: https://projects.blender.org/blender/blender/pulls/107450
2023-05-01 12:07:26 +02:00
Campbell Barton
46316b29dc GHOST/Wayland: remove keyboard modifier mismatch warning suppression
Detecting when to show warnings about GHOST/XKB modifier
mismatches was rather involved, remove the check as it's
unnecessary for Gnome-Shell >= v43.

Older versions of Gnome-Shell will show warnings on window activation
with modifier keys held.
2023-05-01 11:57:45 +10:00
Campbell Barton
4efacf7e85 GHOST/Wayland: use GHOST modifiers, not XKB without an active windows
Reading modifiers from XKB caused a complications in getModifierKeys(..)
when called on a window that was activated, before the keyboard enter
handler had run - because the keys held by GHOST had not yet been
updated by XKB. This caused a problem which Gnome-shell which runs
the keyboard-enter handler after window activation.

This change would have fixed the Super key being stuck, see: #107314.
Keep the previous fix since in the unlikely case GHOST & XKB get out of
sync, stuck modifier keys should still be prevented.

This change means the warning for GHOST & XKB getting out of sync
can be enabled for Gnome-shell again, as it was previously suppressed
as it happened frequently on window activation.
2023-05-01 11:57:13 +10:00
Jesse Yurkovich
97222519de Fix #106945: IES file parsing failures
There were two issues here preventing the proper display of the IES
files in question.

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

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

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

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

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

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

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

Pull Request: https://projects.blender.org/blender/blender/pulls/107424
2023-04-28 10:51:03 +02:00
Campbell Barton
7b8ba7f101 Fix #107314: OS key stuck when switching windows with GNOME/Wayland
Tapping the OS key to switch windows could cause the OS key to stick.

On window deactivation the OS key was considered held, activating the
window later read the XKB modifier state before the keyboard_enter &
keyboard_modifier callbacks had run.

When they ran later, the mis-match between XKB and GHOST was not taken
into account, causing the OS key to stick.
2023-04-28 16:06:37 +10:00
Sergey Sharybin
02b5c04b2b Fix intersection distance offset in Cycles
The intersection distance offset in Cycles could have returned
a denormal floating point value for the input values of 0 (and
for the denormal input value).

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

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

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

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

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

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

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

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

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

Ref #105538
2023-04-25 20:19:43 +02:00
Brecht Van Lommel
63dfbdc187 Fix mistake in Cycles float4 pow
Not currently used anywhere, so should be no user visible change.
2023-04-25 20:19:43 +02:00
Brecht Van Lommel
ca52f0fae3 Cleanup: make format 2023-04-25 20:19:43 +02:00
Jeroen Bakker
26147b29a7 Vulkan: Construct a Vulkan 1.2 Context.
Apparently we always constructed a Vulkan 1.0 Context, although we
are targetting Vulkan 1.2. This also lead to incorrect expectations
when using the Vulkan Memory allocator.

Pull Request: https://projects.blender.org/blender/blender/pulls/107300
2023-04-24 15:32:17 +02:00
Michael Jones
d0467a277a Cycles: MetalRT: Don't apply local object transform if it is baked
This patch fixes the failing shader/bevel unit test when MetalRT is enabled. The ray was being transformed into local object space even when the SD_OBJECT_TRANSFORM_APPLIED flag was set.

Pull Request: https://projects.blender.org/blender/blender/pulls/107292
2023-04-24 15:20:21 +02:00
Alaska
4259105d68 Clean up: Fix spacing on Cycles debug message "Use MNEE"
This changes the Cycles Debug message for "Use MNEE" from:
"Use MNEEFalse"
to
"Use MNEE False"

Pull Request: https://projects.blender.org/blender/blender/pulls/107269
2023-04-24 08:49:14 +02:00
AgAmemnno
bebb17a973 Vulkan: Provide Debug Utilities
This PR uses the VK_EXT_debug_utils extension, but it's only for labeling, so it doesn't rely on the VK_LAYER_KHRONOS_validation functionality.

The functions that do these things are loaded into the runtime as vulkan extensions.

Declare the function pointers in a struct and make them members of vk_context.

Pull Request: https://projects.blender.org/blender/blender/pulls/106098
2023-04-21 12:32:40 +02:00
Campbell Barton
54ce0ac922 Cleanup: use const variables when reading X11 events 2023-04-21 09:12:31 +10:00
Campbell Barton
62806012ed Cleanup: resolve uninitialized members in GHOST Window & SystemX11
While this didn't cause bugs, initialize members to avoid problems
in the future.

GHOST::SystemX11
- m_keyboard_vector
- m_keycode_last_repeat_key

GHOST::Window
- m_cursorGrabInitPos
- m_userData
2023-04-21 09:06:25 +10:00
Nikita Sirgienko
4babb7c02e Cycles: oneAPI: Fix volume intersection for Embree GPU execution 2023-04-20 21:20:33 +02:00
Nikita Sirgienko
0d9fa73b42 Cycles: oneAPI: Fix motion blur rendering for Embree GPU execution
CPU non-unified shared memory was used for shared geometry buffers.
For the Embree GPU case, we now create new geometry buffers on GPU instead.
2023-04-20 21:20:33 +02:00
Nikita Sirgienko
7e92fb92ec Cycles: oneAPI: Fix kernels preloading in case of incompatible AoT binaries
When running oneAPI with AoT binaries, on hardware that's not compatible with
these, recompilation could have been missing from the kernels loading phase and
happen during execution instead.

These changes fixes it, any kernel compilation will now happen during the
kernels loading phase.
2023-04-20 21:20:33 +02:00
Brecht Van Lommel
13d30b0481 Cleanup: fix various warnings on Windows
Ensure windows.h is included before some other headers to avoid
redefining macros.

Pull Request: https://projects.blender.org/blender/blender/pulls/107189
2023-04-20 20:46:13 +02:00
Ankit Meel
f04a7a07e3 macOS: Add open files to system recent files
Completes the TODO in GHOST_SystemPathsCocoa::addToSystemRecentFiles
Also renames the filename parameter to the more appropriate filepath.

The recently opened/saved file will now also show up in:
- Blender Dock icon > Right click.
- Three finger swipe down in Open Blender i.e., App Expose

Based on a earlier contribution by @jenkm.

Pull Request: https://projects.blender.org/blender/blender/pulls/107174
2023-04-20 23:53:08 +05:30
William Leeson
475f9a3e23 Cycles: Break up geometry.cpp and scene.cpp file into smaller pieces
Scene.cpp  and Geometry.cpp are large file it can be broken up into smaller easier to handle files. This change has been broken out from #105403 to make understanding the changes easier.

geometry.cpp is broken up into:
1. geometry.cpp
2. geometry_attributes.cpp
3. geometry_bvh.cpp
4. geometry_mesh.cpp

scene.h & scene.cpp is broken into:
1. scene.h
2. scene.cpp
3. devicescene.h
4. devicescene.cpp

Pull Request: https://projects.blender.org/blender/blender/pulls/107079
2023-04-20 12:26:02 +02:00
Nikita Sirgienko
7ce10ebbbf Cycles: oneAPI: Remove excess quotes in a capabilities output 2023-04-20 11:09:16 +02:00
Campbell Barton
335d32153e Cleanup: remove dead code, reduce variable scope 2023-04-20 13:57:31 +10:00
Campbell Barton
62cc09f267 Cleanup: match argument names between functions & declarations 2023-04-20 13:52:58 +10:00
Brecht Van Lommel
d5757a0a10 Cycles: re-enable AMD GPU binaries on Windows
Using the new HIP SDK 5.5 that includes a fix for the compiler bug.

This also enables the light tree.

For Linux the binaries are still disabled. ROCm 5.5 is planned to
include the same fix but not released yet. When that happens we
should be able to enable Linux as well.

Ref #104786
Fix #104085

Pull Request: https://projects.blender.org/blender/blender/pulls/107098
2023-04-19 18:18:05 +02:00
Sergey Sharybin
a20f45bab9 Fix unqualified access to std::move in OpenSubdiv 2023-04-19 10:02:09 +02:00
Sergey Sharybin
63c20e08c4 Fix set but unused variable in Libmv 2023-04-19 10:02:09 +02:00
Sergey Sharybin
4f7dc1e4b6 Fix set but unused variable in IK solver 2023-04-19 10:02:09 +02:00
Sergey Sharybin
8ed543c6f2 Fix set but unused variable in dualcon octree 2023-04-19 10:02:09 +02:00
Sergey Sharybin
daaed83a32 Fix set but unused variables in Cycles 2023-04-19 10:02:09 +02:00
Sergey Sharybin
7982d86117 Fix unqualified access to std::move in Cycles 2023-04-19 10:02:09 +02:00
Campbell Barton
b132118f89 Cleanup: balance doxygen grouping, minor grouping adjustment 2023-04-19 09:02:21 +10:00
Campbell Barton
88f5dd3c72 Cleanup: format 2023-04-19 08:02:42 +10:00
Campbell Barton
eb2867de90 Cleanup: spelling in comments 2023-04-19 08:02:41 +10:00
Mateusz Albecki
0fd14d659b GHOST/Wayland: Fix disposeContext with VK
During createOffscreenContext with VK backend enabled wl_surface
was not stored in the context's user data. This resulted in nullptr
dereference later on during disposeContext. Added a line that sets
user data and additionally added nullptr checks in disposeContext.

Ref !107057.
2023-04-19 07:44:06 +10:00
Xavier Hallade
4382a0b350 Cleanup: avoid warnings from gcc in oneAPI device compilation
When building using GCC and with Embree without GPU support, there were
a few unused variables and a non-defined macro.
2023-04-18 22:40:40 +02:00
Xavier Hallade
70892e82ac Cycles: oneAPI: use specialization constant to compile with/without Embree on GPU 2023-04-18 22:09:42 +02:00
Xavier Hallade
9821a2d397 Cycles: pass kernel features to get_bvh_layout_mask
This allows to selectively disable Hardware Raytracing in oneAPI
backend, depending on features used.
2023-04-18 22:09:42 +02:00
Nikita Sirgienko
3f8c995109 Cycles: add hardware raytracing support to oneAPI device
Updated Embree 4 library with GPU support is required for it to be
compiled - compatiblity with Embree 3 and Embree 4 without GPU support
is maintained.
Enabling hardware raytracing is an opt-in user setting for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/106266
2023-04-18 22:09:42 +02:00
Xavier Hallade
887022257d Cycles: update DPCPP to 2022-12 release
We also backport a patch to program_manager to it as
61e51015a5
helps avoid unnecessary recompilation when enumerating available
kernels.
2023-04-18 22:09:41 +02:00
Xavier Hallade
954c6c0ae6 Revert "Cycles: move oneAPI kernels dynamic library to blender.shared"
This reverts commit df096eab77436c0191f39806b0907aeb9744bee8.
There is a corner case for when WITH_CYCLES_ONEAPI_BINARIES is set to on
and later turned off during config, in case there is no ocloc.
2023-04-18 18:48:37 +02:00
Weizhen Huang
4d7a7ce67c Fix #107050: accessing nullptr after progress is canceled 2023-04-18 11:58:07 +02:00
Dalai Felinto
664b31ea73 Cleanup: make format 2023-04-18 09:45:01 +02:00
Xavier Hallade
df096eab77 Cycles: move oneAPI kernels dynamic library to blender.shared
After 17800e0c03c30a2f0059391821adf84f32616287, the oneAPI kernels library was still able to find sycl6.dll but that wasn't reliable.
We fix this by moving the oneAPI kernels library also into blender.shared.

Pull Request: https://projects.blender.org/blender/blender/pulls/106894
2023-04-17 21:47:35 +02:00
Brecht Van Lommel
09b770388a Fix #107004: Cycles shadow caustics not working with area lights
Tested the wrong variable after a refactor for light spread.
2023-04-17 20:46:08 +02:00
Brecht Van Lommel
870930bc32 Fix build error using WITH_CYCLES_LOGGING=OFF
Mismatch between glog and stubs. CHECK_NULL does not exist also. Tests
also require logging to be available.
2023-04-17 20:36:18 +02:00
Brecht Van Lommel
74eda0b6fc Fix build error on macOS after previous commit 2023-04-17 17:47:29 +02:00
Brecht Van Lommel
92919864a0 Fix #106293: Cycles importance sampling with multiple suns works poorly
Keep sun in importance map in this case, as we do not use special sun
importance sampling in this case.
2023-04-17 17:30:47 +02:00
Alaska
cff94a808e Fix #106706: fireflies with Nishita sky sun sampling at certain angles
Due to floating point differences between importance sampling and
texture evaluation, disagreeing on whether or not a ray lies within
the sun disc.

* Use the same input values for geographical_to_direction() in
  sky_radiance_nishita() and kernel_data.background.sun.
* The mathematical operations in pdf_uniform_cone() were adjusted to
  match sky_radiance_nishita().

Pull Request: https://projects.blender.org/blender/blender/pulls/106764
2023-04-17 17:29:27 +02:00
Brecht Van Lommel
0bc957063c Fix #106405: Cycles multi GPU crash with vertex color baking
Avoid division by zero when one of the devices gets no work.
2023-04-17 15:31:35 +02:00
Hans Goudey
2a4323c2f5 Mesh: Move edges to a generic attribute
Implements #95966, as the final step of #95965.

This commit changes the storage of mesh edge vertex indices from the
`MEdge` type to the generic `int2` attribute type. This follows the
general design for geometry and the attribute system, where the data
storage type and the usage semantics are separated.

The main benefit of the change is reduced memory usage-- the
requirements of storing mesh edges is reduced by 1/3. For example,
this saves 8MB on a 1 million vertex grid. This also gives performance
benefits to any memory-bound mesh processing algorithm that uses edges.

Another benefit is that all of the edge's vertex indices are
contiguous. In a few cases, it's helpful to process all of them as
`Span<int>` rather than `Span<int2>`. Similarly, the type is more
likely to match a generic format used by a library, or code that
shouldn't know about specific Blender `Mesh` types.

Various Notes:
- The `.edge_verts` name is used to reflect a mapping between domains,
  similar to `.corner_verts`, etc. The period means that it the data
  shouldn't change arbitrarily by the user or procedural operations.
- `edge[0]` is now used instead of `edge.v1`
- Signed integers are used instead of unsigned to reduce the mixing
  of signed-ness, which can be error prone.
- All of the previously used core mesh data types (`MVert`, `MEdge`,
  `MLoop`, `MPoly` are now deprecated. Only generic types are used).
- The `vec2i` DNA type is used in the few C files where necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/106638
2023-04-17 13:47:41 +02:00
Bastien Montagne
dfa42c614f Cleanup: UI messages fixes and tweaks. 2023-04-17 11:41:10 +02:00
Campbell Barton
e78c3c9d96 Docs: comments for disabling the front-buffer & view3d offset correction
Expand on why front-buffer support is always disabled on Wayland &
why viewport orbit around selection offset correction isn't used for
perspective views.
2023-04-17 12:27:34 +10:00
Harley Acheson
de7e3454fb UI: Capabilities Flag for Clipboard Image copy/paste
This adds an WM_capabilities_flag to indicate that a platform
implements support for copying and pasting images using a shared
clipboard.

Pull Request: https://projects.blender.org/blender/blender/pulls/106990
2023-04-16 21:04:55 +02:00
Campbell Barton
e1571cb105 Cleanup: correct terms, spelling in comments 2023-04-16 20:41:22 +10:00
Campbell Barton
6cc2c16d06 Fix #106264: Color picker broken with Wayland & AMD GPU
- Use off-screen drawing when reading from the front-buffer isn't
  supported.

- Add a capabilities flag for reading the front-buffer which is always
  disabled on WAYLAND.

- Add GPU_offscreen_read_pixels_region, used for reading a sub-region of
  an off-screen buffer - use for color-picking a single pixel.
2023-04-16 20:16:54 +10:00
Weizhen Huang
bfd1836861 Cycles: add instancing support in light tree
Build a subtree for each unique mesh light.

Pull Request: #106683
2023-04-14 19:12:16 +02:00
Hans Goudey
988f23cec3 Attributes: Add 2D integer vector attribute type
This type will be used to store mesh edges in #106638, but it could
be used for anything else too. This commit adds support for:
- The new type in the Python API
- Editing the type in the edit mode "Attribute Set" operator
- Rendering the type in EEVEE and Cycles for all geometry types
- Geometry nodes attribute interpolation and mixing
- Viewing the type in the spreadsheet and using row filters

The attribute uses the `blender::int2` type in most code, and
the `vec2i` DNA type in C code when necessary. The enum names
are based on `INT32_2D` for consistency with `INT8` and `INT32`.

Pull Request: https://projects.blender.org/blender/blender/pulls/106677
2023-04-14 16:08:05 +02:00
Campbell Barton
37b7702d74 Cleanup: comment blocks, #if 0 commented code 2023-04-14 13:51:38 +10:00
Harley Acheson
39bcf6bdc9 UI: Allow Clipboard Copy/Paste Images
Adds operators to copy and paste to and from the OS clipboard, but only
implemented for Windows.

Pull Request: https://projects.blender.org/blender/blender/pulls/105833
2023-04-14 03:48:17 +02:00
Patrick Mours
5ba35b3d15 Fix #106748: Rendering with OSL fails with OPTIX_ERROR_PIPELINE_LINK_ERROR
The OSL GPU services implementation of noise intrinsics was missing the
overloads for derivatives and therefore OptiX pipeline creation would fail if
those were referenced.
2023-04-13 15:52:23 +02:00
Sebastian Parborg
aa6e95281f Add support for OpenPGL 0.5.0
Some functions changed slightly for this non beta release.
No functional changes though as we didn't use what was removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/106861
2023-04-13 11:44:35 +02:00
Sergey Sharybin
e5d50b1787 Fix Cycles unknown passes logged when build with Cycles debug
When WITH_CYCLES_DEBUG is set to ON the following errors are
printed to the console:

E0412 15:51:22.588564 7996345 sync.cpp:737] Unknown pass Guiding Color
E0412 15:51:22.588605 7996345 sync.cpp:737] Unknown pass Guiding Probability
E0412 15:51:22.588613 7996345 sync.cpp:737] Unknown pass Guiding Average Roughness

This change fixes this by treating the guiding passes the same
way as all other passes, solving the errors and making it possible
to visualize guiding passes in the viewport later on.

Pull Request: https://projects.blender.org/blender/blender/pulls/106863
2023-04-13 10:27:07 +02:00
Ankit Meel
ed4374f089 Fix #66722: file doesn't open if app not focused
After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen. So fetch any
window instead of relying on active one to open the file.

pull request #106769
2023-04-13 10:48:29 +05:30
Campbell Barton
0a270e3513 Revert "GHOST/Wayland: avoid up-scaling window content"
This reverts commit 4fe26856152304350930dbeebc31521aa31f0f9f.

Always use the preferred_scale requested by the compositor as this
did not work so well in the intended use case (where the low resolution
monitor text was scaled down and difficult to see).

After discussion with @ZedDB, revert this change since there are cases
where either functionality might be preferred - to ensure Blender's UI
is visible on a low resolution mirrored projector for e.g.

Changing the behavior of the preferred scale makes most sense in the
compositor, instead of controlling it on a per-application basis.
2023-04-13 13:14:24 +10:00
Damien Picard
5cf365554b I18n: disambiguate a few messages
- "Lens" can be a transparent object used in cameras, or specifically
  its property of focal length
- "Empty" can be an adjective meaning void, or an object type. The
  latter is already disambiguated using `ID_ID`
- "New" and "Old" are adjectives that can have agreements in some
  languages
- "Modified" is an adjective that can have agreement in some languages
- "Clipping" can be a property of a camera, or a behavior of the
  mirror modifier
- "Value" in HSV nodes, see #105113
- "Area" in the Face Area geometry node, can mean a measurement or a
  window type
- "New" is an adjective that can have agreement
- "Tab" can be a UI element or a whitespace character
- "Volume" can mean a measurement or an object type. The latter is
  already disambiguated using `ID_ID`

These changes introduce the new `BLT_I18NCONTEXT_TIME` translation
context.

They also remove `BLT_I18NCONTEXT_VIRTUAL_REALITY`, which I added at
one point but then couldn't find which messages I wanted to fix with
it.

Ref #43295

Pull Request: #106718
2023-04-12 15:09:17 +02:00
Campbell Barton
28a8a3c086 Fix crash on startup under the RIVER Wayland compositor
Defer acting on the tag to update scale as it caused the window
to use the wrong scale on startup & exit.

GTK/KDE applications seem to postpone updating scale so use this by
default as glitches with scale tend to be caused by updating the scale
too frequently instead of not quickly enough.
2023-04-12 15:54:06 +10:00