Commit Graph

108948 Commits

Author SHA1 Message Date
Clément Foucault
e401d996aa Fix: EEVEE-Next: Wrong LOD tagging for punctual shadow maps
The root issue is that `shadow_punctual_footprint_ratio` was not
fed with Z distance but by radial distances to camera and
light.

This commit cleans up this computation by only precomputing the
film pixel radius on CPU. This allow the LOD computation to be
more local and easier to read.

Fix #119725

Pull Request: https://projects.blender.org/blender/blender/pulls/121167
2024-04-29 15:19:49 +02:00
Bastien Montagne
9041eef0b8 Cleanup: Remove unused variable. 2024-04-29 14:49:50 +02:00
Bartosz Kosiorek
d655e63044 UI: Add tooltips with description of compositing nodes
As already existed for shader and geometry nodes.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/121038
2024-04-29 14:48:43 +02:00
Hans Goudey
205683477f Fix #121209: Menu switch missing matrix socket 2024-04-29 08:36:25 -04:00
Omar Emara
0eacf3cfef Cleanup: Clarify variable names in Fast Gaussian 2024-04-29 15:15:37 +03:00
Sean Kim
55fc1066ac Sculpt: Polyline hide operator
This PR adds a polyline hide operator for sculpt mode as well as the
necessary generic callback code to allow using this gesture in other
selection tools.

Added features include:
* *Polyline Hide* operator
* `WM_gesture_polyline_*` callback functions for other operators
* Status bar text while using the polyline modal
* Common *Gesture Polyline* keymap for usage with the modal

Unlike the *Box Hide* and *Lasso Hide* operators, the *Polyline Hide*
operator does not provide a simple shortcut to click and show all
hidden elements in a mesh. This is because the existing operators
operate on a click-drag action while the new operator is invoked by
just a click.

Design Task: #119353

Pull Request: https://projects.blender.org/blender/blender/pulls/119483
2024-04-29 14:04:16 +02:00
Omar Emara
3d2a2a9bd2 Cleanup: Remove unused FastGaussianBlurValueOperation 2024-04-29 14:52:18 +03:00
Pratik Borhade
69ae834ce8 Cleanup: Use existing function to check region-space types
Use existing function `screen_animation_region_supports_time_follow` in
`areas_do_frame_follow` to check region-space types in case of: follow current
frame is enabled and playback is moved with arrow keys

Noticed this while checking #110620

Pull Request: https://projects.blender.org/blender/blender/pulls/120056
2024-04-29 13:26:22 +02:00
Brecht Van Lommel
d174d63866 Cleanup: make format 2024-04-29 12:43:09 +02:00
David Murmann
ee51f643b0 Cycles: Ray Portal BSDF
Transport rays that enter to another location in the scene, with
specified ray position and normal. This may be used to render portals
for visual effects, and other production rendering tricks.

This acts much like a Transparent BSDF. Render passes are passed
through, and this is affected by light path max transparent bounces.

Pull Request: https://projects.blender.org/blender/blender/pulls/114386
2024-04-29 12:37:51 +02:00
Bastien Montagne
12f0f56350 Fix clang warning: a class with a final destructor should also be final. 2024-04-29 12:20:10 +02:00
Philipp Oeser
7d70942a84 Fix #121201: Crash using scroll wheel in Movie clip editor
Crash could could happen if `Clip Display` > `Render Undistorted` was
enabled on a clip, but the clip then unlinked (code was accessing the
clips `MovieTracking` for garbage memory then).

To resolve, just check the clip prior.

NOTE: there are similar other checks (e.g. in `spline_under_mouse_get`)
that actually check the clip prior.

Pull Request: https://projects.blender.org/blender/blender/pulls/121203
2024-04-29 11:32:29 +02:00
Alaska
f8c0050a25 Shaders: Add Roughness to Subsurface Scattering Node
Matching the Principled BSDF.

Pull Request: https://projects.blender.org/blender/blender/pulls/114499
2024-04-29 10:54:29 +02:00
Lukas Tönne
f6f8006b90 GPv3: Fix initial selection mask of the grab sculpt tool
The initial mouse sample has a pressure of zero, which excludes all
points from the selection when the grab tool starts. Use a pressure of
1 to ensure all points are included.

Pull Request: https://projects.blender.org/blender/blender/pulls/121183
2024-04-29 10:46:09 +02:00
Hans Goudey
65803f262f Node Tools: Basic support for data-block inputs
Currently support for data-block inputs is disabled because pointer
properties in operator properties aren't properly handled in Blender
(for more info, see 871c717c6e). This commit brings basic
support for them by storing strings (data-block names) in the operator
properties instead. The main downside of using strings compared other
theoretical solutions is that data-blocks from different library files
can have the same name. This solution won't work well for those cases.
However, it still brings a lot of utility to node tools for a relatively
simple code change.

I investigated two other solutions for this that didn't work out. Using
the recently added enum custom property support didn't work because
the data-block names would still have to be unique. Plus generating an
enum would require a bunch of boilerplate code. Extending the existing
button search code to handle integer session UID backed data-blocks was
much trickier than I expected. The code there is already quite spagetti-
like, and things got out of hand quickly. That's still valid future work
though. The implementation can be changed without breaking
compatibility of files.

Pull Request: https://projects.blender.org/blender/blender/pulls/121148
2024-04-29 03:47:33 +02:00
Campbell Barton
4ec93f73a5 Cleanup: spelling in comments 2024-04-29 09:09:44 +10:00
Campbell Barton
c9dba4d31f Cleanup: use const variables & argument, remove duplicate include 2024-04-29 09:09:44 +10:00
Bastien Montagne
e5a921ad9b Fix #120103: Copy/Paste of nodes is not handling ID references properly.
This commit fixes several critical issues with previous code:
* It only covered a (very small) subset of potential ID references in a
  node (namely, just the `bNode::id` pointer).
* It completely ignored linked data case.
* It would modify ID pointers in the clipboard itself.

The new code stores ID reference info in a separate mapping. It uses the
new 'sub-data' foreach_id feature from `BKE_lib_query` to reliably and
generically process all ID pointers of a node.

The paste handling of ID pointers is split in two steps:
* All knowns ID references are searched for in current Main data-base,
  and the result (current valid ID pointer or null if not found) is
  stored temporarily in the ID references mapping.
* Once a node has been duplicated from the clipboard into the paste
  destination nodetree, its ID pointers are updated accordingly.

This allows to keep the 'reference ID' data in the clipboard always
valid, regardless of which IDs are currently existing in Main (i.e. to
keep all available data, even when opening new blendfiles, or doing
undo/redo that would affect the existing IDs).

Pull Request: https://projects.blender.org/blender/blender/pulls/121122
2024-04-28 18:59:42 +02:00
Bastien Montagne
f933dae207 BKE_lib_query: Add a partial ID usage iterator system.
The idea is to allow iterating over e.g. all ID usages of a node from a
whole nodetree, using the same generic handling as existing 'whole ID'
`foreach_id` code.

This is necessary in some cases wher a sub-data needs to processed
independently from any 'owner ID', e.g. in some copy/paste handling.

This is a pre-requirement for proper fix of nodes copy/paste (see
e.g. #120103).

Pull Request: https://projects.blender.org/blender/blender/pulls/121018
2024-04-28 17:35:02 +02:00
Philipp Oeser
0bf4568abd revert 4d49c78e74
revert Fix: weight and vertex paint radial symmetry wrong with mirror

Was causing #121155, will check again on Monday

Both vertexpaint and weightpaint would only apply all of radial symmetry
for the "initial stroke".
When going over the combinations of symmetry axis, some of radial
symmetry would be skipped, e.g. when mirroring from right to left with
`Mirror X` turned ON, a dab on the right would have radial symmetry from
that point, and an additional dab on the left from mirroring (but the
mirrored dab would not have radial symmetry on its own).

This does not lead to symmetric results at all, sculptmode also does not
behave that way (there, radial symmetry is performed on the mirror axis
as well).

Now do the same thing as in sculptmode to get symmetric results when
using mirror and radial symmetry together.
Also use the utility function to skip invalid symmetry iterations.

Stumbled over this when looking into #120843

Pull Request: https://projects.blender.org/blender/blender/pulls/120931
2024-04-28 11:36:56 +02:00
Richard Antalik
fd96b81821 Fix #120834: Retiming does not work as expected.
This happened, because of lazy initialization of clicked retiming keys.
When the key is moved, the speed changed in respect to strip start, not
(uninitialized, but drawn) key at left handle.

Initialize both keys when any virtual key is selected.
2024-04-28 03:41:52 +02:00
Jesse Yurkovich
4987ef010c Cleanup: STL: Address the ODR violation and tidy up processing
Remove the one-definition-rule violation due to two `Triangle` types
being used inside the same `blender::io::stl` namespace. Make a small
set of non-functional changes in the surrounding code along the way to
use `const` in more places.

STL had 4(!!) triangle types:
- A `class Triangle` : Used for import, contains indices
- A `struct Triangle` : Used for export, contains verts/normals, the ODR
  violation
- A `struct ExportBinaryTriangle` : Used for export but is really the
  same as the above type
- A `struct STLBinaryTriangle` : Used for import but was a duplicate
  of the above type

Now STL has just 2. The `class Triangle` containing indices during
import and a `struct PackedTriangle` containing the verts/normals for
everything else. The duplicated `BINARY_HEADER_SIZE` constant is now
common as well.

Performance remains the same for both import/export and ascii/binary.

Pull Request: https://projects.blender.org/blender/blender/pulls/121179
2024-04-28 03:06:39 +02:00
Jacques Lucke
ab1da26e75 Fix: incorrect error message in Object Info node in tool context 2024-04-28 00:38:01 +02:00
Jacques Lucke
71ba360ddc Cleanup: use Map for operator types
This simplifies the code, makes it more type safe and also makes it
easier to use the construct-on-first-use-idiom.

Pull Request: https://projects.blender.org/blender/blender/pulls/121170
2024-04-27 21:44:55 +02:00
Clément Foucault
f48becc7d0 EEVEE-Next: UI: Rename raytraced refraction to raytrace transmission
This is a more general term that englobes all transmissive
BSDFs.
2024-04-27 21:00:04 +02:00
Clément Foucault
bb44bce95c EEVEE-Next: Improve shadow bias
The goal of this PR is to remove any user facing parameter
bias that fixes issues that are caused by inherent nature of
the shadow map (aliasing or discretization).

Compute shadow bias in the normal direction to avoid
both shadow leaking at certain angles or shadow
acnee.

This bias is computed automatically based on the minimum
bias amount required to remove all errors. The render
setting is removed as of no use for now.

#### Normal bias
We do the bias in world space instead of shadow space
for speed and simplicity. This requires us to bias using
the upper bound of biases for the same location in space
(using biggest texel world radius instead of UVZ bias).
This isn't much of an issue since the bias is still less
than 2 texel. The bias is still modulated by facing
ratio to the light so surfaces facing the light have no
biase.

This fixes both self shadowing and flat occluders aliasing
artifacts at the cost of moving the shadow a bit on the
side. This is the blue arrow in the diagram.

We always bias toward the normal direction instead of the
light direction. This is alike Cycles geometric offset for
the shadow terminator fix. This is better since it does'nt
modify the shading at all.

#### Slope bias
To avoid aliasing issue on zero slope receiver, we still
have to use the slope bias with a size of 1 pixel.

#### PCF filtering
We now parametrize the filter around the normal instead of
using the shadow map local space. This requires to use
a disk filter instead of box, which is also more pleasant
for most light shapes (all except rectangle lights).

Setting the filter around normal avoid overshadowing from
zero slope occluders. This cannot be fixed by more slope bias
in light space PCF. We could fix it in light space by projecting
onto the normal plane but that gives an unbounded bias when `N.L`
is near 0 which causes either missing shadows or self shadow if
using an arbitrary max offset value.

To avoid overshadowing from any surface behind the shading
point, we reflect the offset to always face the light.
Doing so instead of using the perpendicular direction
is better for very sharp geometric angles, has less
numerical precision issue, is symetrical and is cheaper.

To avoid any self shadowing artifact on zero slope receivers
with angled neighbors (like a wall and the floor), we have
to increase the slope bias according to the filter size.
This might be overkill in most situation but I don't feel
this should become a setting and should be kept in sync
with the filter. If it has to become an option, it should
simply a factor between unbiased filter and best bias.

#### Shadow terminator

The remaining artifacts are all related to shadow terminator
one way or another. It is always caused by the shading
normal we use for biasing and visibility computation not
being aligned with the geometric normal.

This is still something we need a setting for somewhere.

Pull Request: https://projects.blender.org/blender/blender/pulls/121088
2024-04-27 14:30:52 +02:00
Campbell Barton
c0def6c93d Cleanup: spelling in comments 2024-04-27 11:58:02 +10:00
Clément Foucault
d11c6962b0 EEVEE-Next: Fix decrepancy in shadow rendering on mac M1
The difference was that the depth slope bias was not
written to the depth buffer which could lead to situation
where the value written to the color target was greater
than it should.

Use the depth write feature to output the slope biased
depth. Output 1 depth to not discard and loose the benefit
of early depth test.
2024-04-26 23:19:57 +02:00
Harley Acheson
7e2075b809 UI: Changes to Zoom Menus
For Image, Clip, Sequence editors, try to make their View menus a bit
more consistent. Changes to Zoom menus, including showing current level
if matching.

Pull Request: https://projects.blender.org/blender/blender/pulls/121044
2024-04-26 21:35:49 +02:00
Clément Foucault
afe13df0b5 EEVEE-Next: UI: Change default filtering radius to 1px
The resonning is that we expect the default to be close
to realistic rendering. The filtering is only here to
hide aliasing in this case and shouldn't do more
blurring. This is specially disturbing when rendering at
low resolution since the filter is resolution dependant.

Older files are also expecting to use a 1px filter
for compatibility.
2024-04-26 21:14:24 +02:00
Hans Goudey
ce224fe401 Node Tools: Add mouse position node, wait for cursor option
Add a "Mouse Position" node that outputs the location of the mouse
cursor in region space and the overall size of the region, both in pixel
units. Both outputs are integers to help reflect their pixel units.
If there the mouse position is ever accessible in sub-pixels, they can
easily be changed to floats.

Also add a "Wait for Cursor" option similar to the one for some built-in
operators that delay's the operator's execution until there is a mouse
click in the viewport. That way the operator can be called from menus
even though it is interactive. This option is placed in the node editor
header. When there are more options, it will be part of an "Options"
popover panel similar to the existing "Modes" and "types" popovers.

Combined with the viewport transform node, and other nodes like Raycast,
these features can allow making tools that create geometry where you
click in the scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/121043
2024-04-26 20:14:25 +02:00
Harley Acheson
aa65bdbebc Fix #121108: Improved Poll Function for IMAGE_OT_clipboard_paste
Ensure that the current area is an Image Editor before allowing
clipboard paste, since that will fail.

Pull Request: https://projects.blender.org/blender/blender/pulls/121142
2024-04-26 19:57:48 +02:00
Hans Goudey
83ed92d533 Geometry Nodes: Add Viewport Transform node
Add a node that outputs the transform of the viewport relative to the
self object's transform. This node can be used to build effects like
billboarding or aligning geometry to the current view. In combination
with the mouse position node in the future it will allow tools like
generating geometry at the mouse click position.

There are two output matrices. The first is the projection matrix
that takes positions in camera space and applies the final perspective
projection. The other is the "view" matrix which contains the location
and rotation of the camera. These are separate because though their
combination is useful, it isn't used like a typical rotation/transform matrix.

Pull Request: https://projects.blender.org/blender/blender/pulls/118680
2024-04-26 19:47:19 +02:00
Hans Goudey
33367b7d0c Fix: Assert in USD curves reader offset creation
The current code read past the end of `usdCounts`.
2024-04-26 13:42:53 -04:00
Alaska
afa66fc628 Shader: Clamp invalid inputs of various BSDF nodes
Clamp some of the inputs of the Glossy BSDF, Glass BSDF, Sheen BSDF,
and Subsurface Scattering nodes to improve consistency between render
engines and to avoid unexpected results.

* Clamp roughness to 0..1
* Clamp subsurface radius to 0..inf
* Clamp colors to 0..inf

Pull Request: https://projects.blender.org/blender/blender/pulls/120390
2024-04-26 17:39:39 +02:00
Hans Goudey
e3894f0a07 UV: Remove UV sculpt use of brushes
For the brush assets project (#116337) all editors with brushes are
getting an asset shelf, and the brush tools are combined, with
individual brushes accessed in the shelf. That design seems way
overkill for UV sculpting which is just three very simple tools.

In order to avoid one editor with inconsistent use of brushes, which
would significantly increase the complexity of the system after the
brush assets merge, port the three UV sculpt tools to be regular
modal operators that don't use the brush or paint system at all.

To be clear, this is a compromise that doesn't feel ideal, but no
one could think of a better solution. Theoretically this removes
some flexibility from UV edit "sculpting", in practice it probably
won't be a noticeable change.

Pull Request: https://projects.blender.org/blender/blender/pulls/120797
2024-04-26 17:10:04 +02:00
Guillermo Venegas
615100acda IO: Use FileHandler in Node Editors
Use `FileHandlers` to handle file drag-n-drop in Node Editors. Drop-boxes
still remain since they handle Images ID drag-n-drop.

This also allows to open/drag-n-drop multiple files at once.

Also this will allow add-ons to also support drag-n-drop for images and
movies in node editors while still providing access to Blender's native
support since File Handlers let users choose which to invoke if there's
multiple configured.

Pull Request: https://projects.blender.org/blender/blender/pulls/121051
2024-04-26 16:40:16 +02:00
Bartosz Kosiorek
749433f20b UI: Add tooltips with node description to node titles
These were already displayed in the node add menu. But it can also be
useful to see node descriptions when opening existing projects.

Pull Request: https://projects.blender.org/blender/blender/pulls/119705
2024-04-26 16:29:46 +02:00
Falk David
c87e8790bb Fix: GPv3: Redraw editors showing grease pencil keys when new on is added
When e.g. using auto-key to draw on a new frame, the dopesheet
(and other editors) would not redraw to show the newly added keyframe.

This fix makes sure we send notifiers to those editors when a
keyframe is added.
2024-04-26 15:43:51 +02:00
Falk David
62151ffaeb Fix: GPv3: Thickness modifier conversion of "uniform thickness"
The "uniform thickness" was still in the legacy "pixel" space. The fix
makes sure that value is always converted to the right radius space.
We also convert the potentially animated property for the thickness
and scale the fcurves to be in the right space.

Pull Request: https://projects.blender.org/blender/blender/pulls/121128
2024-04-26 15:16:43 +02:00
Jeroen Bakker
7e3aa5a7a9 Vulkan: Add to_string functions for dynamic rendering
The plan is to use dynamic rendering. This PR adds to_string functions
for enums, structs related to dynamic rendering.
2024-04-26 14:55:50 +02:00
Jeroen Bakker
54d879fd24 Cleanup: Use GTest macros
Vulkan render graph test cases used BLI asserts. These
are now replaced with GTEST macros
2024-04-26 14:55:50 +02:00
Falk David
c0fc1fc938 Cleanup: GPv3: Remove wrap/unwrap macros for lineart 2024-04-26 14:49:54 +02:00
Christoph Lendenfeld
8b852f2ac2 Refactor: rename beztmap_to_data
No functional changes.

This just renames the function `beztmap_to_data` to
`update_transdata_bezt_pointers` to better represent what it is doing.

Pull Request: https://projects.blender.org/blender/blender/pulls/121125
2024-04-26 14:06:42 +02:00
Campbell Barton
d644873252 Preferences: add option to set the trackpad direction for Wayland
When using a version of Wayland that doesn't support trackpad direction
show an option to set the direction manually.

While this is a stop-gap measure until compositors support seat
version 9, the latest GNOME doesn't yet support this, so there will
be users for some years without this functionality.

Addresses issue raised in #107676.
2024-04-26 21:26:49 +10:00
Campbell Barton
95315e34bf PyAPI: add private API to access WM capabilities
Add _bpy._wm_capabilities(), needed for preferences code to check if
WM functionality is supported. This could be made into a public
function, see code comments for details.
2024-04-26 21:26:49 +10:00
Campbell Barton
c444f128d3 WM: add a capability flag for physical trackpad direction
Support detecting if the trackpad direction flag is propertly set
(currently unused).

Needed so Wayland compositors that don't support seat-version 9 or
newer (GNOME-46 & KDE5 for e.g) can have a working trackpad.

Eventually this option will be removed when the functionality is
widely supported.
2024-04-26 21:26:49 +10:00
Campbell Barton
954dc21581 WM: correct the last flag of ENUM_OPERATORS for eWM_CapabilitiesFlag 2024-04-26 21:26:49 +10:00
Christoph Lendenfeld
0dd0583a75 Refactor: move get_keyframing_flags function to animrig
No functional changes.

This PR moves the `ANIM_get_keyframing_flags` function to
animrig as `get_keyframing_flags`.
The docstring has been fixed since it was out of date.

Pull Request: https://projects.blender.org/blender/blender/pulls/121120
2024-04-26 13:21:55 +02:00
Clément Foucault
4d10bbe733 Fix: EEVEE-Next: Missing smoke volumes
Caused by mistake in b8e17cf531.
2024-04-26 13:13:27 +02:00