Commit Graph

109681 Commits

Author SHA1 Message Date
Jeroen Bakker
da4f84a416 Fix: Reduce compilation warnings
Reduces compilation warnings on
- clang
- GCC < 14
- MSVC

Pull Request: https://projects.blender.org/blender/blender/pulls/122298
2024-05-27 10:30:54 +02:00
Campbell Barton
580ddfbd4b Cleanup: remove outdated reference to "derived" mesh 2024-05-27 12:08:22 +10:00
Campbell Barton
52d34d1a44 Cleanup: spelling in comments 2024-05-27 12:07:03 +10:00
Campbell Barton
db58cde877 Cleanup: suppress template-id-cdtor GCC warnings
Ignoring from CMake didn't suppress the warnings from GPU sources
that include this header. Suppress the warning using a pragma instead.
2024-05-27 11:58:46 +10:00
Clément Foucault
c3b985906d Cleanup: EEVEE-Next: Remove leftover debug printf
It was never meant to be commited.
2024-05-26 22:11:01 +02:00
Clément Foucault
0e11f168db EEVEE-Next: Expose Fast GI ray and step count
This allow to reduce the amount of noise and reduce
the lost energy caused by low thickness and large
stride (low sample count).

Actual number of rays is twice the UI count.
2024-05-26 20:23:42 +02:00
Clément Foucault
fbeb4b5914 Fix: EEVEE-Next: Light transmission influence is 0 in startup file
Was just missing the versionning code for it.
2024-05-26 19:01:48 +02:00
Clément Foucault
9f2f1a5c57 EEVEE-Next: Shadow: Remove per light resolution scale
The reasonning is that we already have a resolution limit
slider per light.

The global shadow resolution scale is usefull as a quick
speedup option to reduce shadow cost for viewport regular
work or for quick rendering. For final render, the per
light resolution limit is more suited  than a LOD scale
since it doesn't modify the filtering of based on distance
from the camera.

This feature is really not hard to add back if there is
a compelling use case for it.
2024-05-26 18:56:03 +02:00
Clément Foucault
4bc015310f Fix: EEVEE-Next: Fix broken shadow global resolution scale
It was not connected to anything.
2024-05-26 18:27:18 +02:00
Iliya Katueshenock
4fc8a72780 Fix: correct offset for internal multi-input link
Pull Request: https://projects.blender.org/blender/blender/pulls/109776
2024-05-26 13:37:52 +02:00
Clément Foucault
03bcd70cd1 EEVEE-Next: Improve shadow map filter
This make the filter have a constant width in shadow
space making sure to always filter the correct amount
of pixels.

This uses the receiver slope to put the samples on a
cone with its apex at the shading position instead of
setting up the disk in shading tangent space.

We limit the slope bias to 45 degrees and offset the
cone in normal direction if the angle between light and
receiver is greater than 45 degrees. This avoid any
self shadowing artifacts cause by this technique.

Pull Request: https://projects.blender.org/blender/blender/pulls/122266
2024-05-26 12:53:18 +02:00
Philipp Oeser
f93360b3bb Fix: dont allow image operations on non-editable images
Non-editable is mostly linked (besides some incoming exception for the
Brush Asset project).
If the Image is linked but not packed, conceptually it does not really
make a difference (edits for a linked vs local image would still end up
in the same external file when saved). However when it is linked and
packed we are running into Undo crashes (#122131). Also the image
remains linked, so data remains to be read/loaded from the packed
version from the library (so any edits are lost).

For consistency, disallow image operations for all non-editable images.

ref. #122131
ref. #122033

Pull Request: https://projects.blender.org/blender/blender/pulls/122209
2024-05-26 11:32:50 +02:00
Philipp Oeser
a65df02031 Fix: Dont unpack resources that are packed in linked files (next round)
These remain linked, so data remains to be read/loaded from the packed
version from the library (making this a useless and wasteful
duplication, also changes could be perceived as lost)

Continuation of !122092 which came up in #122033 -- but spread to more
operators / API so it is consistent everywhere

For operators, first intuition was to do it in a poll function, but that
isnt possible because the actual ID might depend on a given (to the
operator) ID name.

NOTE: Still not 100% in which scenarios linked data could still be
editable, but using ID_IS_EDITABLE for this now.

c6aa1fec2b / 918d34a9ed are related

Pull Request: https://projects.blender.org/blender/blender/pulls/122204
2024-05-26 11:32:06 +02:00
Philipp Oeser
9c534cda00 Fix: Still allow unpacking of editable linked datablocks
Similar to 918d34a9ed, enable the button in `template_ID()`

Ref #122092

Pull Request: https://projects.blender.org/blender/blender/pulls/122199
2024-05-26 11:30:56 +02:00
Clément Foucault
4624b1a9ae Cleanup: EEVEE-Next: Group BSDF functions to per BSDF type files
The goal of this is to make it easier to add more BSDF
support in the future. Avoids code fragmentation and
allows easy entry points to all algorithms using BSDFs.

Pull Request: https://projects.blender.org/blender/blender/pulls/122255
2024-05-25 23:40:12 +02:00
Jesse Yurkovich
9daded5d87 USD: Use nodes for alpha-clip behavior instead of material properties
EEVEE-next has removed the MA_BM_CLIP / alpha_threshold material
properties in favor of using nodes for equivalent functionality. This
changes USD to build and traverse node graphs during import and export
accordingly. Indirectly this allows Cycles to correctly render such
materials now too.

A complicating factor is that the UsdPreviewSurface defines its opacity
threshold using greater-than-equals[1], which Blender does not support
(and for which was technically already incorrect as EEVEE-legacy only
used greater-than for its shaders). Due to this we actually need to use
2 nodes: A less-than, followed by a one-minus invert, to arrive at the
proper value. We'll translate UsdPreviewSurface to this form on Import.

For Export we will look for either this 2-node pattern or a Round
node plugged into Alpha. Looking for Round is a result of the glTF
documentation which recommended the use of this node for thresholds of
0.5[2]. It's a tiny addition that seems reasonable to accommodate.

[1] https://openusd.org/release/spec_usdpreviewsurface.html (search for "opacityThreshold")
[2] https://docs.blender.org/manual/en/4.2/addons/import_export/scene_gltf2.html#alpha-modes

See PR for example images

Pull Request: https://projects.blender.org/blender/blender/pulls/122025
2024-05-25 23:30:13 +02:00
Jesse Yurkovich
21db0daa4e USD: Read and write custom attributes for Curves
Add support for reading and writing custom `Curves` attributes.

This allows us to roundtrip Blender's Hair grooms containing UVs and
other attribute data. Note that animated attribute values are not
supported with this change.

This will also address #120042

Pull Request: https://projects.blender.org/blender/blender/pulls/121928
2024-05-25 22:23:40 +02:00
Hans Goudey
d3dbd7bdd0 Cleanup: Slightly simplify crazyspace quats loop
- Use "vert" in variable names instead of "i"
- Declare variables where their values are assigned
- Use float3 instead of pointers
- Avoid empty checks in loop by assigning span differently
2024-05-25 10:41:07 -04:00
Iliya Katueshenock
10befe6de7 Fix: Nodes: Assert on node copy
Fix of issue after fac97d6c49.
If node have dynamic declaration, update of node cause update of the declaration and its sockets.
So, links update have to be in separate loop.

Pull Request: https://projects.blender.org/blender/blender/pulls/122261
2024-05-25 14:55:15 +02:00
Pratik Borhade
200cf730d8 Fix #122241: Apply selected as rest pose not working
Mistake in acd1b0b7f9
This is due to early return from the operator execution when selection
exists.

Thanks @Ruri-Res for finding it.

Pull Request: https://projects.blender.org/blender/blender/pulls/122254
2024-05-25 11:20:28 +02:00
Charles Wardlaw
b2d1979882 USD Export: option to triangulate meshes
This allows for the source of truth data in the Blender scene to remain
untouched while producing triangulated output suitable for game and VR
pipelines, where only triangles are ingested. This addition aligns USD
with some of the other exporters which offer a similar feature.

Co-authored-by: Charles Wardlaw <cwardlaw@nvidia.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/121274
2024-05-25 03:47:35 +02:00
Charles Wardlaw
bfa54f22ce USD Import: Added an option to import only defined prims
Prims in a UsdStage can be created directly (def) or as an over. Overs
might not always be desired at import time. This patch adds the ability
to choose whether to load only defined prims (the default behaviour, and
as it exists currently in main). By unchecking this option at import
time, prims created as overs will also be imported.

Co-authored-by: Charles Wardlaw <cwardlaw@nvidia.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/121321
2024-05-24 23:50:08 +02:00
Jacques Lucke
6b6657405f Fix #76704: resetting socket values always resets to zero instead of default value
The fundamental limitation here was that RNA did not support different default values
for the same property yet (and all sockets of the same type have the same property).
This patch solves this by adding a new callback to rna property types to retrieve a
default value dynamically. Together with the socket declarations it's fairly easy to get
this working nowadays.

This also works for group nodes, because they use the socket declaration internally too.

Pull Request: https://projects.blender.org/blender/blender/pulls/122216
2024-05-24 22:16:59 +02:00
Charles Wardlaw
a6a5fd053a USD Export: filtering option for types to export
Added option for filtering types of objects to export.  Meshes,
materials, lights, cameras, volumes, and curves are all equally
supported.

This is useful for many situations in which a user might want a
subset of objects from a Collection without wanting to build a
sub-collection or otherwise reorganize their scene.  Exporting
Armatures and their animation as UsdSkel objects and UsdSkelAnim
clips, but without meshes, is a good example.

Co-authored-by: Charles Wardlaw <cwardlaw@nvidia.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/121325
2024-05-24 22:16:43 +02:00
Sergey Sharybin
62ebc5f351 Fix Image Save operator locking when saving render result
The issue has been introduced by #122105

The image save operator does exactly the thing which was not supported by
the change and was not caught during development or view: it acquires and
releases image buffers while a render result of the Image data-block is
held acquired.

The solution is to implement a simple user-counter for the render result.
Currently it is only used by the image's render result acquire/release API,
as it is the most important case for now. The render pipeline uses its own
way of protecting the result, for which the user counter is not needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/122231
2024-05-24 20:41:08 +02:00
Sergey Sharybin
30c1e11388 Fix tests on macOS after recent debug shadow changes
Clément says its all good!
2024-05-24 20:37:00 +02:00
Julian Eisel
717389887b Cleanup: Keep panel functions internal to UI code
These were added/exposed in aa03646a74.

There's no need to expose them in the public UI API, and they don't seem
like functions that should be used outside of the UI internals.
2024-05-24 20:29:37 +02:00
Sergey Sharybin
f4a7c42255 Fix crash in viewer node with quick toggle of frame in Compositor
The issue was caused by a non-initialized ibuf_ used to set the non-color
space to. For now limit the tweaks to the image data-block, which is always
ensured. This makes it consistent with the GPU compositor which does not
have access to ibuf at the moment when the meta-data is being checked.

Ideally we do need to set the color space, but it needs to happen consistently,
and in a thread-safe manner. The way how the CPU compositor releases the
ibuf right after acquisition does not feel safe, so less we rely on it is
better.
2024-05-24 19:26:50 +02:00
Clément Foucault
b96b87a75c EEVEE-Next: World: Add shadow options
This adds jitter option and filter option.
2024-05-24 18:41:18 +02:00
Clément Foucault
fb85ea535f Fix: EEVEE-Next: Broken sun soft shadows
The soft shadows were only getting blurred up to a radius
of 1 unit.
2024-05-24 18:41:18 +02:00
Clément Foucault
4c75babf03 EEVEE-Next: Shadow: Improve shadow tagging debugging
The tilemap debug mode now shows updates in the
viewport and cached pages in the bottom tilemaps.
2024-05-24 18:41:18 +02:00
Bastien Montagne
6426de4489 Core: IDManagement: Refactor how 'never unused' IDs are defined.
A few ID types are considered as 'never unused' in Blender (UI related
ones, the Libraries and the Scenes). Local IDs of this type are always
considered as used, even if no other ID links to them.

This was previously fairly weekly defined and implemented (mainly in the
writefile code and the 'tag unused' libquery functions).

This commit formalize this characteristic of ID types by adding a new
`IDTYPE_FLAGS_NEVER_UNUSED` flag, and using this in the few places in
the code that handle unused IDs.
2024-05-24 17:43:22 +02:00
Sergey Sharybin
1b18e07232 Fix #121480: Cryptomatte shows some objects as black
The issue originates to the change in default view transform from Filmic
to AgX, which does slightly different clipping, and clips color to black
if there is any negative values.

This change implements an idea of skipping view transform for viewer
node when it is connected to the Pick output of the cryptomatte node.
It actually goes a bit deeper than this and any operation can tag its
result as a non-color data, and the viewer node will respect that.
It is achieved by passing some extra meta-data along the evaluation
pipeline. For the CPU compositor it is done via MetaData, and for the
GPU compositor it is done as part of Result.

Connecting any other node in-between of viewer and Cryptomatte's Pick
will treat the result as color values, and apply color management.

Connecting Pick to the Composite output will also consider it as color,
since there is no concept of non-color-managed render result.

An alternative approaches were tested, including:

- Doing negative value clamping at the viewer node.
  It does not work for legacy cryptomatte node, as it needs to have
  access to original non-modified Pick result.

- Change the order of components, and store ID in another channel.

  Using one of other of Green or Blue channels might work for some view
  transforms, but it does not work for AgX.

  Using Alpha channel seemingly works better, but it is has different
  issues caused by the fact that display transform de-associates alpha,
  leading to over-exposed regions which are hard to see in the file from
  the report. And might lead to the similar issues as the initial report
  with other objects or view transforms.

- Use positive values in the Pick channel.

  It does make things visible, but they are all white due to the nature
  of how AgX works, making it not so useful as a result.

Pull Request: https://projects.blender.org/blender/blender/pulls/122177
2024-05-24 17:25:57 +02:00
Julian Eisel
ae7edf26ed UI: Remove Outliner element collapse chevron for empty scene elements
Scenes that have no children displayed (either because there was nothing
to display or because we didn't expand the sub-tree, such as in the
"Unused Data" display mode) would always have a chevron icon indicating
the collapsed state, but it wasn't interactive. As such it just felt
broken. This explicit exception to always draw the chevron for scene
elements was added a long time ago (13 years ago or longer), and I
couldn't find any good rationale for it.
2024-05-24 16:34:28 +02:00
Campbell Barton
97e017d89c Unbreak build from missing fmtlib reference on some systems 2024-05-25 00:32:23 +10:00
Julian Eisel
341281627d UI: Don't expand sub-trees in Outliner "Unused Data" display mode
For example scenes would make the entire collections & objects hierarchy
show up, even if these collections/objects are linked into other scenes.
So this was misleading, and from what I can tell not intentional, as a
comment in `TreeDisplayIDOrphans::build_tree()` indicates. Also
validated with Bastien.
2024-05-24 16:27:15 +02:00
Pratik Borhade
105463e28a GPv3: Change active node after selecting group in outliner
active element in properties panel is not updated after selecting group
from outliner. To fix this, remove the layer specific condition.
Also renamed the function for clarity.

Pull Request: https://projects.blender.org/blender/blender/pulls/121970
2024-05-24 16:22:56 +02:00
Falk David
fc2c078322 GPv3: Consider layer transform in radius_from_input_sample
The `radius_from_input_sample` function did not depend
on the layer transformation. This refactors the code a bit
and makes sure we use the right `to_world` matrix for the
transformation.
2024-05-24 16:01:34 +02:00
Clément Foucault
d15ce8dff5 Fix: EEVEE-Next: Displacement doesn't affect normal map node
While this might not always be the expected behavior,
this at least make it consistent with Cycles.

Fix #122184
Rel #122212
2024-05-24 15:35:51 +02:00
Jeroen Bakker
e5680542aa GPU: Fix GPUStateMutable size
Current size was to big (9X64 bits) when only (3X64 bits) were
needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/122214
2024-05-24 15:19:59 +02:00
Nathan Vegdahl
ec0a3e966c Refactor: Anim: make insert_key_rna() take RNAPath's instead of strings
This allows each path to optionally specify a single array index,
enabling `insert_key_rna()` to optionally insert keys for just a single
element of an array property. This will allow us to use it in more
places, and eventually reduce the total number of keying functions
needed in the code base.

PR #121879

Pull Request: https://projects.blender.org/blender/blender/pulls/121879
2024-05-24 15:06:21 +02:00
Nathan Vegdahl
8c9c88d70c RNA: add RNAPath type for conveniently storing and passing rna paths
This new type was initially motivated by a use case in the animation
code, where we want to pass RNA paths around as a string-index pair.
The final design was reached after discussion and review from Bastien
Montagne (mont29), with the aim of making the type generally useful for
many areas of Blender.

PR #121879
2024-05-24 15:06:19 +02:00
Bastien Montagne
b8a8a97440 RNA: ImageUser path: Add generic 'unresovled' for Screen-owned cases.
E.g. the Image editor can have such an ImageUser data. Ref. #122163.
2024-05-24 14:39:11 +02:00
Jason Fielder
81a1570cf5 EEVEE Next: Add imageStore/LoadFast ops to Raytrace passes
Add fast image writing and reading variants for RT passes.
These variants do not perform range checking on values
and should only be used in cases where the written texel is
guaranteed to be in range. This eliminates additional
branching and simplifies shader logic.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/121117
2024-05-24 12:51:21 +02:00
Jason Fielder
f20ad70c08 EEVEE Next: Add imageStore/LoadFast ops to Renderpasses
Add fast image writing and reading variants for render passes.
These variants do not perform range checking on values
and should only be used in cases where the written texel is
guaranteed to be in range. This eliminates additional
branching and simplifies shader logic.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/121116
2024-05-24 12:41:47 +02:00
Jeroen Bakker
94e2880dfb GPU: Fix use after free in draw tests
Pull Request: https://projects.blender.org/blender/blender/pulls/122201
2024-05-24 12:36:30 +02:00
Falk David
d960b922b3 Fix #122151: Undo crash in edit mode if active node is group
This was caused by 8d8d358196
(changed the active layer to be an active node)
which overlooked the undo code.

This makes sure we save the name of the active node
in each undo step and set the active node based on this
name when decoding a step.

Pull Request: https://projects.blender.org/blender/blender/pulls/122195
2024-05-24 11:39:42 +02:00
Iliya Katueshenock
788b34649e Nodes: improve tooltip for extend-sockets
Display descriptive tooltip for this socket function in any editor.
In case of geometry nodes, there is no point to display info about
lack of value, so cleanup this.

Pull Request: https://projects.blender.org/blender/blender/pulls/121798
2024-05-24 11:39:08 +02:00
Bastien Montagne
ef8fe6a4ab Fix #122189: Unused IDs with 'extra' usages not shown in Unused Outliner view.
The only ID usages that make it a 'used' ID are its own 'fake user'
flag, and normal refcounting usages from other IDs.

This was already the behavior of the Purge operation, but the Outliner
view would still hide IDs who were only used by shallow 'extra' usages
(typically the UI, e.g. the Image Editor).
2024-05-24 11:32:42 +02:00
Bastien Montagne
63e2124aa9 Core: ID usercount macros: Add ID_REFCOUNTING_USERS.
This new macro return the actual usercount due to refcounting normal
usages of the ID.

Also document all of these 'amount of users' ID macros.
2024-05-24 11:32:42 +02:00