Use the same attribute conversion class for PBVH and regular
mesh attribute extraction. This makes the GPU formats we use
for each attribute type more explicit and centralizes the conversions
from the attribute types to the GPU types. It's also a bit more aligned
to how we could use implicit sharing for GPU vertex buffer data.
Unfortunately it isn't possible to use this same code for curves
and point clouds because they use textures for their evaluated data,
and 3-wide vectors (e.g. `float3`) aren't supported on GPUs with our
current texture abstraction. For generic attributes, the long term
approach will probably be to use an SSBO instead.
Pull Request: https://projects.blender.org/blender/blender/pulls/114340
Fix an issue in `find_first_valid` where Nvidia would incorrectly
increment `src` after return.
This should fix the issue where some tiles would stay corrupted
until resetting EEVEE.
Initialize tiles_data in `TestAlloc` so it doesn't fail in debug builds.
Pull Request: https://projects.blender.org/blender/blender/pulls/114550
Remove `Material > Shadow Mode` and use `Object > Shadow Ray Visibility`
and `Material > Transparent Shadows` instead.
The versioning system auto-updates objects/materials in EEVEE
scenes so their behavior is as close as possible to the previous one.
Update Cycles to use the native `use_transparent_shadow` property.
Note:
Material changes don't set any `recalc` flag on the objects that use
them, so the EEVEE Next shadow maps don't update when changing
settings/nodes.
Fixing this issue is required for 4.1, but it's out of the scope of this PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/113980
This adds a new way of computing occlusion using visibility bitmask. To
make it more algorithm agnostic, we name it horizon scan.
This cleans-up / simplify the code compared to the Horizon based solution.
There is no more trickery for fading influence of distant samples which
makes the result match cycles closer.
This introduces a new thickness option. Maintaining it relatively low
makes it possible to avoid over occlusion because of in front geometry.
Making it too low will cause under occlusion.
Related #112979
Pull Request: https://projects.blender.org/blender/blender/pulls/114150
Adds a new scene tool setting `use_grease_pencil_multi_frame_editing`.
The `foreach_*_drawing` functions are moved to the `ed::greasepencil` namespace in the editor, since they are now context sensitive and depend on the toolsetting. They are now named `retrieve_editable_drawings` and `retrieve_visible_drawings` and return
an array of drawings instead of calling a callback function.
Pull Request: https://projects.blender.org/blender/blender/pulls/114283
* Add viewport display support for Sphere and Plane probes.
* Make all probe display options per object instead of per scene.
(Uses the already existing `LIGHTPROBE_FLAG_SHOW_DATA`
and adds a new `data_display_size ` property to the `LightProbe` DNA)
* Python `show_data` property has been deprecated and renamed to
`use_data_display` (`data_display_size ` has been exposed as well).
Pull Request: https://projects.blender.org/blender/blender/pulls/114176
Previous fix partially fixed the issue, there were still some left over
issues where that alpha channel wasn't loaded correctly and therefore
could lead to fully transparent stick bones.
Previous fix: 3da63377fc
Pull Request: https://projects.blender.org/blender/blender/pulls/114393
Changes to edit mode mesh overlays, use hue shift instead of color
fading/darkening for selection mode visual differentiation, and some
theme changes to improve the display of mesh edges and faces with good
selection visibility.
- Removed "edge" toggle from edit mode overlays panel.
- No longer halves the edge and face alpha depending on selection mode.
Half the face alpha in wire-frame mode. For better visibility on most
themes.
Ref !111431
Use more modern approaches for supporting all generic attribute types,
rather than hardcoding all of the types and mistakenly correlating types
and domains.
A "Converter" template class handles conversion to GPU data and
describing the GPU format. The class is based on recent work in Cycles
attribute upload and is meant to replace the `AttributeTypeConverter`
class in `extract_vbo_attributes.cc`. I will do that as a separate step.
This structure will give build errors if new attribute types are added
but not supported here, preventing the situation described in the
report.
All generic attribute types are supported now, consistently with non
sculpt mode drawing. The edge domain isn't supported though.
Typically edges are more costly and complex to access, and interpolation
is less well defined anyway.
Pull Request: https://projects.blender.org/blender/blender/pulls/114334
Missing GPU flush added between workbench render frames
to ensure GPU command buffer does not submit all frames
in one go.
Authored by Apple: Michael Parkin-White
Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/114328
In certain cases bones can disappear in pose mode. The cause was
that the alpha channel was not set in all cases and might use uninitialized
memory as alpha value.
Pull Request: https://projects.blender.org/blender/blender/pulls/114324
The last good commit was 8474716abb.
After this commits from main were pushed to blender-v4.0-release. These are
being reverted.
Commits a4880576dc from to b26f176d1a that happend afterwards were meant for
4.0, and their contents is preserved.
When a spherical reflection probe is in the scene and the viewport
is set to a lookdev world the scene was constantly being updated.
The cause for this was that the reflection probes where updated when
the lookdev shader was compiled, but that is almost always the case.
This PR fixes this by checking the compile status and compile status
change. Only the first time the world has been compiled the world
reflection probe will be marked dirty.
Pull Request: https://projects.blender.org/blender/blender/pulls/114276
This PR will use "EEVEE (Legacy)" for the legacy EEVEE and renames
"EEVEE Next" to "EEVEE".
When starting Blender EEVEE Legacy will still be the default. We
will change the default to EEVEE when all missing features have been
addressed.
After that we can cleanup idnames and panels etc.
Pull Request: https://projects.blender.org/blender/blender/pulls/114272
Previous commit 9333336a73f9e116771a52a2caa96455ea345c71
broke export rendering in Metal due to the command
submission not being flushed between samples.
This would lead to ghosting in export images due
to memory synchronization issues and GPU
scheduling dependency graph problems.
The in-flight memory could also get
extremely high if exporting high numbers
of samples due to all commands being
enqueued within a single submission.
Patch resolves this by flushing for
each render frame sample and
ensuring intermediate in-flight
memory remains controlled.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/114174
Due to missing logic reflection probe updates where not always
performed. There were multiple artifacts:
* Lookdev Worlds where Black Until the Scene world was rendered.
Issue was that the lookdev world didn't initialized its atlas
coordinates.
* Lookdev world should only retrigger reflection probe update when
material is compiled
* When world is updated, reflection probes should be updated; this
might require a redraw when reflection probe draw passes aren't
updated this sample.
Pull Request: https://projects.blender.org/blender/blender/pulls/114064
PR Introduces GPU_storagebuf_sync_to_host as an explicit routine to
flush GPU-resident storage buffer memory back to the host within the
GPU command stream.
The previous implmentation relied on implicit synchronization of
resources using OpenGL barriers which does not match the
paradigm of explicit APIs, where indiviaul resources may need
to be tracked.
This patch ensures GPU_storagebuf_read can be called without
stalling the GPU pipeline while work finishes executing. There are
two possible use cases:
1) If GPU_storagebuf_read is called AFTER an explicit call to
GPU_storagebuf_sync_to_host, the read will be synchronized.
If the dependent work is still executing on the GPU, the host
will stall until GPU work has completed and results are available.
2) If GPU_storagebuf_read is called WITHOUT an explicit call to
GPU_storagebuf_sync_to_host, the read will be asynchronous
and whatever memory is visible to the host at that time will be used.
(This is the same as assuming a sync event has already been signalled.)
This patch also addresses a gap in the Metal implementation where
there was missing read support for GPU-only storage buffers.
This routine now uses a staging buffer to copy results if no
host-visible buffer was available.
Reading from a GPU-only storage buffer will always stall
the host, as it is not possible to pre-flush results, as no
host-resident buffer is available.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/113456
- Adds the missing new RNA definitions
- Split settings panel into surface and volume
- Expose displacement and volume nodetree panels
- Rename `Cull Backfaces` to `Backface Culling`
for consistency
- Rename `use_backface_culling_probe` to
`lightprobe_volume_single_sided` for accuracy
and avoiding confusion as it is not a real
backface culling.
- Rename `Screen Space Refraction` to
`Raytrace Refraction` for accuracy.
Motivation is to make it closer to cycles now
that EEVEE is compatible with more features.
Pull Request: https://projects.blender.org/blender/blender/pulls/113971
Design task: #93551
This PR replaces the auto smooth option with a geometry nodes modifier
that sets the sharp edge attribute. This solves a fair number of long-
standing problems related to auto smooth, simplifies the process of
normal computation, and allows Blender to automatically choose between
face, vertex, and face corner normals based on the sharp edge and face
attributes.
Versioning adds a geometry node group to objects with meshes that had
auto-smooth enabled. The modifier can be applied, which also improves
performance.
Auto smooth is now unnecessary to get a combination of sharp and smooth
edges. In general workflows are changed a bit. Separate procedural and
destructive workflows are available. Custom normals can be used
immediately without turning on the removed auto smooth option.
**Procedural**
The node group asset "Smooth by Angle" is the main way to set sharp
normals based on the edge angle. It can be accessed directly in the add
modifier menu. Of course the modifier can be reordered, muted, or
applied like any other, or changed internally like any geometry nodes
modifier.
**Destructive**
Often the sharp edges don't need to be dynamic. This can give better
performance since edge angles don't need to be recalculated. In edit
mode the two operators "Select Sharp Edges" and "Mark Sharp" can be
used. In other modes, the "Shade Smooth by Angle" controls the edge
sharpness directly.
### Breaking API Changes
- `use_auto_smooth` is removed. Face corner normals are now used
automatically if there are mixed smooth vs. not smooth tags. Meshes
now always use custom normals if they exist.
- In Cycles, the lack of the separate auto smooth state makes normals look
triangulated when all faces are shaded smooth.
- `auto_smooth_angle` is removed. Replaced by a modifier (or operator)
controlling the sharp edge attribute. This means the mesh itself
(without an object) doesn't know anything about automatically smoothing
by angle anymore.
- `create_normals_split`, `calc_normals_split`, and `free_normals_split`
are removed, and are replaced by the simpler `Mesh.corner_normals`
collection property. Since it gives access to the normals cache, it
is automatically updated when relevant data changes.
Addons are updated here: https://projects.blender.org/blender/blender-addons/pulls/104609
### Tests
- `geo_node_curves_test_deform_curves_on_surface` has slightly different
results because face corner normals are used instead of interpolated
vertex normals.
- `bf_wavefront_obj_tests` has different export results for one file
which mixed sharp and smooth faces without turning on auto smooth.
- `cycles_mesh_cpu` has one object which is completely flat shaded.
Previously every edge was split before rendering, now it looks triangulated.
Pull Request: https://projects.blender.org/blender/blender/pulls/108014
- Add mandatory forward opaque prepass for any opaque region
- Rename the "Show Backface" pass as `MAT_PIPE_PREPASS_OVERLAP`
- Replace Blend mode by Surface Render Method
- Add do versioning for `surface_render_method`
- Rename the Prepass pipe enum for consistency as they share
the same depth shader
- Makes sure all object types subscribe to all passes
This does not change the UI yet.
Pull Request: https://projects.blender.org/blender/blender/pulls/113968
This adds correct object bounds estimation.
This works by creating an occupancy texture where one
bit represents one froxel. A geometry pre-pass fill this
occupancy texture and doesn't do any shading. Each bit
set to 0 will not be considered occupied by the object
volume and will discard the material compute shader for
this froxel.
There is 2 method of computing the occupancy map:
- Atomic XOR: For each fragment we compute the amount of
froxels **center** in-front of it. We then convert that
into occupancy bitmask that we apply to the occupancy
texture using `imageAtomicXor`. This is straight forward
and works well for any manifold geometry.
- Hit List: For each fragment we write the fragment depth
in a list (contained in one array texture). This list
is then processed by a fullscreen pass (see
`eevee_occupancy_convert_frag.glsl`) that sorts and
converts all the hits to the occupancy bits. This
emulate Cycles behavior by considering only back-face
hits as exit events and front-face hits as entry events.
The result stores it to the occupancy texture using
bit-wise `OR` operation to compose it with other non-hit
list objects. This also decouple the hit-list evaluation
complexity from the material evaluation shader.
## Limitations
### Fast
- Non-manifolds geometry objects are rendered incorrectly.
- Non-manifolds geometry objects will affect other objects
in front of them.
### Accurate
- Limited to 16 hits per layer for now.
- Non-manifolds geometry objects will affect other objects
in front of them.
Pull Request: https://projects.blender.org/blender/blender/pulls/113731
This function was changed in main after the buildbot built the PR.
Since we are just interested in grease pencil data here, just retrieve
the bounds from the geometry directly.
Currently object bounds (`object.runtime.bb`) are lazily initialized
when accessed. This access happens from arbitrary threads, and
is unprotected by a mutex. This can cause access to stale data at
best, and crashes at worst. Eager calculation is meant to keep this
working, but it's fragile.
Since e8f4010611, geometry bounds are cached in the geometry
itself, which makes this object-level cache redundant. So, it's clearer
to build the `BoundBox` from those cached bounds and return it by
value, without interacting with the object's cached bounding box.
The code change is is mostly a move from `const BoundBox *` to
`std::optional<BoundBox>`. This is only one step of a larger change
described in #96968. Followup steps would include switching to
a simpler and smaller `Bounds` type, removing redundant object-
level access, and eventually removing `object.runtime.bb`.
Access of bounds from the object for mesh, curves, and point cloud
objects should now be thread-safe. Other object types still lazily
initialize the object `BoundBox` cache since they don't have
a data-level cache.
Pull Request: https://projects.blender.org/blender/blender/pulls/113465
Mainly to simplify code and also add some add type safety, replace
`GSet` with `blender::Set` for the storage of BMesh triangles and
vertices on each PBVH node. Some initial tests point to better
performance too, but the numbers are hard to verify so far.
Because of the larger `PBVHNode`, memory usage slightly increases
(observed a 2% increase with a 1M face grid) for regular Mesh sculpting,
but it seems `Set` is more memory efficient than `GSet`, because I also
observed a 10% decrease in memory usage for dynamic topology.
In the future nodes can be split in a more data-oriented fashion to
reduce memory usage overall.
This also makes it simpler to switch to another type in the future.
Pull Request: https://projects.blender.org/blender/blender/pulls/113907
Resolves#113422.
The depth buffer was rendered to, but not correctly merged
with the scene depth buffer. This lead to, e.g. the object appearing
behind the grid.
This fixes the issue by rendering a "merge" pass.
Pull Request: https://projects.blender.org/blender/blender/pulls/113779
With the shift to GPU-driven rendering pipeline,
the SSBO vertex fetch paradigm used to
implement workbench shadows on Metal
instead of utilising the geometry shader
path no longer worked correctly.
This is because the draw submission
required vertex amplification up-front,
based on the expected output geometry
amount for a given input geometry.
This patch aims to resolve this
issue through addition of API to
enable the features within the
GPU driven pipeline.
Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113498
Avoid the need to iterate over every curve, and only iterate over the
cyclic attribute if it exists. This removes the check that avoided
creating cyclic segments for curves with only two points. If that
was necessary, some of the complexity would return, but the
new `array_utils` function wouldn't be necessary.
Pull Request: https://projects.blender.org/blender/blender/pulls/113814
Previously, Grease Pencil used a radius convention where
1 "px" = 0.001 units. This "px" was the brush size which would be
stored in the stroke thickness and then scaled by the point pressure
factor. Finally, the render engine would divide this thickness value by
2000 (we're going from a thickness to a radius, hence the factor of
two) to convert back into blender units.
Store the radius now directly in blender units. This makes it
consistent with how hair curves handle the radius.
* Removes the scaling in the render engine.
* Makes sure the grease pencil primitives use the correct radii
* Changes the drawing tool to work with screen space radius
* Draws the drawing tool cursor in screen space
* Makes sure the scaling is done when converting from legacy
grease pencil objects
* Makes sure the scaling is done when loading previous files
Consequences for the draw tool:
* Since the tool has a radius input in pixels, it now works in screen space. This is a pretty big change to how it works by default before, so a new option will have to be added that allows the brush to be in "Scene" space. This is similar to how it works in sculpt mode. But this is a bigger change, so I would like to split that into a separate PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/113770
This was caused by spatial denoising pass sampling invalid data.
This patch make it so that there is one padding tile all
around the denoise area.
This simplifies the denoise shader too.
This is a bit wasteful to dispatch tracing tiles for clearing
and a better solution would be to use a separate shader and
tile list only for this purpose.
Replaces all usage by the the gpu_shader_math
equivalent. This is because the old shader
library was quite tangled.
This avoids dependency hell trying to
mix libraries.
Changes are split into isolated commits until
I had to do mass changes because of inter-
dependencies.
Pull Request: https://projects.blender.org/blender/blender/pulls/113631
When drawing the image editor the depth of the geometry is set to -1.
This will be clipped in Vulkan, but is valid in OpenGL. This PR patches
the shader to be inside the range that both Vulkan and OpenGL support.
This ensures that images are visible in the image editor.
Pull Request: https://projects.blender.org/blender/blender/pulls/113668
With the shift to GPU-driven rendering pipeline,
the SSBO vertex fetch paradigm used to
implement workbench shadows on Metal
instead of utilising the geometry shader
path no longer worked correctly.
This is because the draw submission
required vertex amplification up-front,
based on the expected output geometry
amount for a given input geometry.
This WIP patch aims to resolve this
issue through addition of API to
enable the features within the
GPU driven pipeline.
Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113498
`eevee_shadow_page_tile_store` shader uses `VIEWPORT_INDEX` and `LAYER`.
Both use an optional extension in OpenGL and Vulkan. When the extension
isn't available a geometry shader is injected to emulate the
extension. The generated geometry shader requires `instance_name` to be
set. This wasn't the case for `eevee_shadow_page_tile_store` shader.
This PR also adds a detection for incompatible shader infos.
- Shaders that use `VIEWPORT_INDEX` or `LAYER` cannot have a geometry stage.
This check is done in debug and release builds.
- Shaders that use a fallback shader should have instance names set in
the stage interfaces. This check is only done in debug builds.
Pull Request: https://projects.blender.org/blender/blender/pulls/113649
This adds `GreasePencilEditHints` and correctly implements
`crazyspace::get_evaluated_grease_pencil_drawing_deformation`
to support querying the deformation of points after evaluation.
This is needed for users to properly select points in edit mode while
seeing the effects of the modifiers.
Pull Request: https://projects.blender.org/blender/blender/pulls/113586
The GPU compositor crops the viewed images to the render resolution.
While the original size and content of the input to the viewer should be
retained as is.
This patch fixes that by specializing compositors that can use composite
outputs to be able to view images of any arbitrary size. This is still
missing the translation offset of the viewer, but this shall be tackled
separately.