126632 Commits

Author SHA1 Message Date
Bogdan Nagirniak
04bb5f9995 Render: support USD Hydra render delegates
Hydra is a rendering architecture part of USD, designed to abstract the
host application from the renderer. A renderer implementing a Hydra
render delegate can run in any host application supporting Hydra, which
now includes Blender.

For external renderers this means less code to be written, and improved
performance due to a using a C++ API instead of a Python API.

Add-ons need to subclass bpy.types.HydraRenderEngine. See the example in
the Python API docs for details.

An add-on for Hydra Storm will be included as well. This is USD's
rasterizing renderer, used in other applications like usdview. For users
it can provide a preview of USD file export, and for developers it
serves a reference.

There are still limitations and missing features, especially around
materials. The remaining to do items are tracked in #110765.

This feature was contributed by AMD.

Ref #110765

Co-authored-by: Georgiy Markelov <georgiy.m.markelov@gmail.com>
Co-authored-by: Vasyl-Pidhirskyi <vpidhirskyi@gmail.com>
Co-authored-by: Brian Savery <brian.savery@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/104712
2023-08-04 17:01:09 +02:00
Bogdan Nagirniak
61f407d427 Build: install USD Storm and MaterialX libraries by default
* Bundle hdStorm and associated plugins
* Enable WITH_MATERIALX by default to bundle MaterialX libraries
* Set PXR_MTLX_STDLIB_SEARCH_PATHS so Storm can find MaterialX files

Co-authored-by: Georgiy Markelov <georgiy.m.markelov@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref #110765, #104712
2023-08-04 17:01:09 +02:00
Brecht Van Lommel
efe10cee5c Cleanup: compiler warning with clang 2023-08-04 17:01:09 +02:00
Jacques Lucke
ba1e88bffc Fix: simulation with no-cache resets when changing property
The simulation used to reset when the previously computed frame is the
same as the current one. However, in this case the output should just be
the same as in the previous computation.

Pull Request: https://projects.blender.org/blender/blender/pulls/110799
2023-08-04 16:59:56 +02:00
Miguel Pozo
a5e62537a5 Fix: Compilation error after 41c83d6cfc7 2023-08-04 16:50:53 +02:00
Miguel Pozo
ff470f3f2e EEVEE Next: Volumes
Port of EEVEE unified volume rendering to EEVEE Next, using compute
shaders.

Improvements:
- Skip empty volume outside object bounds. (Large performance
  increase)

Currently missing:
- Shadows and irradiance integration.
- Grid-space TAA.

Main Task: #105672

Pull Request: https://projects.blender.org/blender/blender/pulls/107176
2023-08-04 16:47:16 +02:00
Miguel Pozo
41c83d6cfc EEVEE Next: Sculpt support
Add sculpt support to EEVEE Next.

It creates a new resource handle for sculpt object, since
BKE_object_boundbox_get returns a wrong (zeroed) bounding box.

This also adds a new `resource_handle` function to the `draw::Manager`
that works like the default one, but lets the caller optionally override the
object matrix and/or bounds.

Pull Request: https://projects.blender.org/blender/blender/pulls/110703
2023-08-04 16:38:04 +02:00
Jacques Lucke
ada738ac7c Fix: temperature attribute in eevee is divided by three
This fixes the eevee part of #110716.
Cycles still outputs zero which is the same issue as in #87494.

Pull Request: https://projects.blender.org/blender/blender/pulls/110768
2023-08-04 16:37:21 +02:00
Weizhen Huang
c36eccfae9 Nodes: Copy socket values with the same identifier instead of name
`identifier` should be a better measure than `name` to check if a socket
has the same meaning among different nodes. Sometimes two sockets can
have the same name in the UI but have different (physical) meanings,
they can specify different identifiers to avoid the values being copied
when the nodes are replaced.

Pull Request: https://projects.blender.org/blender/blender/pulls/110792
2023-08-04 16:32:33 +02:00
Hans Goudey
97769581f5 Cleanup: Split fsmenu.c before C++ conversion
The complication is that `Carbon.h` also defines its own`Collection`
type, which is visible in this file as a forward declaration in
`UI_interface_icons.h`. To fix that, move the code that needs to
include platform specific includes to a separate file that includes
fewer Blender headers.

See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110731
2023-08-04 16:09:56 +02:00
Julian Eisel
42dfa740c4 Fix crash when toggling asset shelf "Show Names" with sidebar open
There was an earlier version of this fix in the asset shelf branch, but
got reverted after the new version ended in main 4137f9a87f. But I
forgot to update the branch for the new fix.
2023-08-04 15:31:17 +02:00
Hans Goudey
d0d21f2934 Fix: Array modifier assert when not recalculating normals
Reported by Bastien in chat, thanks!
2023-08-04 08:15:47 -04:00
Campbell Barton
1f612605ab Fix #110732: blender_theme_as_c fails fails with error
Renaming members of a struct that it's self was renamed was not working,
support renamed structs as well as order member renaming - needed for
the lamp members that replace one member with another.
2023-08-04 18:00:08 +10:00
Campbell Barton
1e1f4db8b6 Tools: add 'diff' and 'email' attrs to git_log utility module
Expose email email & diff as they're generally useful when inspecting
commits.
2023-08-04 14:46:24 +10:00
Campbell Barton
ed6e24b176 Fix resource leak in git_log utility module
Resolve a resource leak I encountered in credits_git_gen.py during
development, where it could exit with an OSError: "Too many open files".
2023-08-04 14:37:32 +10:00
Campbell Barton
9ba38d5bb6 License checker: scan paths "*.inl;*.ch;*.osl;*.metal;*.tables" 2023-08-04 13:24:18 +10:00
Campbell Barton
0caf227530 License headers: use SPDX-FileCopyrightText for *.inl and *.osl files 2023-08-04 13:24:17 +10:00
Campbell Barton
e548294de2 License headers: remove GPL header from OSL template script
Original script from Sylvio Sell [0] has "Blender Foundation" listed
as copyright holder. In general template scripts are examples
that users can use as a reference without the copyright applying to
their work.

[0]: http://maitag.de/~semmi/blender/lyapunov/osl/lyapunov.osl
2023-08-04 13:24:15 +10:00
Campbell Barton
f88f1c4011 Cleanup: quiet mypy warning 2023-08-04 11:27:34 +10:00
Hans Goudey
81f51e5433 Cleanup: Remove mistakenly duplicated file in C++ conversion
Mistake in 731d296f35f41d785a24f1c45e06ba8346ff919d
2023-08-03 20:04:50 -04:00
Hans Goudey
444a42e71c Fix: Duplicate "Tool" geometry nodes menu with asset catalog
Still need to maintain the hack of listing the existing menu items
in the code from cf985180551da833d416 unfortunately.
2023-08-03 19:03:00 -04:00
Campbell Barton
adf58a77ff Cleanup: use LISTBASE_FOREACH & LISTBASE_FOREACH_BACKWARD macros 2023-08-04 08:51:13 +10:00
Campbell Barton
f7be60eff0 Cleanup: format 2023-08-04 08:46:18 +10:00
Campbell Barton
7afd938dde Cleanup: various non-functional C++ changes 2023-08-04 08:45:57 +10:00
Bastien Montagne
67bc7f9477 LibOverride: Fix RNA API to access liboverride operation's flag.
This should have been an bitflag enum since the beginning.
2023-08-03 20:07:13 +02:00
Germano Cavalcante
87d04de418 Transform: simplify proportional distance algorithm
The `TD_NOTCONNECTED` flag is not set in all cases.

In some cases, such as Meshes, the `FLT_MAX` value better determines
when the `TrasData` is not "connected".

Therefore, this commit removes the `TD_NOTCONNECTED` flag and adapts
the code to rely on the `FLT_MAX` value instead.

These TrasDatas shouldn't even be created in these cases.
2023-08-03 13:55:59 -03:00
Germano Cavalcante
2786680ad8 Cleanup: Remove unused struct
`TransCenterData` is no longer used since be60b3b239
2023-08-03 13:55:59 -03:00
Hans Goudey
bc393c4033 Geometry Nodes: Draw node operator inputs in redo panel
Show node group inputs in the redo panel, including the
"use attribute" toggle. There are a few limitations that will
be solved separately:
- The redo panel is _always_ drawn, there is no way to show it conditionally yet
- There is no way to add the operator name to the redo panel title yet
- Attribute search is still missing for attribute inputs

Pull Request: https://projects.blender.org/blender/blender/pulls/109975
2023-08-03 18:04:36 +02:00
Miguel Pozo
63f29fdcfe EEVEE Next: Fix: Ambient Oclussion Pass
Fix regression after #110219.
Avoid using layer views, instead of adding the MIP_SWIZZLE_VIEW usage
to renderbuffers.
2023-08-03 17:48:35 +02:00
Clément Foucault
4d75c0484a EEVEE-Next: Use reflection lightprobes for raytrace fallback 2023-08-03 17:29:31 +02:00
Ray Molenkamp
8daebd807c Cleanup: CMake: fix superfluous extern_curve_fit_nd in bf_editor_curve
Missed in 4718c084e6bff645d169a5fa587bce228bf8fadb it already has
bf::extern::curve_fit_nd so extern_curve_fit_nd isn't needed.
2023-08-03 09:25:32 -06:00
Julian Eisel
6764e69491 UI: Add asset shelf Python UI template
Adds a new "Ui Asset Shelf" template to the script editor, demonstrating
how scripts can register own asset shelves. The asset shelf is designed
as a new standard UI element that add-ons, application templates and the
like can use, so this is useful. It's also useful as a quick way to test
and customize the asset shelf.

The script is only available in the UI if the "Asset Shelf" experimental
feature is enabled in the Preferences.
2023-08-03 17:16:10 +02:00
Julian Eisel
94fdafe906 Sculpt/UI: Experimental asset shelf for brush assets in sculpt mode
With the "Extended Asset Browser" and "Asset Shelf" experimental
features enabled, an asset shelf will now be displayed in sculpt mode.
This is useful for testing and development for the brush assets project,
see #101895.

Approved as part of #104831, then split off as separate commit.
2023-08-03 17:13:38 +02:00
Hans Goudey
dc7979a056 Cleanup: Make geometry set naming more consistent
Remove the "_for_read" suffix from methods to get geometry and geometry
components. That should be considered the default, so the suffix just
adds unnecessary text. This is consistent with the attribute API and
various implicit sharing data access methods.

Use "from_mesh" instead of "create_with_mesh". This is consistent with
the recently used naming for the `IndexMask` API.

Pull Request: https://projects.blender.org/blender/blender/pulls/110738
2023-08-03 17:09:18 +02:00
Miguel Pozo
26d75293e8 EEVEE Next: Fix: Render region
` RenderData::border` and `View3d::render_border` are independent of each other.
Render region can be enabled even if the `V3D_RENDER_BORDER` flag is disabled.
And using the viewport render border shouldn't disable the camera view outer borders.

Pull Request: https://projects.blender.org/blender/blender/pulls/110761
2023-08-03 17:08:23 +02:00
Julian Eisel
268d322e7c BKE: Bump subversion for versioning in previous commit 2023-08-03 17:07:22 +02:00
Julian Eisel
8b19477e9c UI: Support asset shelves in 3D Views
The previous commit introduced all the basic bits and pieces necessary
to support asset shelves as experimental feature, but didn't actually
add support for any specific editor. With this commit asset shelves can
be registered in 3D Views, which should soon be used by the Pose Library
add-on to replace its previous UI in the sidebar (see
blender/blender-addons#104546). Note that until then, there will still be no
actual asset shelf to display.

Also adds:
- Toggle to hide/unhide the asset shelf under "View" -> "Asset Shelf"
- 3D View theme settings for the asset shelf regions.

None of the changes are visible if the experimental option for the asset
shelf is not enabled.

Approved as part of #104831, then split off as separate commit.

Pull Request: #110767
2023-08-03 16:59:50 +02:00
Julian Eisel
98142f5e35 UI: Asset Shelf Support (Experimental Feature)
No user visible changes expected, except of new experimental feature
option.

------------------------------------------------------------------------------

This introduces asset shelves as a new standard UI element for accessing
assets. Based on the current context (like the active mode and/or tool), they
can provide assets for specific workflows/tasks. As such they are more limited
in functionality than the asset browser, but a lot more efficient for certain
tasks.

The asset shelf is developed as part of the brush assets project (see #101895),
but is also meant to replace the current pose library UI.

Support for asset shelves can quite easily be added to different editor types,
the following commit will add support for the 3D View. If an editor type
supports asset shelves, add-ons can chose to register an asset shelf type for
an editor with just a few lines of Python.

It should be possible to entirely remove `UILayout.asset_view_template()` once
asset shelves are non-experimental.

Some changes are to be expected still, see #107881.

Task: #102879
Brush asset workflow blog post: https://code.blender.org/2022/12/brush-assets-workflow/
Initial technical documentation: https://developer.blender.org/docs/asset_system/user_interface/asset_shelf/

Pull Request: #104831
2023-08-03 16:54:39 +02:00
Hans Goudey
733f90bd24 Geometry Nodes: Rename "Operator" context to "Tool"
"Tool" is a more friendly word with mostly the same meaning within
Blender. Eventually it should be possible to create active tools with
node groups anyway, so the distinction isn't even helpful.

See #101778
2023-08-03 10:51:37 -04:00
Ray Molenkamp
4718c084e6 Cleanup: CMake: Modernize bf_extern_curve_fit_nd dependencies
Pretty straightforward

- Remove any curve_fit_nd paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110762
2023-08-03 16:50:25 +02:00
Clément Foucault
0dc3318ffd EEVEE-Next: Irradiance Bake: Virtual Offset
Implement capture point bias. This offsets the capture
points to reduce the amount bad capture locations (i.e.:
inside objects, near walls etc...).

Two new parameters are added:
- Capture Surface Bias: Ensure a minimum distance between
capture points and surrounding geometry. This is expressed as the
relative distance between two capture point. Requires re-bake
to take effect.
- Capture Escape Bias: Moves capture points enclosed inside
objects above the nearest surface. This bias defines how far a
capture point can be moved for escaping the object. This is
expressed as the relative distance between two capture point.
Requires re-bake to take effect.

This is called virtual offset in the reference material.

A quick prepass runs before the baking to offset the samples away
from any surface that could potentially make bad samples.

In order to speedup the process, we create cluster list of surfels
near each irradiance grid point. This allow access to neighboring
surfels that can contribute to the virtual offset which should
never be more than half a cell wide.

Pull Request: https://projects.blender.org/blender/blender/pulls/110355
2023-08-03 16:47:05 +02:00
Miguel Pozo
567a2e5a6f EEVEE Next: Overscan support
Add overscan support for both viewport and final renders.

Pull Request: https://projects.blender.org/blender/blender/pulls/110313
2023-08-03 16:19:08 +02:00
Hans Goudey
eabff37483 Mesh: Add API functions to assign vertex normals
A few places already calculated vertex normals with better contextual
information to improve performance. To allow changing the storage of
vertex normals more (mostly for improved caching), change some code
from "get normals, set values, clear dirty flag" to "make vertex
normals data, give to mesh". This makes the API less awkward too,
since previously the "get for write" and "clear dirty" calls always
had to be separated.

Pull Request: https://projects.blender.org/blender/blender/pulls/110754
2023-08-03 16:13:04 +02:00
Clément Foucault
8e33b20de9 EEVEE-Next: Irradiance Bake: Add validity based dilation
Implement invalid sample points filling. Improves invalid regions
but introduce light leak.

Grid sample points are considered invalid if they have a ratio of
front-face ray hit under the given threshold. This is a post-processing
pass on the baked lighting that fills dark regions produced by
invalid sample location (e.g.: inside walls) with valid neighbor
samples data.

Two new parameters are added:

- Dilation Threshold: Validity threshold under which grid samples are
considered invalid. Invalid samples will gather valid lighting data
from valid neighbors inside the dilation radius.
- Dilation Radius: Radius of the dilation process. Expressed in grid
sample distance.

The validity of each point is progressively refined just like the
lighting data during the baking process.

The dilation process is implemented as a post-processing pass during
the loading of the grid data into the irradiance atlas. This allows
live tweaking the dilation parameters.

Pull Request: https://projects.blender.org/blender/blender/pulls/110386
2023-08-03 15:48:33 +02:00
Clément Foucault
17db856686 EEVEE-Next: Ray-tracing Denoise Pipeline
This is a full rewrite of the raytracing denoise pipeline. It uses the
same principle as before but now uses compute shaders for every stages
and a tile base approach. More aggressive filtering is needed since we
are moving towards having no prefiltered screen radiance buffer. Thus
we introduce a temporal denoise and a bilateral denoise stage to the
denoising. These are optionnal and can be disabled.

Note that this patch does not include any tracing part and only samples
the reflection probes. It is focused on denoising only. Tracing will
come in another PR.

The motivation for this is that having hardware raytracing support
means we can't prefilter the radiance in screen space so we have to
have better denoising. Also this means we can have better surface
appearance with support for other BxDF model than GGX. Also GGX support
is improved.

Technically, the new denoising fixes some implementation mistake the
old pipeline did. It separates all 3 stages (spatial, temporal,
bilateral) and use random sampling for all stages hoping to create
a noisy enough (but still stable) output so that the TAA soaks the
remaining noise. However that's not always the case. Depending on the
nature of the scene, the input can be very high frequency and might
create lots of flickering. That why another solution needs to be found
for the higher roughness material as denoising them becomes expensive
and low quality.

Pull Request: https://projects.blender.org/blender/blender/pulls/110117
2023-08-03 15:32:06 +02:00
Alexander Gavrilov
36c6bcca1a Python API: expose the math mapping vertex positions to B-Bone segments.
Recently a user expressed interest in exporting baked animation
with B-Bone segments. Currently the python API already exposes
segment matrices via a PoseBone method, but there is no access
to the mapping of vertices to the segments.

Although currently the math is simple and easy to re-implement,
forcing Python add-ons to do that would cause a maintenance issue
if the mapping is ever changed later (it's quite dumb, ignoring
the rest pose curve, and there definitely is room for improvement).

This patch extracts the relevant math into a BKE function, and
exposes it in the python API as a new PoseBone method.

Pull Request: https://projects.blender.org/blender/blender/pulls/105419
2023-08-03 14:44:39 +02:00
Christoph Lendenfeld
0d7b0045c6 Animation: Graph Editor curve drawing performance improvement
In current blender, when drawing curves in the Graph Editor,
it always iterates over the whole curve.
From first to last vertex no matter what is shown on screen.
Instead of that, find the bounding keyframes and iterate within them.

Additionally to that, break apart the logic into two sections
* first iterate over keyframes and add `float2` into a `Vector`
* then iterate over all those points and draw them

The second optimization is to make the Bezier resolution
dependent on the keyframe distance in screenspace.
Previously it just went off the distance between keys in frames,
but that doesn't make sense if you are zoomed out.

## Performance Numbers
The following performance numbers are the
average time **per curve** on a mocap file of 6000f (each frame has a key).
The numbers were generated **without** showing keyframes to only focus
on the performance of this patch.
Also they are from a debug build, so they just make sense relative to each other

| - | before | after |
| - | - | - |
| zoomed in | ~1000μs | ~77μs |
| zoomed out | ~1000μs | ~430μs |

This only affects the actual curves.
Keyframe and handle drawing can likely still be improved

Pull Request: https://projects.blender.org/blender/blender/pulls/110301
2023-08-03 14:43:21 +02:00
Clément Foucault
ba444218ac Cleanup: Editors: Remove unused code 2023-08-03 14:23:46 +02:00
Guillermo
5b3398a673 Fix #110161: Crash on dragging a Speaker NLA strip
`NLASTRIP_TYPE_TRANSITION` was being used incorrectly as a flag, having
`NLASTRIP_TYPE_TRANSITION=1` and `NLASTRIP_TYPE_SOUND=3` in the enum
`eNlaStrip_Type`, when evaluating `NLASTRIP_TYPE_SOUND &
NLASTRIP_TYPE_TRANSITION` gives a invalid truish value.

Also `strips` that can't be placed were freed, but no removed from the
`strips list`, this will cause a error if the `strip` is at begin
or end of the list.

Pull Request: https://projects.blender.org/blender/blender/pulls/110605
2023-08-03 14:19:49 +02:00
Christoph Lendenfeld
c4631644ee Fix #108961: Wrong Label and Tooltip for Timeline
The property label on the Timeline for showing only channels
from selected objects was wrong,
indicating it shows only keyframes from selected channels.

This fixes it by using the same label and description as the dope sheet uses.

Pull Request: https://projects.blender.org/blender/blender/pulls/110569
2023-08-03 14:16:08 +02:00