Commit Graph

120055 Commits

Author SHA1 Message Date
Hans Goudey
8d5aa6eed4 Geometry Nodes: Index switch node
Add an "Index Switch" node which is meant as a simpler version of
the "Menu Switch" from #113445 that doesn't allow naming items
or displaying them in a dropdown, but still allows choosing between
an arbitrary number of items, unlike the regular "Switch" node.
Even when the Menu Switch is included (which should be in the
same release as this), it may still be helpful to have explicit mapping
of indices, and a fair amount of the internals can be shared anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/115250
2023-11-22 16:11:32 +01:00
Hans Goudey
ba1c8fe6a5 Mesh: Improve remesh attribute transfer
Currently we have options to transfer the paint mask, face sets, and
color attributes to the new mesh created by voxel remesh. This doesn't
make use of the generic attribute design, where it would be clearer to
transfer all attributes with the same methods. That's reflected in the
code as well-- we do duplicate work for the mask and vertex colors, for
example.

This commit replaces the transfer options with a single checkbox for
all attributes. All attribute types on all domains are transferred with
basically the same method as the "Sample Nearest" node from geometry
nodes-- they take the value from the nearest source element of the same
domain. Face corners are handled differently than before. Instead of
retrieving the mixed value of all the corners from the nearest source
vertex, the value from the nearest corner of the nearest face.

---

Some timing information, showing that when interpolating the same
data, the attribute propagation is significantly faster than before.
Edge and corner attributes would add some cost (edges more than
corners), but might not always be present.

Before
```
voxel_remesh_exec: 3834.63 ms
BKE_shrinkwrap_remesh_target_project: 1141.17 ms
BKE_mesh_remesh_reproject_paint_mask: 689.35 ms
BKE_remesh_reproject_sculpt_face_sets: 257.14 ms
BKE_remesh_reproject_vertex_paint: 54.64 ms
BKE_mesh_smooth_flag_set: 0.15 ms
```

After
```
voxel_remesh_exec: 3339.32 ms
BKE_shrinkwrap_remesh_target_project: 1158.76 ms
mesh_remesh_reproject_attributes: 517.52 ms
```

Pull Request: https://projects.blender.org/blender/blender/pulls/115116
2023-11-22 15:21:58 +01:00
Miguel Pozo
b4f62180fb Fix #114291: EEVEE-Next: Deferred tranparency blending
Disable blending in the deferred pass.

Pull Request: https://projects.blender.org/blender/blender/pulls/115066
2023-11-22 15:10:24 +01:00
Pratik Borhade
a7ae024ea3 Fix #115171: Transfer Mode operator tries and fails on linked objects
Skip operator execution if destination id is linked or overridden.

Pull Request: https://projects.blender.org/blender/blender/pulls/115266
2023-11-22 14:55:03 +01:00
Jacques Lucke
e50a601a95 Fix: crash when getting node tree logger
It's expected that something is emplaced into `tree_logger_`
by this function in all cases, even if it's just null.
2023-11-22 14:48:51 +01:00
Jeroen Bakker
fdf9750df9 EEVEE-Next: Cleanup Lookdev as its shaders are never deferred compiled
Code assumed that lookdev shaders could be deferred compiled, but
that is never the case. This PR cleans up some related code and
mechanisms that were introduced because we thought it was the case.

Pull Request: https://projects.blender.org/blender/blender/pulls/114368
2023-11-22 14:44:57 +01:00
Jeroen Bakker
266f4305a7 EEVEE-Next: Naming & UI tweaks Light Probes
* Rename "Type" to "Shape" in user interface. RDNA already used
  the term Shape (Still need to push this from office)
* Show LightProbe overlay settings
* Rename "Cubemap" to "Sphere"
* Rename "Planar" to "Plane"

Pull Request: https://projects.blender.org/blender/blender/pulls/114406
2023-11-22 14:43:52 +01:00
Hans Goudey
49087a84d0 Geometry Nodes: Use rotation socket for the object info node
See 600a133521 and #92967.
2023-11-22 08:25:32 -05:00
Hans Goudey
106de9f03c Fix: Avoid unnecessary conversions in rotation socket versioning
When the new rotation socket is connected to another rotation socket
already, a conversion node is unnecessary. Check this in addition to the
existing "non-self" implicit conversions.
2023-11-22 08:25:32 -05:00
laurynas
0ff1a8825e Fix: bevel weights in Simple mode of Solidify
In Simple Solidify's mode  edge weights created by "Bevel Convex"
disappear, if edge weight is added to original mesh. From technical
side problem is identical to the one in #114860.

If original mesh doesn't have layer "bevel_weight_edge" option "Bevel
Convex" works fine. All bevels disappear after one edge gets bevel
weight. Except ones corresponding newly added weight. In patched
version weights created by "Convex Bevel" stay. Also manually added
weight can be observed on the edge of inner cube.

Second problem is when am original plane has one vertex with bevel
weight 1.0, but no bevel in result. If to change Solidify's mode from
"Simple" to "Complex" bevel appears. Patch adds this behavior to the
"Simple" mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/115258
2023-11-22 13:42:01 +01:00
Omar Emara
48d7d60c96 Realtime Compositor: Rewrite inpaint node
This patch rewrites the Inpaint node in the Realtime Compositor. The old
method suffered from discontinuities and singularities in the inpainting
regions. Furthermore, it ignored semi-transparent areas.

The new method is inspired by a two pass method described by the paper:

  Rosner, Jakub, et al. "Fast GPU-based image warping and inpainting for
  frame interpolation." International Conferences on Computer Graphics,
  Vision and Mathematics. 2010.

In particular, we first fill the inpainting region using jump flooding,
then we apply a variable size blur pass whose size is proportional to
the distance to the inpainting boundary. The smoothed region is then
mixed with the input using its alpha.

The new method is much closer to the Bertalmio-style diffusion-based
inpainting methods, and thus can more accurately close holes than
existing methods.

The aforementioned method requires variable size blur, which is quite
expensive for this use case, so a new implementation was added that
approximates the method using a separable implementation, which provides
a visually pleasing result assuming a sufficiently smooth radius field,
which is true for our case since the field is an SDF.

Fixes: #114422

Pull Request: https://projects.blender.org/blender/blender/pulls/114849
2023-11-22 13:23:02 +01:00
Richard Antalik
5118f6f573 Fix mistake in previous commit
Oversight in `d0e9468848` - missed a variable to rename.
2023-11-22 06:04:58 +01:00
Richard Antalik
16e2698632 Fix (unreported): VSE offset drawing not working
Caused by error in refactor commit 4d668e6825. Offsets are drawn
outside of strip boundary, but strip content range in drawing context
is clamped by handles, so nothing was drawn.

Also this feature was not working, when using solo feature. This was
caused by another refactor e39cc78313. `special_seq_update` global
variable was declared in both files after splitting them, but set only
in one of them. Use `ED_sequencer_special_preview_get()` instead of
accessing variable directly.
2023-11-22 05:58:46 +01:00
Hans Goudey
bb80716244 Mesh: Parallelize remaining topology maps
Similar to [0], but also including the further optimizations from [1],
parallelize the vertex to edge, vertex to face, and edge to face
topology map index creation (the first part of the maps was already
parallelized). Vertex to face index creation went from 9.8 ms to 1.7 ms
on average, for a 1 million vertex grid. That's nice, since this map
is used for vertex normals after [2].

[0]: 226359ec48
[1]: 98e33adac2
[2]: 5052e0d407
2023-11-21 18:24:00 -05:00
Hans Goudey
75f24a5f14 Hydra: Parallelize and simplify submesh export
- Only calculate normals on the necessary domain
- Functions for exporting generic data
- Parallelize export of multiple submeshes
- Parallelize export within a single submesh
- Resize vectors to correct size to avoid reallocation
- Simplify hot loops to improve performance
- Optimize single material case to avoid index remapping

`write_submeshes` timing information (average of many runs)
| Test                           | Before    | After     |
| ------------------------------ | --------- | --------- |
| 6 million vert mesh            | 791.99 ms | 130.75 ms |
| 1.5 million vert 100 materials | crash     | 48.27 ms  |
| Mr. Elephant test file         | 778.95 ms | 277.06 ms |

Pull Request: https://projects.blender.org/blender/blender/pulls/113412
2023-11-21 23:40:54 +01:00
Iliya Katueshenock
274b2dbe5e Geometry Nodes: Parallel Edges to Face Groups
This loop might be 7x faster (not whole node).
All other code is already parallel, not sure why this was disabled.
Potentially, this was missed after some cleanup.

Pull Request: https://projects.blender.org/blender/blender/pulls/115246
2023-11-21 23:40:14 +01:00
Iliya Katueshenock
33442e0992 Geometry Nodes: Edges to Face Groups speedup
Remove unnecessary N^2\n complexity. Disjoint set will join all
elements in list, even without fully-related joins. Usually cost is
small (10%~ for this specific function), but some certain files might
be 10000x slower. But that is very corner case.

Pull Request: https://projects.blender.org/blender/blender/pulls/115245
2023-11-21 23:36:41 +01:00
Hans Goudey
b794bf173c Fix: Error in previous commit 2023-11-21 17:21:10 -05:00
Hans Goudey
5bacfd5c44 Fix: Crash with crazyspace mesh sculpting
Caused by a0b9865aa6, which apparently wasn't tested
properly. We need to use vertex indices instead of corner indices.
2023-11-21 17:19:40 -05:00
Miguel Pozo
3f778150a9 GPU: Sanitize closure nodes inputs
Ensure all Closures are filled with correct values,
like the principled bsdf node already does.

The main reason is that the new AgX color transform doesn't play well
with negative values (see #113220), but it's probably best to ensure we
use sanitized values in the rendering code as a whole.

Pull Request: https://projects.blender.org/blender/blender/pulls/115059
2023-11-21 20:15:59 +01:00
Clément Foucault
a001cf9f2b EEVEE-Next: Displacement Option
This add the displacement option to EEVEE materials.
This unifies the option for Cycles and EEVEE.

The displacement only option is not matching cycles
and not particularly useful. So we decided to not
support it and revert to displacement + bump.

Pull Request: https://projects.blender.org/blender/blender/pulls/113979
2023-11-21 19:55:38 +01:00
Xavier Hallade
14500953ed Overlay: Wireframe: avoid using custom depth bias with xray enabled
e000dcb849 has a performance
impact as it prevents early depth test, it's best to restrict it to when
xray is disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/114466
2023-11-21 19:23:59 +01:00
Bastien Montagne
9b08352b21 RNA: Expose ID type identifier in ID structs, add coherence test.
Expose the ID type identifier as defined by the `rna_enum_id_type_items`
enum items as `ID.id_type` in RNA.

Add some test to `id_management` ensuring that all ID types exposed in
`bpy.data` have a valid `id_type` value, i.e. that they have a matching
entry in `rna_enum_id_type_items`.

This will hopefully prevent future cases like #115151 .
2023-11-21 18:54:00 +01:00
Bastien Montagne
c0b8773a2b Fix #115151: ID property's id_type enum is missing the SCREEN type.
Was removed by 2e635b6500 during 2.80 development, but the Screen IDType
was never actually removed in the end.
2023-11-21 18:54:00 +01:00
Bastien Montagne
f0f378d31e Fix #115151, step one: Fallback to ID_OB in case of defined unknown ID type.
This is mainly intended to support forward compatibility with future,
unknwon ID types. Actual reported issue will be fixed in next commit.
2023-11-21 18:54:00 +01:00
Aras Pranckevicius
8a75b54735 BLI: change timeit to use fmtlib instead of direct cout
Especially on windows, direct output to `cout` via `<<` is very expensive.
Instead, use fmtlib to do all formatting into a no-alloc `fmt::memory_buffer`,
and output that with one call to `cout`.

timeit utilities are not used much by default, but during development or
profiling one often uncomments macros like `DEBUG_TIME` that then enable
`SCOPED_TIMER` or `SCOPED_TIMER_AVERAGED`.

Having one `SCOPED_TIMER_AVERAGED` inside sequencer `draw_channels`, with
empty timeline and all default channels; the overhead in % of `draw_channels`
duration of said scoped timer before and after this change:

- Windows: 29% -> 5%
- Mac: 5.0% -> 4.4%

Pull Request: https://projects.blender.org/blender/blender/pulls/115233
2023-11-21 18:35:42 +01:00
Germano Cavalcante
8643383b29 Fix #114596: snap to face nearest failing with transformed objects
In 7f89063161 it was incorrectly assumed that object space was not
applied to the variable `co`.
2023-11-21 13:36:30 -03:00
Clément Foucault
3097d5d821 EEVEE-Next: Add horizon scan to raytracing module
This uses the principles outlined in
Screen Space Indirect Lighting with Visibility Bitmask
to compute local and distant diffuse lighting.

This implements it inside the ray-tracing module as a fallback when the
surface is too rough. The threshold for blending between technique is
available to the user.

The implementation first setup a radiance buffer and a view normal
buffer. These buffer are tracing resolution as the lighting quality is
less important for rough surfaces. These buffers are necessary to avoid
re-projection on a per sample basis, and finding and rotating the
surface normal.

The processing phase scans the whole screen in 2 directions and outputs
local incomming lighting from neighbor pixels and the remaining
occlusion for everything that is outside the view.

The final steps filters the result of the previous phase while applying
the occlusion on the probe radiance to have an energy conserving mix.

Related #112979

Pull Request: https://projects.blender.org/blender/blender/pulls/114259
2023-11-21 16:24:14 +01:00
Antonio Vazquez
acbfecb852 GPv3: Replace depsgraph tag to ID_RECALC_GEOMETRY
The tag ID_RECALC_SHADING is not working in Grease Pencil
2023-11-21 15:59:17 +01:00
Iliya Katueshenock
fc30a4b6a5 Fix: BLI: Math: Build error for bad overload-lookup
Fix for unreported build error.

Pull Request: https://projects.blender.org/blender/blender/pulls/115095
2023-11-21 15:58:17 +01:00
Miguel Pozo
9320742b45 Fix #114651: EEVEE-Next: SSS NaNs
Before #112901, subsurface scattering was skipped if its radius was
less than 1 pixel.
Aside from an optimization, this also avoided divisions by zero in
`burley_eval`.
This just brings back the early return when `pixel_footprint < 1.0`.

Pull Request: https://projects.blender.org/blender/blender/pulls/114928
2023-11-21 15:47:51 +01:00
Hans Goudey
29f3d54e91 Cleanup: Grammar in comments
- it's self vs. itself
- boiler plate vs boilerplate
2023-11-21 09:42:39 -05:00
Christoph Lendenfeld
a99e419b6e Anim: Insert keyframes without keying sets
When animators want to key something in the viewport,
the code needs to know *which properties* should be keyed of that selected thing.
So far that was done with keying sets, and a pop-up that let's
you choose the keying set to use. You can get rid of the popup by
choosing a keying set ahead of time. But that is also not always desirable.

That pop-up is quite confusing and gives way too many options.
To simplify this process this PR adds a User Preference option to choose one or more of:
* Location
* Rotation
* Scale
* Rotation Mode
* Custom Properties

Now whenever the `I` key is pressed in the viewport,
and no keying set is enabled, it reads the preferences for which channels to insert.

# User Facing changes
* The popup will not be shown when pressing the hotkey,
 but you can still explicitly use keying sets by going to the menu
* Which channels are keyed is defined by a User Preference setting under animation
* when a keying set is used explicitly, the User Preference settings are ignored

Part of #113278

Pull Request: https://projects.blender.org/blender/blender/pulls/113504
2023-11-21 15:38:01 +01:00
Falk David
78d9267a56 GPv3: Material locking
This PR adds the material locking functionality from the current grease pencil.

Material locking allows the user to lock strokes with that specific material. Locked strokes cannot be edited.

Pull Request: https://projects.blender.org/blender/blender/pulls/114580
2023-11-21 15:27:01 +01:00
Iliya Katueshenock
b70d387f2a Fix: Geometry Nodes: wrong field inferencing in Shortest Edge Paths node
Pull Request: https://projects.blender.org/blender/blender/pulls/115139
2023-11-21 14:52:43 +01:00
Hans Goudey
6ba9ee88c8 Geometry Nodes: Node tools: Support warnings
Warnings created during evaluation of the node group are passed as
warnings to the operator. This is done using the existing logging
system, which we could also use to get socket inspection working
in the future.

See #101778

Pull Request: https://projects.blender.org/blender/blender/pulls/115237
2023-11-21 14:27:21 +01:00
Iliya Katueshenock
d9f44f4b93 Cleanup: remove unused variable
Error from b24610053f

Pull Request: https://projects.blender.org/blender/blender/pulls/115239
2023-11-21 14:23:53 +01:00
Jacques Lucke
96b3afe065 Cleanup: rename node group to group node context
`GroupNodeComputeContext` is the more correct name because it's
specifically about a group node that invokes another node tree.
The old name makes it sound like it should be used because a node group
is invoked but does not tell anything about what invoked it.
For example, the current context in a node group can also be a
`ModifierComputeContext` if that's what invoked it.
2023-11-21 14:12:23 +01:00
Christoph Lendenfeld
a91a8f3fed Anim: View FCurve of Property in the Graph Editor
This commit adds a new operator that allows to view an FCurve in the Graph Editor from the animated property.

# Features
* Frame a single property or a whole array property by right-clicking an animated property
* Works on a property anywhere in blender
* Framed FCurves are selected and set to visible
* Works on the selection. If an object/bone doesn't have a property it is ignored.
* Works with NLA offset and normalization
* Isolate curves. This is a property on the operator

# Caveats
* Frames on the first Graph Editor it finds
* Since it works on the selection but the n-panel works on the active object,
you can create a situation where nothing happens because you can have
an active object without it being selected.
* Assigning a shortcut doesn't work through right clicking the menu entry.
You have to go to the keymap and create a new entry manually (e.g. in the user interface category)

Pull Request: https://projects.blender.org/blender/blender/pulls/114407
2023-11-21 14:06:53 +01:00
Jacques Lucke
78b2c15c4d Nodes: support storing caller tree and node in node group compute context
This is used by #112677.
2023-11-21 13:52:45 +01:00
Jacques Lucke
813078daec BLI: support checking if two maps are the same 2023-11-21 13:38:43 +01:00
Falk David
6064e726d4 Fix: GPv3: Stutter while drawing
While drawing, the line beeing drawn would seemingly only update once
in a while. This was because there was a bug in the interpolation
function that would write the value being interpolated from
directly to the destination as the first value.
In our case, we only wanted to write new values (so
we need to exclude the first one).

Making sure the interpolation always excludes the value
interpolated from, fixes the drawing stutter issue.
2023-11-21 12:45:44 +01:00
Jason Fielder
3f3f4c3478 EEVEE Next: Ensure HiZ buffer update flag is cleared
HiZ dirty flag was previously not cleared upon update
resulting in duplicate updates in several places, without
source depth input having changed.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115235
2023-11-21 12:44:27 +01:00
Iliya Katueshenock
b24610053f Fix: crash when using attribute search in Named Attribute node
Missed part of 8149678d5e.

Pull Request: https://projects.blender.org/blender/blender/pulls/115136
2023-11-21 11:26:45 +01:00
Jeroen Bakker
dc8fd30a3c OpenGL: Raise Minimum SSBO Bindings to 12.
Draw manager requires a minimum of 12 bind points.

Pull Request: https://projects.blender.org/blender/blender/pulls/115229
2023-11-21 10:44:14 +01:00
Iliya Katueshenock
acee93bd6d Fix #115207: dynamically typed Viewer node
Missed part of 8149678d5e.

Pull Request: https://projects.blender.org/blender/blender/pulls/115130
2023-11-21 10:43:25 +01:00
20kdc
f01c82e268 VSE: Use Strip Volume property for scenes
Scene strips had scene volume property in side panel, but this meant,
that it is shared across all strips using particular scene.

Add `volume` RNA property for scene strips and use this in side panel.

Co-authored-by: 20kdc <asdd2808@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/112597
2023-11-21 08:09:18 +01:00
Richard Antalik
d0e9468848 Fix (Unreported) VSE crash when editing retiming
Caused by loop over `MutableSpan`, but underlying array can be
reallocated. Do index based looping instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/115121
2023-11-21 05:27:36 +01:00
Richard Antalik
918515495e Fix #115007: Crash when creating transition from last reiming key
This operation is not permitted, cancel operator execution when
attempted.

Pull Request: https://projects.blender.org/blender/blender/pulls/115122
2023-11-21 05:27:24 +01:00
Hans Goudey
8d2b203a3d Cleanup: Remove unnecessary keywords in C++ header 2023-11-20 22:12:27 -05:00