Commit Graph

108788 Commits

Author SHA1 Message Date
Campbell Barton
019d3ef939 Cleanup: spelling in comments 2024-04-24 10:48:45 +10:00
Campbell Barton
679e54737f Cleanup: avoid redundant smooth calculation in grid-fill
Meshes without any selected edges had their default smooth state
calculated which involves looping over all edges.
2024-04-24 10:36:05 +10:00
Campbell Barton
75eea50253 Fix operator flag overlap between OP_IS_REPEAT & OP_IS_REPEAT_LAST
Both flags shared the same value, causing repeating a transform action
always recalculate the orientation matrix instead of using the value
from the initial execution. This is most noticeable when repeating a
transform that used a view matrix, where orbiting the view doesn't
use the view orientation from the original transform.
2024-04-24 10:32:23 +10:00
Clément Foucault
ce768d43a1 MTL: Increase log level to errors for missing texture binds
This avoid missing them as they are true user level errors.
2024-04-23 23:08:19 +02:00
Jesse Yurkovich
d208ce84b7 Cleanup: USD curves writer
Cleans up the following issues:
- USD arrays were passed by value instead of references
- UsdGeomBasisCurves and UsdGeomNurbsCurves were potentially sliced when
  assigning to their parent UsdGeomCurves object in a non-polymorphic way
- Make more parameters and functions const
- Align with how Alembic validates the curve_types and cyclic values
- Standarize CurvesGeometry naming like what was done in 5ed9c8c9dd
  (Curves data-block is called "curve_id", CurvesGeometry is called
  "curves")

Pull Request: https://projects.blender.org/blender/blender/pulls/120760
2024-04-23 23:01:46 +02:00
Clément Foucault
5611cafe5e Fix: EEVEE-Next: Different shading in forward pipeline
This was due to using a different normal than the deferred
pipeline for light facing attenuation.

Use the same heuristic as the deferred pipeline for
consistency and smoother look.

Fix #119750
2024-04-23 22:30:05 +02:00
Clément Foucault
71745416b8 EEVEE-Next: UI: Rename material Raytraced Refraction to Transmission
This is more correct as it affects all transmission BSDFs.
2024-04-23 22:17:50 +02:00
Clément Foucault
3e9796c7c3 EEVEE-Next: Light-Probe: Make volume probe display relative
This avoid overlap of data spheres when density changes.
2024-04-23 21:47:31 +02:00
Clément Foucault
0023d850e3 EEVEE-Next: Light-Probe: Make sphere probe display reflective
This was the previous behavior in legacy EEVEE.
2024-04-23 21:32:22 +02:00
Clément Foucault
3799920dc1 EEVEE-Next: Light-Probe: Make sphere probe display size relative
The display is now relative to the size of the probe. This avoid
display being too small or too big after re-sizing.
2024-04-23 21:32:22 +02:00
Jesse Yurkovich
37cc387fcb USD: Correctly write out and read Mesh velocity data
During Export, we were accidentally duplicating the `velocity` attribute
data. Once inside the `write_surface_velocity` function (which was
correct) and again while writing out all "custom" attributes inside
`write_custom_data` (which was incorrect). Fixed by excluding the
"velocity" attribute inside `write_custom_data`.

During Import, we were only loading back in those "custom" primvars so
things happened to work, by accident, but only for USD files produced by
Blender. Now we import just the Velocities attribute which should work
with all files.

This should fully address #96182

Pull Request: https://projects.blender.org/blender/blender/pulls/120771
2024-04-23 20:44:33 +02:00
Clément Foucault
dc20def2f9 Fix: EEVEE-Next: Lightprobe: Avoid division by zero
The normalization factor can divide by zero. Add a small
bias to avoid this. Since the bias is the same on both
the numerator and the denominator, the result converges
to 1 as the denominator reaches zero.

This also adds a `saturate` to avoid lighting being
weirdly increase in some part of the volume probe.

Fix #119799
2024-04-23 20:27:28 +02:00
Brecht Van Lommel
29c3997c28 Fix: Crash reading some particular old blend files 2024-04-23 19:52:20 +02:00
Hans Goudey
7dad324845 Fix: Lite build error after recent commit
Mistake in 0c3763ddda
2024-04-23 13:49:30 -04:00
Charles Wardlaw
60bc34b494 USD: Import and export custom properties
Adding support for converting between Blender custom properties and
USD user-defined custom attributes. Custom attributes on Xforms, many
data types, and materials are all supported for round-tripping.

Please see the USD attributes documentation for more information on
custom attributes.

Properties are exported with a userProperties: namespace for simple
filtering in external apps. This namespace is stripped on import,
but other namespace are allowed to persist.

An "Import Attributes" parameter has been added with options "None" (do
not import attributes), "User" (import attributes in the 'userProperties'
namespace only), "All custom" (import all USD custom attributes, the
default).

An "Export Custom Properties" export option has been added.

The property conversion code handles float, double, string and bool
types, as well as tuples of size 2, 3 and 4. Note that USD quaternions
and arrays of arbitrary length are not yet supported.

There is currently no attempt to set the Blender property subtype based
on the USD type "role" (e.g., specifying Color or XYZ vector subtypes).
This can be addressed in future work.

In addition to exporting custom properties, the original Blender object
and data names are now saved as USD custom string attributes
"userProperties:blender:object_name" and "userProperties:blender:data_name",
respectively, on the corresponding USD prims. This feature is enabled
with the "Author Blender Name" export option.

If a Blender custom string property is named "displayName", it's handled
in a special way on export in that its value is used to set the USD
prim's "displayName" metadata.

Co-authored-by: kiki <charles@skeletalstudios.com>
Co-authored-by: Michael Kowalski <makowalski@nvidia.com>
Co-authored-by: Charles Wardlaw <kattkieru@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/118938
2024-04-23 19:27:40 +02:00
Jacques Lucke
37da07e51a Geometry Nodes: support volume grid sockets in bake node
This adds support for baking volume grids directly without having to
put them into a geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/120981
2024-04-23 18:56:41 +02:00
Sietse Brouwer
7b3e063704 GPv3: Overlay for Weight Paint mode
This PR implements the viewport overlay for Weight Paint mode in GPv3.

In Weight Paint mode the stroke points are colored depending on their
weights in the active vertex group.

Pull Request: https://projects.blender.org/blender/blender/pulls/118273
2024-04-23 18:23:38 +02:00
Falk David
0a4a6ebadc GPv3: Use GPv2 object mode flag for weight painting
This mostly reverts bd22059752
and makes sure to use `OB_MODE_WEIGHT_GPENCIL_LEGACY` instead
of `OB_MODE_WEIGHT_PAINT`.

Pull Request: https://projects.blender.org/blender/blender/pulls/120983
2024-04-23 15:48:27 +02:00
Jeroen Bakker
164fb68386 Vulkan: Render graph direct compute
This PR adds support for compute shaders to render graph. Only direct dispatch
is supported. indirect dispatch will be added in a future PR.

This change enables the next test cases to be supported when using render graphs

- `GPUVulkanTest.push_constants*`
- `GPUVulkanTest.shader_compute_*`
- `GPUVulkanTest.buffer_texture`
- `GPUVulkanTest.specialization_constants_compute`
- `GPUVulkanTest.compute_direct`

```
[==========] 95 tests from 2 test suites ran. (24059 ms total)
[  PASSED  ] 95 tests.
```

Specialization constants are supported when using the render graph. This should conclude
the conversion the prototype of the render graph.

Pull Request: https://projects.blender.org/blender/blender/pulls/120963
2024-04-23 15:43:32 +02:00
Jeroen Bakker
2a1b4bf219 Vulkan: Move push constants to VKShader
VKPipeline class is deprecated and will be phased out in the near future.
This PR moves the push constants to VKShader as it was wrongly placed in the
pipeline.

Pull Request: https://projects.blender.org/blender/blender/pulls/120980
2024-04-23 14:49:41 +02:00
Hans Goudey
0c3763ddda Geometry Nodes: Add SDF grid boolean nodes
Add a simple node to compute the intersection, difference, or union
between SDF grids. This should be the first new use case for the
new volume grid nodes that wasn't possible before.

For naming and multi-inputs, the node uses the same design as the
mesh boolean node. We considered splitting each operation into a
separate node, but though most users considered these different
"modes" of the same operation.

One thing to keep in mind is that it's important for the grids to
have exactly the same transform. If they have different transforms,
the second grid must be resampled to match the first, because the
OpenVDB CSG tools have that requirement. Resampling is expensive
(for SDF grids it means a grid -> mesh -> grid round trip) and should
be avoided.

Pull Request: https://projects.blender.org/blender/blender/pulls/118879
2024-04-23 14:48:59 +02:00
Jeroen Bakker
ee46030a5a Fix #114000: EEVEE-Next: Fade/Facing overlays
The fade and facing overlays use a depth equal test. EEVEE next uses
multiple samples to construct the depth and the depth can be different
than the death-center pixel depth.

This PR uses depth-less tests, but in case of the facing overlays it
can produce some artifacts at sharp edges where the normals bleeds.

Other solution would be to render the depth center depth buffer when
one of these overlays are turned on, but that adds overhead as that
will most likely be redrawn for each draw loop.

Pull Request: https://projects.blender.org/blender/blender/pulls/120976
2024-04-23 14:45:42 +02:00
Christoph Lendenfeld
20a4c9c928 Anim: Implement RNA function on the FCurve to bake keys
This exposes the bake function introduced with #111263
to the RNA of the FCurve.
That makes it a lot easier to use that functionality from python.

Pull Request: https://projects.blender.org/blender/blender/pulls/120783
2024-04-23 13:43:01 +02:00
Jeroen Bakker
9fa6ac6976 GPU: Fix out of bound write when logging system paths
Blender expects that only the filename is provided which is true
for internal shader sources.

Metal shaders can error and return a full path to a system shader.
This doesn't fit inside the reserved memory that Blender reserved
for logging filename and line number.

This out of bound write can be triggered when using `min`
where the parameters aren't of the same kind.
`uint min(uint, int)` for example.

This PR reserves more space to store the filename.

Pull Request: https://projects.blender.org/blender/blender/pulls/120967
2024-04-23 12:50:50 +02:00
Jacques Lucke
cefe1c668d Fix #120970: viewer geometry still visible even if modifier is disabled 2024-04-23 12:43:57 +02:00
Jeroen Bakker
17c84451b9 Vulkan: Pipeline pool
In Vulkan, a Blender shader is organized in multiple
objects. A VkPipeline is the highest level concept and represents
somewhat we call a shader. A pipeline is an device/platform optimized
version of the shader that is uploaded and executed in the GPU device.
A key difference with shaders is that its usage is also compiled
in. When using the same shader with a different blending, a new pipeline
needs to be created.

In the current implementation of the Vulkan backend the pipeline is
re-created when any pipeline parameter changes. This triggers many
pipeline compilations. Especially when common shaders are used in
different parts of the drawing code.

A requirement of our render graph implementation is that changes
of the pipeline can be detected based on the VkPipeline handle.
We only want to rebind the pipeline handle when the handle actually
changes. This improves performance (especially on NVIDIA) devices
where pipeline binds are known to be costly.

The solution of this PR is to add a pipeline pool. This holds all
pipelines and can find an already created pipeline based on pipeline
infos. Only compute pipelines support has been added.

# Future enhancements
- Recent drivers replace `VkShaderModule` with pipeline libraries.
  It improves sharing pipeline stages and reduce pipeline creation times.
- GPUMaterials should be removed from the pipeline pool when they are
  destroyed. Details on this will be more clear when EEVEE support is
  added.

Pull Request: https://projects.blender.org/blender/blender/pulls/120899
2024-04-23 12:39:41 +02:00
Clément Foucault
5b065b4b9d Fix: EEVEE-Next: Missing shadows in reflection probes
This was caused by the tagging pass not using the right
depth texture format.

This commit changes the opaque tagging pass to use the HiZ
buffer instead so that the shader is not relying on the
depth buffer anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/120965
2024-04-23 12:21:04 +02:00
Brecht Van Lommel
05048f8115 Fix: GPv3: Wrong reading of GP drawing ID reference
Datablock pointers are resolved in lib linking stage, not here.

Pull Request: https://projects.blender.org/blender/blender/pulls/120946
2024-04-23 12:11:22 +02:00
Jacques Lucke
5f3ad33f38 Geometry Nodes: decentralize headers for some nodes
`NOD_zone_socket_items.hh` contained code for different nodes. It's better to
split this into headers per node, because that scales better. Also it helps to
keep the code for each individual node more closely together.

Pull Request: https://projects.blender.org/blender/blender/pulls/120945
2024-04-23 11:13:27 +02:00
Campbell Barton
91cf938e40 Fix #120859: Script errors longer jump to the line in the text-editor
Since upgrading to Python 3.11, errors (other than syntax errors)
no longer jumped to the location of the error as they used to.

This was caused by the line number being unset, relying on the
attribute access to return the actual value.

Resolve by using attribute access when the struct member can't be used.
2024-04-23 18:18:49 +10:00
Campbell Barton
07e365fcbf Cleanup: remove unused variable 2024-04-23 18:18:47 +10:00
Christoph Lendenfeld
c30647a6fc Refactor: remove ReportList argument from insert_key
The insert key function in `animrig/keyframing.cc` took a `ReportList`
argument which it used to print messages in case of failures.

Instead this now returns a `CombinedKeyingResult` and the caller is
responsible for creating reports out of that.

To make that simpler the `ID` argument has been changed from a pointer to a reference.
The calling functions now make sure that it's not a `nullptr`.

This has the effect that there will be less messages printed in the Info panel when e.g. inserting keys with a keyingset.
This still doesn't make an error message pop up though.

Related to #119776

Pull Request: https://projects.blender.org/blender/blender/pulls/120784
2024-04-23 10:10:23 +02:00
Campbell Barton
802a45902a Fix flag value overlap EFFECT_POST_BUFFER/EFFECT_NORMAL_BUFFER
These enums used the same value.

---

This looks like an oversight, if it's intentional that both flags share a value it should be noted in code-comments.

Pull Request: https://projects.blender.org/blender/blender/pulls/120961
2024-04-23 09:55:55 +02:00
Omar Emara
614e5ecf7d Fix #120857: Blender crashes for huge compositor images
Blender crashes when the user scales up an image into huge scales. This
is due to integer overflow when doing memory allocations. So we fix this
by using larger integers when doing math on memory allocations and
indexing.

Note that while this solves the random crashes, users scaling up images
to huge scales will face things like the OOM killer activating or at
best significant slow downs due to swapping.

It is not clear how to handle such cases, but something like a global
maximum size option that is set to 16k by default might be worth adding.

Pull Request: https://projects.blender.org/blender/blender/pulls/120921
2024-04-23 09:44:33 +02:00
Jeroen Bakker
191b4fea5b GPU: Better hash for specialization constants
Due to an error in the hash function the specialization constants hash
wasn't optimal. This PR fixes the hash function implementation by replacing
the addition with an xor.

Pull Request: https://projects.blender.org/blender/blender/pulls/120964
2024-04-23 09:44:08 +02:00
Jeroen Bakker
07dd09aa55 Vulkan: Add reset method to resource access info.
Resource access info contains lists in a future setup the resource access info
will be kept in the VKContext and reused. This requires a reset function to
cleanup the instance for reuse.

Pull Request: https://projects.blender.org/blender/blender/pulls/120962
2024-04-23 08:23:12 +02:00
Campbell Barton
edfba89d1e Fix potential buffer read overflow in the splash screen
Since [0], checking if the user preferences exists used an uninitialized
string in the unlikely situation that the users configuration directory
couldn't be found.

[0]: 0c62906a41
2024-04-23 16:09:46 +10:00
Campbell Barton
ce05eb98c9 Cleanup: use const pointer arguments 2024-04-23 16:09:45 +10:00
Campbell Barton
e082049dff Cleanup: use early return, avoids passing uninitialized argument
An uninitialized `msg` string could be passed into ED_area_status_text
however the argument wasn't used when the area was null.

Even though this isn't a bug it relies on the `area` check in the
implementation to ignore the uninitialized argument.

Simplify logic by returning early when area is null.
2024-04-23 15:44:16 +10:00
Campbell Barton
2a2579e69c Cleanup: use const pointers 2024-04-23 15:41:55 +10:00
John Swenson
cff532e134 VSE: Implement Snapping to Markers
This patch adds the ability to snap strips to markers. Previously, there
only existed options to snap to hold offsets and the current frame.

This snap type works identically to other snapping options by checking
for the relevant bit (here `SEQ_SNAP_TO_MARKERS`) and adding the marker
frame numbers to `snap_data->target_snap_points` within
`seq_snap_target_points_build()`.

To enable `seq_get_snap_target_points_count()` to have access to marker
information, the current Scene object is now passed to the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/120450
2024-04-23 01:54:14 +02:00
Clément Foucault
5644a0c621 Fix: EEVEE-Next: Sphere probe disregard the custom parallax checkbox
Fixes #120782
2024-04-22 23:33:08 +02:00
Clément Foucault
8d740b6ea3 Cleanup: DRW: Remove unused legacy function 2024-04-22 23:23:04 +02:00
Clément Foucault
2babe2d678 Fix: EEVEE-Next: Volume objects gets incorrectly culled
Infinite projection matrices do not work with the
current culling pipeline. Since it is expected to have
relatively few volume objects per scene, disabling the
culling for now as fixing it is more involved.

Also only meshes producing fragments will actually
be computed.

Fixes #115595
2024-04-22 23:23:03 +02:00
Clément Foucault
f86135dc6e Fix: EEVEE-Next: GBUffer: Wrong normal layer load
This was because the normal layer code was assuming no missing
closure inside the GBuffer. Now use bin indexing and
fix `gbuffer_read_bin` and `gbuffer_pack`.

Also add test cases for this.

Fixes #120756

Pull Request: https://projects.blender.org/blender/blender/pulls/120779
2024-04-22 21:36:40 +02:00
Hans Goudey
cb639d5d1d Cleanup: Rename "is_mode_active" to "edit_mode_active"
"is_mode_active" doesn't really make sense because some mode
is always active technically. This always referred to edit mode anyway.
2024-04-22 15:31:55 -04:00
Clément Foucault
d44ee7bf11 EEVEE-Next: Make light clamping consistent
This adds clamping at the light combine stage for both direct
and indirect light.

This allows for clamping direct and indirect light separately.
While direct light clamping might not be very desirable in
EEVEE, it might be wanted to reduce the flickering from distant
shiny bumpy surfaces, or for artistic reason.

This happens after applying the BSDF throughput just like cycles.
This is done in order to minimize the performance impact and
allows to split the clamp for direct light and indirect light.

The indirect light clamp value is still used in the ray-tracing
pipeline to clamp the ray intensity. But this differs from cycles
as we clamp the ray without the BSDF throughput here. Sphere probe
have the same issues. Some more energy loss is expected compared
to the direct light clamp.

Note that we still clamp the indirect light after applying BSDF
in case the BSDF is scaling the energy up above the threshold.

This also corrects the clamping for volume that now clamps after
applying the scattering term.

Also adds clamping to volume indirect lighting.

Since we use light probe volumes for both surface and volume
indirect lighting, we need to clamp them at sampling time.

Pull Request: https://projects.blender.org/blender/blender/pulls/120866
2024-04-22 21:19:00 +02:00
Habib Gahbiche
f1d4859e2a Compositor: implement bicubic spline for CPU compositor
Affected nodes:
- Rotate
- Translate
- Stabilize 2D node

Pull Request: https://projects.blender.org/blender/blender/pulls/120886
2024-04-22 20:58:43 +02:00
Jeroen Bakker
3f6e2ea915 Vulkan: Shader interface access mask
When building the resource access used when adding dispatch/draw commands
to the render graph, the access mask is required. This PR stores the
access mask in the shader interface. When binding the resources referenced
by the state manager, the resource access info struct is populated with
the access flags.

In the near future the resource access info will be passed when adding
a dispatch/draw node to the render graph to generate the links.

Pull Request: https://projects.blender.org/blender/blender/pulls/120908
2024-04-22 20:47:30 +02:00
Jacques Lucke
3bddde1b30 Cleanup: update comment regarding blend expand callback 2024-04-22 20:13:06 +02:00