Commit Graph

120055 Commits

Author SHA1 Message Date
Hans Goudey
c095962d06 Fix #112900: Asset displaying mesh with hiding and no material indices
The case when there were no material indices, multiple materials, and
the mesh used hiding wasn't handled after 55970fa367.
This is a simple parallel loop adding up the non-hidden triangles.
2023-09-26 15:10:22 -04:00
Miguel Pozo
b56d39bdcc EEVEE-Next : Object visibility settings for probes
Replace per-probe visibility collections with global per-object probe
visibility settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/112845
2023-09-26 20:37:15 +02:00
Jacques Lucke
ad169ba67a Geometry Nodes: support baking individual simulations
Previously, it was only possible to bake all simulations at once. This is great
for simple use-cases that, but in more complex setups one can have independent
simulations that should also be baked independently. This patch allows baking
individual simulation zones.

Furthermore, each simulation zone can now also have its own bake path and
simulation frame range. By default the simulation frame range is the scene frame
range, but it can also be customized on the scene or simulation zone level. The
bake path is generated based on the modifier bake path by default, but can be
set to another absolute or relative (to the .blend file) path.

The timeline drawing has been modified as well to be able to show more information
in the case when some simulations are baked and others are not. Instead of showing
a line for every simulation, it shows a condensed view of the important information
using at most two lines:
Is something baked? Is something valid or invalid? Also see #112232.

Pull Request: https://projects.blender.org/blender/blender/pulls/112723
2023-09-26 20:30:46 +02:00
Miguel Pozo
f07542d8cb EEVEE-Next: Fix Hair and Curves motion vectors
Hair and Curves need to call `DRW_curves_update` before
`geometry_steps_fill`, otherwise the copied geometry is just
uninitialized data.
However, doing so triggers an assertion:
> DRW_render_instance_buffer_finish had not been called before drawing.

This PR ports the `DRW_hair/curves_pos_buffer_get` functions to the new
`draw::Manager` API, so it can be called at any arbitrary point.
It also changes `VelocityModule::geometry_map` to use `uint64` keys
instead of `ID` pointers, since the same particle system can be used on
different objects and have multiple geometries.

Notes:
* The new functions are only used for
  `VelocityModule::step_object_sync` on image renders. Using them
  elsewhere would require modifying the old draw manager to do the
  init/update/free setup.
* Only the compute shader version has been ported.

Pull Request: https://projects.blender.org/blender/blender/pulls/112425
2023-09-26 19:55:46 +02:00
Miguel Pozo
049cb479b2 EEVEE-Next: Irradiance Grid clip distance and probe alignment
Implement a clip distance to irradiance grids, so surfaces farther than
the threshold don't generate surfels.
Align the capture view matrix to the probe rotation.

Pull Request: https://projects.blender.org/blender/blender/pulls/112863
2023-09-26 19:45:41 +02:00
Miguel Pozo
a6536ca9c8 Fix: EEVEE-Next: Irradiance Grid minor fixes
Pull Request: https://projects.blender.org/blender/blender/pulls/112841
2023-09-26 19:27:30 +02:00
Bogdan Nagirniak
c0a0de617c Hydra: export Blender shader nodes as MaterialX node graph
This adds initial support for rendering Cycles and EEVEE shaders in Hydra
render engines that support MaterialX. Not all nodes are currently
supported, see the detailed compatibility list in #112864.

Co-authored-by: Georgiy Markelov <georgiy.m.markelov@gmail.com>
Co-authored-by: Vasyl Pidhirskyi <vpidhirskyi@gmail.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/111765
2023-09-26 18:52:41 +02:00
Nathan Vegdahl
49eab72141 Fix #107030: return accurate action frame ranges from the Python API
This changes the `action.frame_range` Python API to return an accurate
frame range for actions.  Specifically, it was previously special-cased
to return a range with length 1 whenever the length was actually 0.  This
led to a bizarre situation where a real frame range of `[0.0, 0.2]` would
return that range as-is, but a real frame range of `[0.0, 0.0]` would
instead return a range of `[0.0, 1.0]`.

The new behavior simply always returns the real frame range.

The reason for the previous behavior was obscure: the relevant code was
also used internally in Blender's NLA system, and returning a zero-length
range could result in NLA strips getting infinite scale.  The code is now
separated out appropriately so that the NLA system still gets the
non-zero-length range, while the Python API for actions returns the real
range.

Pull Request: https://projects.blender.org/blender/blender/pulls/112709
2023-09-26 18:18:56 +02:00
Jeroen Bakker
4a78d7dc4c Fix 110976: Sequencer Scope Artifacts on NVIDIA 30/40 Series
This PR fixes an issue with the NVIDIA 3000/4000 series cards. The cause
might be that when blending is turned off and the fragment output has an alpha
of 0.0 the fragment might be discarded. This is a guess of course.

By setting the Alpha to 1.0 for scopes and enabling alpha blending when
drawing the meta data text seems to fix the issue.

Fixes #110976

Pull Request: https://projects.blender.org/blender/blender/pulls/112665
2023-09-26 17:29:59 +02:00
Pratik Borhade
9c20a29259 Fix #112904: Outliner: Bones appear in different places in different modes
c6b553d57c added the bone collection in
outliner. However, there is change in tree element order when switched
between pose and edit/object mode. Because order of tree building is
`edit bones -> bone collection -> pose bones`
To keep tree structure consistent between different modes, first draw
pose bone and then the ebone/bone collection.

Pull Request: https://projects.blender.org/blender/blender/pulls/112908
2023-09-26 17:26:26 +02:00
Julian Eisel
73460903fa Asset Shelf: Transparent asset shelf header with background for buttons
Draw the background of the asset shelf header fully transparent, with an opaque
background with rounded corners behind sections containing buttons. This
reduces the visual space consumed by the asset shelf, and makes the header
follow a tabbed folder metaphor better. Also, this works much better with our
click-through feature, where transparent parts of regions without buttons are
passed through the region under it (we might want to consider unifying code
here a bit).

The edge to drag for region resizing respects the transparent sections.
When there is little space between sections, the sections get merged so that
there are no small gaps in the bar.

Part of #107881.

----

Note that the core of this is implemented in a generic way, so this can be
reused for other regions.

Pull Request: https://projects.blender.org/blender/blender/pulls/112241
2023-09-26 17:12:37 +02:00
Sybren A. Stüvel
c524fbe623 Anim: Improve readability of channel colors in channel list
Draw anim channel colors as a little rectangle in the channel list,
instead of taking over the entire channel name background. This keeps
the channel names readable, regardless of the channel colors.

Channel colors are typically set via the bone colors, and since those
are chosen for visual contrast in the 3D Viewport, they aren't
guaranteed to also be a suitable background color for the channel list.
Because of this, it's no longer used as such.

The channel 'data' background (i.e. the keyframe area) is now drawn with
a consistent color, and much more subtle.

This also enables the 'Channel Group Colors' setting in the preferences
by default, as it is now way less obnoxious and invasive.

Design task: https://projects.blender.org/blender/blender/issues/69059
Reviewed-On: https://projects.blender.org/blender/blender/pulls/112861
2023-09-26 17:06:35 +02:00
Julian Eisel
ca2a8be15f Assets: Rename "Import Type" to "Import Method" in code/BPY
It was already called that way in the UI, since it's referring to a
behavior, not a type. Update the code to match that. Note that this is
a BPY compatibility breaking change for 4.0.
2023-09-26 16:48:47 +02:00
Hans Goudey
395f279166 Fix: Missing node asset menu updates after mark asset
Use of node group assets relies on a few properties written to asset
meta-data for proper filtering of assets in menus (add modifier menu,
node add menu, 3D view menus for tools). Currently these meta-data
properties are written when updating their source properties and when
saving the file. That means they *aren't* written when marking a group
as an asset, which is necessary because the meta-data doesn't exist
before when the group isn't an asset. Currently users have to save the
file to update menus in this case, which isn't intuitive.

As a fix, call the function to write the meta-data when marking a
data-block as an asset.

Pull Request: https://projects.blender.org/blender/blender/pulls/112743
2023-09-26 16:38:50 +02:00
Jeroen Bakker
7dbe689b63 Vulkan: Use Point Shaders When Drawing Points
In Vulkan (and Metal) it is not possible to use a global as point
size. It needs to be set for each vertex when drawing points. Blender
has specialized shaders for that, but not all code respect those
shaders.

This PR will add an assert inside the vulkan backend when incorrect
usage of shaders are detected.

Pull Request: https://projects.blender.org/blender/blender/pulls/112906
2023-09-26 16:04:08 +02:00
Clément Foucault
e4c89baf53 EEVEE-Next: Port subsurface to compute shader
This makes the SSS processing more isolated to avoid
side effects in other passes.
Also this allow more optimization using LDS.

The radiance buffer is created by a setup phase using
direct and indirect lighting.

Splitting this into its own compute pass also fixes
a pass merging issue on Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/112901
2023-09-26 15:52:35 +02:00
Jeroen Bakker
beb90b5573 Cleanup: Make format 2023-09-26 15:43:59 +02:00
Jacques Lucke
5c5a041edd Fix #112022: allow vertex groups and attributes with same names again
This was discussed in #112022 and on devtalk:
https://devtalk.blender.org/t/vertex-groups-generic-attributes-and-name-clashing/31073

While vertex groups with the same name as attributes should be avoided, since
it can cause ambiguities when using attributes, it's something we can handle
gracefully for now. Enforcing unique names for vertex groups resulted in breaking
other functionality under some circumstances.

This effectively reverts 12ef20990b, except for
the bug fix in `BKE_id_attribute_new`.

#112891 adds a warning to avoid make users aware of duplicate names so that they
can be avoided in practice.

Pull Request: https://projects.blender.org/blender/blender/pulls/112889
2023-09-26 15:36:12 +02:00
Clément Foucault
788506d7fc GPU: add pragma once to GPU_shader_shared.h
Otherwise there are compilation issues
when the file happens to be included twice.
2023-09-26 15:19:51 +02:00
Hans Goudey
97f2b01ea9 Fix #112351: Sculpt implicit sharing thread safety crash
Currently the iteration over a PBVH node's vertices retrieves mutable
access to the mask custom data layer. This isn't threadsafe, but it is
done in the multithreaded loops over all nodes.

In general, we need to be more careful and conservative about storage
of non-const pointers to mesh data. Ideally we would only have one
mutable reference to a resource at a time. And we should avoid doing
work like looking up custom data layers more than we need to.

To that end, make the pointer to the custom data layer used everywhere
const, and retrieve mutable access before parallel node iteration with
a specific function, and write to the mask data with that in mind.

This pushes us in the direction of sharing less code per PBVH type.
In my opinion that's a good thing, because we can actually optimize for
each type. For example, `write_mask_data` gives a picture of
how each of these hot loops could become much simpler.

Pull Request: https://projects.blender.org/blender/blender/pulls/112690
2023-09-26 14:21:07 +02:00
Alexander Gavrilov
0055ae01ab Anim: implement a new curve-aware vertex to B-Bone segment mapping mode.
Currently vertices are mapped to B-Bone segments without taking the
rest pose curve into account. This is very simple and fast, but causes
poor deformations in some cases where the rest curvature is significant,
e.g. mouth corners in the new Rigify face rig.

This patch implements a new mapping mode that addresses this problem.
The general idea is to do an orthogonal projection on the curve. However,
since there is no analytical solution for bezier curves, it uses the
segment approximation:

* First, boundaries between segments are used for a binary space
  partitioning search to narrow down the mapping to one segment.
* Then, a position on the segment is chosen via linear
  interpolation between the BSP planes.
* Finally, to remove the sharp discontinuity at the evolute surface
  a smoothing pass is applied to the chosen position by blending to
  reduce the slope around the planes previously used in the BSP search.

In order to make per-vertex processing faster, a new array with the
necessary vectors converted to the pose space, as well as some
precomputed coefficients, is built.

The new mode is implemented as a per-bone option in order to ensure
backward compatibility, and also because the new mode may not be
optimal for all cases due to the difference in performance, and
complications like the smoothed but still present mapping
discontinuities around the evolute surface.

Wiki: https://wiki.blender.org/wiki/Source/Animation/B-Bone_Vertex_Mapping

Pull Request: https://projects.blender.org/blender/blender/pulls/110758

Pull Request: https://projects.blender.org/blender/blender/pulls/110758
2023-09-26 14:17:21 +02:00
Jacques Lucke
a8c0857dcf Fix: assert due to missing topology cache 2023-09-26 12:12:10 +02:00
Jacques Lucke
3cbddb2a22 BLI: compute string search scores in parallel
This can make string search a bit faster when there are many
possible search results. There are still multiple serial bottlenecks
though.
2023-09-26 12:07:18 +02:00
Campbell Barton
077832e063 Cleanup: spelling in comments 2023-09-26 19:50:48 +10:00
Campbell Barton
943096b3bb Cleanup: add missing include, use nullptr literal 2023-09-26 19:50:48 +10:00
Jacques Lucke
56e98f8ba6 UI: prioritize highlighted last words in string search
When using menu search, each search item has multiple segments. In the UI,
 we only highlight last section, which is the actual node/operator name. The
menu path is grayed out. It seems reasonable to give greater weight to the
words in the search item that are highlighted.

See #112839 for an example of what effect this can have.

Pull Request: https://projects.blender.org/blender/blender/pulls/112839
2023-09-26 11:49:49 +02:00
Clément Foucault
a5741e0561 EEVEE: Change do_multiscatter to a bool internally
This avoid confusion outside of the shader node GLSL code.
The issue also is that Metal allow float to cast to bool
implicitly but this create a compilation error on
OpenGL.
2023-09-26 11:48:51 +02:00
Jacques Lucke
9dda646ea3 Fix: try to call unavailable operator
This issue was introduced in d1fbc69e03,
not exactly sure why this was renamed.
2023-09-26 11:28:12 +02:00
Jeroen Bakker
8f9c14145e EEVEE-Next: Fix World Reflection During Raytracing
Scenes that only uses a world probe would didn't work. Raytracing
would look for the closest light probe, didn't find any and shader
would use undefined behavior to sample in the reflectionProbes texture.

In some cases this resulted in correct results when the world was
located on layer 0 with subdivision 0. In any other case this would
sample incorrect incoming light what lead to black reflections.

This PR fixes this by returning the world probe when no nearest light
probe cound be found.

Pull Request: https://projects.blender.org/blender/blender/pulls/112893
2023-09-26 11:19:04 +02:00
Jeroen Bakker
aebcec0493 EEVEE: Fix Shader Compilation
Pull Request: https://projects.blender.org/blender/blender/pulls/112890
2023-09-26 10:24:47 +02:00
Clément Foucault
0a4fa62f51 EEVEE: Add support for metallic F82 tint
This adds a new entry to the split sum LUT to isolate
the effect of the F82 tint.

The application of the tint part is similar to cycles
and uses the same way for precomputing the `b` factor.

Results matches almost perfectly to the extent of the
split sum approximation.

Note that this removes the unused LTC MAG LUT for
EEVEE next to make space for the new table. It can still
be added back if needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/112881
2023-09-26 10:16:39 +02:00
Jeroen Bakker
3514d6ed52 Cleanup: Make format 2023-09-26 08:58:04 +02:00
Hans Goudey
d1fbc69e03 Cleanup: Move logic out of loops, remove unnecessary ui sublayouts 2023-09-25 22:07:11 -04:00
Hans Goudey
0cb01332f1 Cleanup: Consistency between asset-extended menu UI templates
Define the UI template in the namespace of its own module, and
consistently use references and const in those UI template functions.
2023-09-25 21:58:30 -04:00
Hans Goudey
34a1b5bdbd Fix: Node tools shortcuts don't display in menus
Since the menus are defined in the header region, but the keymap is part
of the 3D view window region, we need to specify that when creating the
operator buttons.
2023-09-25 21:41:50 -04:00
Hans Goudey
2aa393e727 Cleanup: Remove unnecessary struct keyword in BKE_screen.hh 2023-09-25 17:53:11 -04:00
Hans Goudey
916d4c9d9b Cleanup: Move BKE_screen.h to C++
See #103343
2023-09-25 17:53:11 -04:00
Clément Foucault
bea13af81a Fix Realtime Compositor: Fix shader compilation on Metal 2023-09-25 22:00:06 +02:00
Jason Fielder
ee03bb38cb Metal: Add support for atomic image operations
Texture Atomics have been added in Metal 3.1
and enable the original implementations of
shadow update and irradiance cache baking.

However, a fallback solution will be
required for versions under macOS 14.0 utilising
buffer-backed textures instead.

This patch also includes a stub implementation if
building/running on older macOS versions which
provides locally-synchronized texture access in
place of atomics. This enables some effects to be
partially tested, and ensures non-guarded use
of imageAtomic functions does not result
in compilation failure.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/112866
2023-09-25 21:56:46 +02:00
Miguel Pozo
499c39cfb9 Fix #112867: Workbench: Final render fails to render hair
Add missing calls to the old draw manager functions.
2023-09-25 21:15:56 +02:00
Miguel Pozo
0dfcde3fde Fix: EEVEE-Next: Ensure volume property textures are cleared
Clear volume property textures when there's no valid world volume
shader.

Pull Request: https://projects.blender.org/blender/blender/pulls/112871
2023-09-25 19:54:51 +02:00
Brecht Van Lommel
a469640861 USD: improve I/O of emission color in preview surface
Don't export color if strength is 0, and on import set strength to 1 when
there is a color. This is more important now that the default is color white
and strength 0 in the Principled BSDF.

Ref #99447
Ref #112848
2023-09-25 19:51:31 +02:00
Brecht Van Lommel
3d38b51435 Shaders: add "Weight" to Transmission/Subsurface/Coat/Sheen socket names
Ref #99447
Ref #112848
2023-09-25 19:51:27 +02:00
Brecht Van Lommel
1d265eed5d Shaders: rename Specular to Specular IOR Level in Principled BSDF
To clarify that this is no longer the primary control, but rather
and adjustment on IOR.

Ref #99447
Ref #112552
2023-09-25 19:51:22 +02:00
Brecht Van Lommel
239edb27ad EEVEE: optimize principled BSDF by skipping unused components
Ref #99447
Ref #112848
2023-09-25 19:51:17 +02:00
Alaska
a03ee1af81 Shaders: clamp various shader inputs for Principled BSDF
Ref #99447

Pull Request: https://projects.blender.org/blender/blender/pulls/112774
2023-09-25 19:51:12 +02:00
Lukas Stockner
6e2f29b421 Shader: change Specular input on Principled BSDF to affect IOR
This keeps the behavior similar to the Disney BRDF, where 0.5
is neutral and lower/higher values respectively decrease/increase
the dielectric specular. But it's more correct in that it's not
an arbitrary scale on Fresnel, but rather adjusting the IOR.

Ref #99447
Ref #112848

Pull Request: https://projects.blender.org/blender/blender/pulls/112552
2023-09-25 19:51:02 +02:00
Brecht Van Lommel
3d986b81c5 Shaders: move subsurface scale input below radius in Principled BSDF
To help clarify that this is a scale on the radius.

Ref #99447
Ref #112848
2023-09-25 19:50:56 +02:00
Brecht Van Lommel
3e3bdc9b89 Shader: rename subsurface scattering methods and change default
Clarify that one was specifically designed for skin shading.

Ref #99447
Ref #112848
2023-09-25 19:50:50 +02:00
Brecht Van Lommel
334027063e Shader: use single Principled BSDF input for metallic and specular tint
To match Standard Surface and OpenPBR.

Ref #99447
Ref #112848
2023-09-25 19:50:44 +02:00