Commit Graph

109061 Commits

Author SHA1 Message Date
Campbell Barton
f15646df59 Fix failure to draw onto a surface with GPv3
GP_PROJECT_DEPTH_VIEW never used a surface depth and would
always use object-origin instead.
2024-05-02 22:34:43 +10:00
Lukas Stockner
17f2cdd104 Cycles: Add thin film iridescence to Principled BSDF
This is an implementation of thin film iridescence in the Principled BSDF based on "A Practical Extension to Microfacet Theory for the Modeling of Varying Iridescence".

There are still several open topics that are left for future work:
- Currently, the thin film only affects dielectric Fresnel, not metallic. Properly specifying thin films on metals requires a proper conductive Fresnel term with complex IOR inputs, any attempt of trying to hack it into the F82 model we currently use for the Principled BSDF is fundamentally flawed. In the future, we'll add a node for proper conductive Fresnel, including thin films.
- The F0/F90 control is not very elegantly implemented right now. It fundamentally works, but enabling thin film while using a Specular Tint causes a jump in appearance since the models integrate it differently. Then again, thin film interference is a physical effect, so of course a non-physical tweak doesn't play nicely with it.
- The white point handling is currently quite crude. In short: The code computes XYZ values of the reflectance spectrum, but we'd need the XYZ values of the product of the reflectance spectrum and the neutral illuminant of the working color space. Currently, this is addressed by just dividing by the XYZ values of the illuminant, but it would be better to do a proper chromatic adaptation transform or to use the proper reference curves for the working space instead of the XYZ curves from the paper.

Pull Request: https://projects.blender.org/blender/blender/pulls/118477
2024-05-02 14:28:44 +02:00
YimingWu
e8d028b7a5 Fix #121338: Depthdropper ensure viewport camera
Depthdropper should ensure that the viewport is in camera view to use
active camera position, otherwise it should still use rv3d->viewinv[3]
to ensure correct distance result.

Pull Request: https://projects.blender.org/blender/blender/pulls/121339
2024-05-02 13:24:22 +02:00
Amelie Fondevilla
725408e842 GPv3: Extrude operator
Implementation of the extrude operator for Grease Pencil v3.
If an endpoint is selected, the extrusion will extend the stroke.
If an inner point is selected, the extrusion will create a new stroke tied to the one that is selected.

Change of behavior from gpv2: the endpoints of a cyclic curve follow the same behavior as inner points.

Pull Request: https://projects.blender.org/blender/blender/pulls/121249
2024-05-02 12:51:30 +02:00
Christoph Lendenfeld
5b7a0ed1b5 Refactor: move keyingset enums to animrig
No functional changes expected.

This PR moves the enums
`eModifyKey_Modes` and `eModifyKey_Returns` to animrig
as enum classes.

Functions that take or return that value were also modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/121132
2024-05-02 12:00:37 +02:00
Campbell Barton
530999fb76 Cleanup: add missing SPDX-FileCopyrightText 2024-05-02 16:46:26 +10:00
Campbell Barton
f6b7464b4c Cleanup: spelling in comments 2024-05-02 16:44:10 +10:00
Campbell Barton
41c43c9e87 Cleanup: use const pointers 2024-05-02 16:11:03 +10:00
Campbell Barton
523d84db85 Fix incorrect XDG_CURRENT_DESKTOP check
The string was checked for equality when the spec allows for `:`
delimiter characters.
2024-05-02 10:20:58 +10:00
Campbell Barton
594ee2c766 BLI_string: add BLI_string_elem_split_by_delim
Add a utility function to check if one string contains another
when split by a delimiter.
2024-05-02 10:20:56 +10:00
Jacques Lucke
5bc949b4a7 Fix: avoid tagging file as modified when clicking in node editor 2024-05-02 01:43:45 +02:00
Jacques Lucke
6cb9b7299d Fix: sample grid node uses wrong enum for data type
The used enum used the term "Value" instead of "Float".
Also the default value was wrong.
2024-05-01 23:29:56 +02:00
Jacques Lucke
ebd2762239 Fix: crash when applying geometry nodes with bake node 2024-05-01 23:11:58 +02:00
Iliya Katueshenock
831e91c357 Geometry Nodes: support working with raw matrix values
These nodes allow working with the raw values that make up a matrix.
This can be used to construct a 4x4 matrix directly, without using the
`Combine Transform` node. This allows building transforms with arbitrary
skew, or projection matrices.

Pull Request: https://projects.blender.org/blender/blender/pulls/121283
2024-05-01 21:31:08 +02:00
Jacques Lucke
17cc5d694c Fix #121214: invalid owner_tree pointer when node tree is overridden 2024-05-01 21:29:04 +02:00
Aras Pranckevicius
877558858b Cleanup: Remove unused BLF matrix functionality
It was added back in 2010 (b25c32393d), but looks like nothing
whatsoever uses it by now. It is not exposed to Python either.

Pull Request: https://projects.blender.org/blender/blender/pulls/121207
2024-05-01 20:59:10 +02:00
Hans Goudey
4dbdd925d4 Assets: Add equality operators to AssetWeakReference 2024-05-01 13:24:39 -04:00
Hans Goudey
9c1fe82e06 UI: Enable "apply" handler for preview tile buttons
For example, allow calling an operator when clicking on a
preview tile button. Useful for brush assets where clicking
on an asset shelf item activates the brush.
2024-05-01 13:17:44 -04:00
Hans Goudey
b7a959061d Asset Shelf: Expose two functions publicly
Unused for now. Will be used by brush assets.
2024-05-01 13:11:56 -04:00
Hans Goudey
c2d1e2f1c8 Cleanup: Remove redundancy in a couple asset shelf function names
The "asset_shelf_" prefix is redundant with the namespace.
2024-05-01 13:11:55 -04:00
Hans Goudey
fb8f0311bd Assets: Expose function to find asset from a weak reference
Unused for now, will be used by brush assets operators.
2024-05-01 13:11:55 -04:00
Hans Goudey
14e8d0d9aa UI: Use "label tooltip" as a fallback for quick favorites menu text
Useful when the button has no display text but has been set up
to have a quickly accessible tooltip in its place (for example
a brush asset item in the asset shelf).
2024-05-01 13:11:55 -04:00
Hans Goudey
09c0dec2a3 UI: Adjust gesture operator descriptions to avoid second person
Use the imperative tense as described by the HIG.

Pull Request: https://projects.blender.org/blender/blender/pulls/121309
2024-05-01 19:01:28 +02:00
Hans Goudey
d4981e0de3 Cleanup: Tweak naming in file forwardcompat dialog
Make the function naming more generic so extending it in the future
(with asset blend file information for example) won't have to adjust
the function names to correct the semantics itself.
2024-05-01 12:26:58 -04:00
Hans Goudey
a3f87ceb35 Cleanup: Correct comment in keymap operator name guessing
PAINT_OT operators are not skipped here.
2024-05-01 12:26:58 -04:00
Miguel Pozo
67d292c0e9 Fix: EEVEE-Next: Never tag default materials as GPU_MAT_USE_DEFAULT
Fix issue from a8f8745dcb
2024-05-01 18:03:36 +02:00
Hans Goudey
c9625cbc7b Brush: Rename BKE_paint_toolslots_brush_validate function
Change from the brush assets branch. Arguably the funciton name
is just as clear this way anyway.
2024-05-01 11:49:48 -04:00
Hans Goudey
c549c1b29c Brush: Add Main argument to BKE_paint_ensure
This is used by the brush assets branch. Though it is unused currently, the
argument is added now to reduce the trivial boilerplate changes in the diff.
2024-05-01 11:49:48 -04:00
Hans Goudey
722ad638c5 UI: Add optional icon argument to search visit params
Allows adding an icon to some search items, similar to what is done
manually for property search. Used for asset catalog search in the
brush assets branch, but more widely useful too.
2024-05-01 11:49:48 -04:00
Clément Foucault
9ff39b5fe9 Cleanup: EEVEE-Next: Fix warning and naming style 2024-05-01 17:45:15 +02:00
Harley Acheson
529b8786f8 UI: Custom Text and Confirmation Button Text for Props Confirm
For operators that use WM_operator_props_popup_confirm allow custom
title and confirmation button text.

Pull Request: https://projects.blender.org/blender/blender/pulls/121287
2024-05-01 16:29:19 +02:00
Clément Foucault
ab30784076 EEVEE-Next: Implement spherical harmonic deringing
This avoids negative color darkening caused by strong
directionnal lighting.

However, this reduce the contrast a lot since the
deringing is done on the unclampped spherical harmonics
which is itself extracted from unclamped values from
the world.

The solution to this is to add the parameter for
clamping the world light. This setting will be
reused for #68478.

Fix #116036

Pull Request: https://projects.blender.org/blender/blender/pulls/121303
2024-05-01 16:18:51 +02:00
Clément Foucault
3f1dbf2843 Fix: EEVEE-Next: Thickness versionning affecting startup.blend
This limits the thickness node addition to material using
screen space refraction.
2024-05-01 16:18:35 +02:00
Nathan Vegdahl
3b3364faf9 Fix: add missing depsgraph tag for anim Strip keyframe Python API
This caused a weird situation where after keys were inserted, the
animation of the affected object(s) wouldn't actually change in
the 3D viewport (even with scrubbing) until the keys were touched
in one of the animation editors.

Pull Request: https://projects.blender.org/blender/blender/pulls/121302
2024-05-01 16:08:20 +02:00
Iliya Katueshenock
5fa98aa0fd Cleanup: Camel case for node size enum items
Pull Request: https://projects.blender.org/blender/blender/pulls/121297
2024-05-01 15:27:34 +02:00
Pratik Borhade
a42e2a5a29 GPv3: Mask toggle in dopesheet channel
Add `use_mask` property in dopesheet layer channel.
Also add an icon to the `use_mask` property.

Pull Request: https://projects.blender.org/blender/blender/pulls/121259
2024-05-01 15:10:22 +02:00
Laurynas Duburas
d7b72b4979 Fix: Missing topology update setting curves handle type
If both segment handles are `Vector`, changing their type only changes
handle behavior, but doesn't add curvature to the segment. For `Vector`
segments only one step is designated in the evaluated offsets cache,
so  `all_bezier_offsets` has to be recalculated. As an optimization,
it would be possible to track if there was any `Vector` handle and
rebuild topology only when it is needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/121292
2024-05-01 14:48:52 +02:00
Pratik Borhade
3c336c82cc Fix #121248: Crash executing node tool operator without active node
Calling `NODE_OT_select_same_type_step` when no node is active triggers
the crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/121252
2024-05-01 14:48:12 +02:00
Clément Foucault
ff15d31bc1 EEVEE-Next: Forgot version bump
Sorry.
2024-05-01 14:47:18 +02:00
Clément Foucault
826d2ed4ec EEVEE-Next: Move shadow resolution scale to the sampling panel 2024-05-01 14:45:51 +02:00
Clément Foucault
b4be13ad8a EEVEE-Next: Clamp shadow_resolution_scale to 1
Scaling up the resolution is currently ill defined for
sun shadows. This might be reintroduced when #121293 lands.
Fix #121196
2024-05-01 14:44:30 +02:00
Habib Gahbiche
483c854612 Compositor: implement interpolation methods for Translate node
Compositor: Expose interpolation methods Nearest, Bilinear and Bicubic to the user for translate node

This is part of #119592.

Pull Request: https://projects.blender.org/blender/blender/pulls/119603
2024-05-01 14:44:01 +02:00
Hans Goudey
e63c8bb3c2 UI: Add Modifiers submenu to 3D view header
Add a menu similar to the "Object > Constraints" menu that allows adding,
copying, and clearing modifiers. The "copy all modifiers to selected" and
"clear modifiers" operators are new, to mirror the functionality we already
have for constraints.

The "Add" menu is the same that's used in the property editor. In the 3D
view, modifiers are always added to all selected objects.

Part of #120230

Pull Request: https://projects.blender.org/blender/blender/pulls/121286
2024-05-01 14:15:53 +02:00
Sean Kim
d4a61647bf Sculpt: Add Line Trim tool
This PR adds the *Line Trim* tool to Sculpt mode. It is exposed via
the toolbar along with the other *Trim* tools and as an entry in the
*Sculpt* menu.

## Technical Approach
Line gestures are represented as two points in screen space: the `start`
and `end` of the gesture. Trim tools work by taking a set of screen
points as the top face of a volume, projecting a copy of the face into
the scene, then using that as the operand shape for boolean operations.
To behave as users would expect, the *Line Trim* tool does the following
steps to make the initial face:
1. Take the sculpted object's bounding box.
2. Project the bounding box into screen space
3. Take the magnitude of the diagonal line made from the bounding box
4. Use the magnitude multiplied by an arbitrary factor to ensure the
   initial line is long enough to fully divide the object.
5. Create two points by moving in a perpendicular direction from start
   and end points.
6. Use the resulting four points as vertices of the quad in screen space.

## Differences with Other Trim Tools
* Line Trim **only** supports the **Difference** mode. As such, the
corresponding tool options have been disabled in the header.

## Alternatives
* Instead of using a boolean operation, this could be achieved by using
a bisect operation when using the *Fixed* projection mode. While this
may result in a better performing tool, it is not guaranteed and
requires extra work to integrate this approach.

Pull Request: https://projects.blender.org/blender/blender/pulls/120845
2024-05-01 14:10:26 +02:00
Omar Emara
5bc8dd7d3b Cleanup: Make format 2024-05-01 15:03:14 +03:00
Omar Emara
74300f88a0 Cleanup: Missing include in recursive blur algorithm 2024-05-01 12:08:08 +03:00
Boltzmachine
c727bf3f76 Fix #120680: add node tree update operation after adding new views
The Switch View node cannot be automatically updated when new views are added.
This is because there is no tree update operation after adding new views. This
patch simply fix it by tag the node tree and update it.

Pull Request: https://projects.blender.org/blender/blender/pulls/120685
2024-05-01 10:24:03 +02:00
Omar Emara
382131fef2 Realtime Compositor: Implement Fast Gaussian blur
This patch implements the Fast Gaussian blur mode for the Realtime
Compositor. This is a faster but less accurate implementation of
Gaussian blur.

This is implemented as a recursive Gaussian blur algorithm based on the
general method outlined in the following paper:

 Hale, Dave. "Recursive gaussian filters." CWP-546 (2006).

In particular, based on the table in Section 5 Conclusion, for very low
radius blur, we use a direct separable Gaussian convolution. For medium
blur radius, we use the fourth order IIR Deriche filter based on the
following paper:

  Deriche, Rachid. Recursively implementating the Gaussian and its
  derivatives. Diss. INRIA, 1993.

For high radius blur, we use the fourth order IIR Van Vliet filter based
on the following paper:

  Van Vliet, Lucas J., Ian T. Young, and Piet W. Verbeek. "Recursive
  Gaussian derivative filters." Proceedings. Fourteenth International
  Conference on Pattern Recognition (Cat. No. 98EX170). Vol. 1. IEEE,
  1998.

That's because direct convolution is faster and more accurate for very
low radius, while the Deriche filter is more accurate for medium blur
radius, while Van Vliet is more accurate for high blur radius. The
criteria suggested by the paper is a sigma value threshold of 3 and 32
for the Deriche and Van Vliet filters respectively, which we apply on
the larger of the two dimensions.

Both the Deriche and Van Vliet filters are numerically unstable for high
blur radius. So we decompose the Van Vliet filter into a parallel bank
of smaller second order filters based on the method of partial fractions
discussed in the book:

  Oppenheim, Alan V. Discrete-time signal processing. Pearson Education
  India, 1999.

We leave the Deriche filter as is since it is only used for low radii
anyways.

Compared to the CPU implementation, this implementation is more
accurate, but less numerically stable, since CPU uses doubles, which is
not feasible for the GPU.

The only change of behavior between CPU and this implementation is that
this implementation uses the same radius, so Fast Gaussian will match
normal Gaussian, while the CPU implementation has a radius that is 1.5x
the size of normal Gaussian. A patch to change the CPU behavior #121211.

Pull Request: https://projects.blender.org/blender/blender/pulls/120431
2024-05-01 09:57:30 +02:00
Lukas Tönne
6c1bf7fc94 GPv3: Fix initialization of the DrawingPlacement struct from tool settings
The `DrawingPlacement` utility struct is initialized based on various
tool settings, including the `gpencil_v3d_align` flag. This flag was
used in a switch statement, but didn't handle all the potential flag
combinations, leaving placement variables like the origin vector
uninitialized and causing nan values when projecting.

Pull Request: https://projects.blender.org/blender/blender/pulls/121246
2024-05-01 09:03:10 +02:00
Omar Emara
f595345f52 Compositor: Match size of Fast Gaussian with Gaussian
This patch matches the size of the Fast Gaussian mode of blur with the
standard Gaussian mode. The sigma value was computed as half the radius,
while it should be third of the radius, since Blender's Gaussian
function is truncated at 3 of the standard deviation of the unit
Gaussian. The patch include versioning to adjust the size of existing
files.

Pull Request: https://projects.blender.org/blender/blender/pulls/121211
2024-05-01 09:01:53 +02:00