Commit Graph

7301 Commits

Author SHA1 Message Date
Miguel Pozo d64e9759ef Fix #114377: Workbench: Support None and Channel Packed alpha modes 2023-11-07 15:51:45 +01:00
Miguel Pozo b4316445a8 EEVEE-Next: Add Max Displacement option
Add a Max Displacement option to Material settings, so frustum culling
can work correctly with vertex displacement.

Pull Request: https://projects.blender.org/blender/blender/pulls/114200
2023-11-07 15:28:07 +01:00
Jeroen Bakker adb2164191 Draw: Add Region Info Debug Group
Adding a deug group for draw manager region info so it is easier
to find inside tools like renderdoc.

Pull Request: https://projects.blender.org/blender/blender/pulls/114578
2023-11-07 14:53:48 +01:00
Hans Goudey 17b875fccf Fix: Windows build error from missing template argument deduction 2023-11-07 11:19:43 +01:00
Hans Goudey ae1b4a6a28 Cleanup: Consolidate draw attribute extraction
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
2023-11-07 10:05:13 +01:00
Campbell Barton 611930e5a8 Cleanup: use std::min/max instead of MIN2/MAX2 macros 2023-11-07 16:33:19 +11:00
Campbell Barton aaf05c2497 Cleanup: various C++ changes (use nullptr, function style casts) 2023-11-07 11:35:16 +11:00
Miguel Pozo 0db6d8a5fc EEVEE-Next: Fix shadow tests
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
2023-11-06 20:35:14 +01:00
Miguel Pozo 6d0b5e2ace EEVEE-Next: New shadow settings
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
2023-11-06 15:45:00 +01:00
Campbell Barton 134393e846 Cleanup: spelling in comments 2023-11-04 14:08:13 +11:00
Miguel Pozo e3d4db5ded Fix: EEVEE-Next: Planar display probe shader compilation 2023-11-03 15:26:19 +01:00
Clément Foucault 60df70b082 EEVEE-Next: Fix empty layers utiltex
This fixes interpolating of invalid data for
very high roughness.
2023-11-03 11:54:18 +01:00
Clément Foucault 0684b68eb4 EEVEE-Next: Make Ambient Occlusion Pass use Horizon Scan
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
2023-11-02 19:22:01 +01:00
Falk David 91db8fc5a0 GPv3: Multi-frame editing
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
2023-11-02 17:10:59 +01:00
Miguel Pozo b679ea939a EEVEE-Next: Per probe viewport display
* 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
2023-11-02 17:08:13 +01:00
Bastien Montagne 40a46629a2 Merge branch 'blender-v4.0-release' 2023-11-02 14:35:56 +01:00
Jeroen Bakker d4262071b1 Fix #114224: Bones Disappear In Pose/Edit Mode
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
2023-11-02 13:36:44 +01:00
Gilberto Rodrigues dfd1b63cc7 UI: improve mesh edge highlighting
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
2023-11-02 22:09:17 +11:00
Campbell Barton 6983c14955 Cleanup: spelling in comments, use doxygen doc-strings 2023-11-02 16:43:04 +11:00
Hans Goudey d6be6339f1 Fix: Incorrect PBVH mask drawing after recent change
The `COMPONENT_LEN_SCALAR` workaround isn't used for
masks which are drawn in a more hard-coded way.
2023-10-31 18:17:26 +01:00
Hans Goudey acbab3550f Merge branch 'blender-v4.0-release' 2023-10-31 18:12:18 +01:00
Hans Goudey e05c36f56d Fix #113496: PBVH draw crashes and unsupported attribute types
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
2023-10-31 17:33:15 +01:00
Nathan Vegdahl 729e29618b Merge branch 'blender-v4.0-release' 2023-10-31 16:07:56 +01:00
Jason Fielder dde346ca9f FIx #114286: Resolve ghosting artifact in workbench in Metal
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
2023-10-31 15:53:32 +01:00
Jeroen Bakker 0d861a93a6 Merge branch 'blender-v4.0-release' 2023-10-31 15:46:16 +01:00
Jeroen Bakker 3da63377fc Fix #114224: Bone Disappear in Pose Mode
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
2023-10-31 15:40:28 +01:00
Brecht Van Lommel 39107b3133 Revert changes from main commits that were merged into blender-v4.0-release
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.
2023-10-30 21:40:35 +01:00
Julian Eisel b659595ab2 Merge remote-tracking branch 'origin/blender-v4.0-release' 2023-10-30 20:26:09 +01:00
Clément Foucault b26f176d1a Fix #114096: Workbench: Broken thumbnail shadows on Mac
This is the same as 5d06632565
but ported to the no-geometry shader version.

However the rendering is still broken for another reason.
See #114286.
2023-10-30 19:46:09 +01:00
Miguel Pozo 2fc17f5afc FIx: Workbench: Shadow debug mode 2023-10-30 19:15:31 +01:00
Jeroen Bakker 5ba661b706 EEVEE-Next: Fix Infinite Loop With Reflection Probe
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
2023-10-30 16:00:17 +01:00
Jeroen Bakker fcb26fe72d EEVEE: Update UI Names
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
2023-10-30 15:04:13 +01:00
Campbell Barton e8d532a9b6 Merge branch 'blender-v4.0-release' 2023-10-29 16:55:22 +11:00
Jason Fielder b0a032e2eb Fix: EEVEE export CMDBuf out of memory in Metal
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
2023-10-27 15:13:49 +02:00
Campbell Barton d31c61edee Cleanup: spelling in comments 2023-10-27 12:13:48 +11:00
Miguel Pozo 247491ef0f Merge branch 'blender-v4.0-release' 2023-10-25 18:58:22 +02:00
Miguel Pozo 5d06632565 Fix #114096: Broken thumbnail shadows 2023-10-25 18:57:41 +02:00
Clément Foucault e1bad49abf Fix #113862: EEVEE-Next: Flicker with AO or shadow pass
This was caused by wrong alpha values.
2023-10-25 12:49:32 +02:00
Jeroen Bakker b0b46b1c59 EEVEE-Next: Fix Updating Reflection Probes
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
2023-10-24 13:43:10 +02:00
Clément Foucault aa917282a7 Fix EEVEE-Next: NaN in refraction
Refraction direct light is not implemented yet.
2023-10-23 17:07:40 +02:00
Clément Foucault 98fcb8573c Fix EEVEE-Next: Raytrace: NaN in bilateral denoising
This was caused by the last frame's tile_mask being
sampled instead of the current one.
2023-10-23 16:14:32 +02:00
Campbell Barton c8c2343b4b Cleanup: spelling in comments 2023-10-23 10:09:05 +11:00
Hans Goudey e52b269283 Cleanup: Use simpler copying with begin iterator and count 2023-10-20 20:07:02 +02:00
Jason Fielder 1b0ddfa6cb GPU: Add explicit API to sync storage buffer back to host
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
2023-10-20 17:04:36 +02:00
Clément Foucault 7b97bc48d8 EEVEE-Next: Rework the material panel
- 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
2023-10-20 16:59:20 +02:00
Hans Goudey 89e3ba4e25 Mesh: Replace auto smooth with node group
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
2023-10-20 16:54:08 +02:00
Clément Foucault 2a725001d1 EEVEE-Next: Material Pipeline Refactor
- 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
2023-10-20 15:52:42 +02:00
Miguel Pozo e24cd6b524 EEVEE-Next: Shadows backface culling
Add optional backface culling for shadows.

Pull Request: https://projects.blender.org/blender/blender/pulls/113969
2023-10-20 15:47:33 +02:00
Clément Foucault 920005ddc0 Fix EEVEE-Next: Missing light specular contribution 2023-10-20 14:08:51 +02:00
Sergey Sharybin 85c557ffa2 Cleanup: Rename BLI_string_utils.h to BLI_string_utils.hh
All users of it are now C++, which opens doors to add C++ to the
public API.
2023-10-20 10:27:26 +02:00
Clément Foucault f79b86553a EEVEE-Next: Add mesh volume bounds estimation
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
2023-10-19 19:22:14 +02:00
Clément Foucault 454c8fd866 Fix EEVEE-Next: Broken volume shadowing from sun lights
Caused by 71dfcf4558
2023-10-19 16:50:57 +02:00
Clément Foucault 439d3ae945 Fix 113839: Eevee Next: Low resolution on local lights shadows
This was caused by the scalling factor not taken into
account during the usage tagging phase.
2023-10-19 15:45:32 +02:00
Hans Goudey fba7671205 Cleanup: Const correctness, unused variable warning in GP draw code 2023-10-19 15:03:32 +02:00
Hans Goudey 5db502a122 Fix: Build error after bounding box refactor
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.
2023-10-19 15:02:15 +02:00
Hans Goudey 1cbd0f5a85 Refactor: Improve access to object data bounds
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
2023-10-19 14:18:40 +02:00
Hans Goudey 40080f618c Sculpt: Use C++ Set to store PBVH Node BMesh elements
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
2023-10-19 14:18:15 +02:00
Falk David 6281d9a039 Fix: GPv3 depth buffer
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
2023-10-19 13:22:38 +02:00
Campbell Barton e7e4e63313 Cleanup: spelling in comments, white-space in comments 2023-10-19 18:53:16 +11:00
Jeroen Bakker 62f721467b Merge branch 'blender-v4.0-release' 2023-10-19 08:03:51 +02:00
Jason Fielder 62219f8da9 Metal: Re-enable workbench NEXT shadows
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
2023-10-19 08:01:17 +02:00
Miguel Pozo fc1ee65104 EEVEE-Next: Skip bake if there's not enough VRAM
* Skip the bake if there's not enough GPU memory to allocate all the
   required resources.
* Print bake messages to the command line.

Pull Request: https://projects.blender.org/blender/blender/pulls/113509
2023-10-18 18:49:21 +02:00
Campbell Barton 6ed3b4a5a6 Cleanup: format, quiet unused argument warning 2023-10-18 22:09:27 +11:00
Hans Goudey e1fd7a8a7b Cleanup: Simplify grease pencil line overlay size counting
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
2023-10-17 18:29:17 +02:00
Falk David 07749b389d GPv3: Convert radius to blender units
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
2023-10-17 17:00:35 +02:00
Miguel Pozo 6f125661e6 GPU: Add Texture::debug_clear
Clear uninitialized textures to NaN/debug values.
Enabled for `--debug-gpu` only.

Pull Request: https://projects.blender.org/blender/blender/pulls/113781
2023-10-17 15:54:09 +02:00
Miguel Pozo 25c2b17266 Merge branch 'blender-v4.0-release' 2023-10-17 15:46:32 +02:00
Miguel Pozo 405a618d88 Cleanup: Workbench: Remove no longer used properties 2023-10-17 15:45:59 +02:00
Hans Goudey 57c27b47b9 Cleanup: Avoid unnecessary check for empty curves
In `CurvesGeometry`, curves should never be empty. We shouldn't have
to check for that in the drawing code.
2023-10-16 19:51:12 +02:00
Hans Goudey 2528b6da9b Cleanup: Use const in grease pencil drawing code 2023-10-16 19:51:12 +02:00
Clément Foucault 5831913204 Fix EEVEE-Next: SubSurfaceScattering: Invalid buffer format
This fixes issues on NVidia GPUs.
2023-10-16 17:17:18 +02:00
Clément Foucault 69e85382cd Fix #113759: EEVEE-Next: NaN artifacts caused by raytracing denoising
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.
2023-10-16 17:17:18 +02:00
Falk David 97c5cb19d1 GPv3: Hide points overlay in stroke selection mode
This makes sure that we only show the point selection if the
selection domain is `ATTR_DOMAIN_POINT`.
2023-10-16 15:12:10 +02:00
casey bianco-davis 0508e81b79 GPv3: Add edit mode lines to overlay
Adds lines in edit mode to the overlay.

Pull Request: https://projects.blender.org/blender/blender/pulls/111596
2023-10-16 13:59:26 +02:00
Miguel Pozo 54511f59aa Merge branch 'blender-v4.0-release' 2023-10-16 13:49:44 +02:00
Miguel Pozo e3014ffc27 Fix #113741: Workbench: Reset TAA on overlay toggle
Reset TAA when enabling overlays,
since we won't have valid sample0 depth textures.
2023-10-16 13:49:12 +02:00
Miguel Pozo 465291e716 Merge branch 'blender-v4.0-release' 2023-10-16 13:25:05 +02:00
Miguel Pozo f2ba12a053 Fix: Workbench: Volume compositing
Regression after fe39456ba5
2023-10-16 13:24:35 +02:00
Clément Foucault ba89723abc Cleanup: EEVEE-Next: Volume AABB
Make interface a bit more lined up with the
rest of the BLI API. Also use more of the
vector API.
2023-10-15 15:07:44 +02:00
Campbell Barton 2e0b844b36 Cleanup: spelling in comments 2023-10-14 13:53:00 +11:00
Clément Foucault 3a998fc461 Fix EEVEE-Next: Linking error cause by closure_to_rgba 2023-10-13 19:25:11 +02:00
Clément Foucault 71835808d3 Fix EEVEE-Next: Inverted world coordinates
Caused by 71dfcf4558
2023-10-13 19:21:08 +02:00
Miguel Pozo 6484274048 Merge branch 'blender-v4.0-release' 2023-10-13 19:19:06 +02:00
Miguel Pozo 9e7a576cee Workbench: Fix: depth_in_front not being copied after the first sample 2023-10-13 19:18:46 +02:00
Clément Foucault 8f49407128 Fix EEVEE-Next: Broken Ambient Occlusion
Caused by 71dfcf4558
2023-10-13 19:07:05 +02:00
Clément Foucault 5b1d5fa82f Cleanup: EEVEE-Next: Remove some TODOs
These just move some code around, cleanup the
syntax and make sure to use appropriate libs.
2023-10-13 18:33:15 +02:00
Clément Foucault ef494b2794 Fix EEVEE-Next: Broken Barycentric on Metal 2023-10-13 18:01:29 +02:00
Clément Foucault 71dfcf4558 EEVEE-Next: Remove common lib usage
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
2023-10-13 17:59:46 +02:00
Harley Acheson f7a8536112 Merge branch 'blender-v4.0-release' 2023-10-13 08:36:19 -07:00
Miguel Pozo 42aa97a080 Fix #113580: Workbench: Always setup in_front_depth_tx
Always setup in-front depth, since Overlays can be updated without causing a Workbench re-sync.
2023-10-13 17:12:40 +02:00
Clément Foucault 51f37be0cd EEVEE-Next: Make renderpass lib mandatory for nodetree evaluation
This is to avoid broken materials if they include a AOV node.
This doesn't mean that it adds render passes resources to
every shader.
2023-10-13 16:23:07 +02:00
Jeroen Bakker a0ef7a7910 Vulkan: Image Editor Drawing
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
2023-10-13 12:54:23 +02:00
Jeroen Bakker 26adfcdb57 Revert "Metal: Re-enable workbench NEXT shadows"
This reverts commit 95f01288b0.
It fails on non-apple platforms.
2023-10-13 11:05:02 +02:00
Jason Fielder 95f01288b0 Metal: Re-enable workbench NEXT shadows
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
2023-10-13 11:02:06 +02:00
Jeroen Bakker 28c4abe57c EEVEE: Fix Fallback Shader Shadow Page Tile Store
`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
2023-10-13 10:42:25 +02:00
Campbell Barton e86fbcd4f0 Merge branch 'blender-v4.0-release' 2023-10-13 10:31:44 +11:00
Campbell Barton fb58aa5900 Cleanup: typos, duplicate words 2023-10-13 10:21:06 +11:00
Falk David 49b21eba11 GPv3: Support crazyspace in selection code
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
2023-10-12 15:42:04 +02:00
Omar Emara 405ec79a0a Fix #112883: GPU compositor crops viewed image
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.
2023-10-12 14:03:12 +03:00
Clément Foucault c8e0a9765e EEVEE-Next: Sphere Probe: Allow evaluation of volume probe
This avoid too dark surfaces if there is no light
in the scene. This prevent energy loss.
2023-10-12 12:50:56 +02:00