Commit Graph

5168 Commits

Author SHA1 Message Date
Omar Emara
ccab8005f6 Fix #126604: Legacy Cryptomatte doesn't work in GPU
The Legacy Cryptomatte node doesn't work in GPU execution mode if
Precision is set to Auto. That's because the colors picked from the Pick
layer might be in half precision and thus will not match the colors in
the Cryptomatte layers. This is due to the compositor using the
context's precision for Viewer outputs as opposed to the precision of
the image that actually needs to be viewed in the Viewer node.

To fix this, we set the Viewer node precision to be the precision of its
input, that way, the Cryptomatte pick layer will be output in full
precision as intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/128495
2024-10-04 14:25:16 +02:00
Falk David
364d62e59b Fix: GPv3: Solid View: Show vertex colors in Draw and Vertex paint mode
There was a bug where vertex colors were not shown in solid view in
draw or vertex paint mode. The check to use `V3D_SHADING_VERTEX_COLOR`
was outdated and checked the wrong mode flags.

The fix makes sure that we use `V3D_SHADING_VERTEX_COLOR` in
draw and vertex paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/128581
2024-10-04 14:22:17 +02:00
Jeroen Bakker
f1c0e258af Fix #128575: Vulkan: Fix armature drawing NVIDIA
The armature shape drawing was broken on NVIDIA. The reason is that not
all the elements in of the geometry shader out stages are written to. On
NVIDIA platforms this leads to not storing all the output data.

This could be that geometry shader on those plaforms write directly to
the final location in GPU memory. Other platforms might keep the data in
a local registry and copy it to the final location when emitting the
vertex.

Blender 4.4 might not have this issue as overlay next will remove the
need of the geometry shader.

From Khronos GLSL spec:
```
GS code writes all of the output values for a vertex, then calls EmitVertex().
This tells the system to write those output values to where ever it is that
output vertices get written. After calling this function, all output variables
contain undefined values. So you will need to write to them all again before
emitting the next vertex (if there is a next vertex).
```

Pull Request: https://projects.blender.org/blender/blender/pulls/128578
2024-10-04 12:47:42 +02:00
Jeroen Bakker
55c180acc4 Fix #128561: EEVEE: Lightlinking crashes on NVIDIA
On NVIDIA drivers it is not allowed to pass buffers directly from the
interface to a function as the qualifiers do not match. This is commonly
fixed by first storing it in a local variable to remove the qualifiers
and then pass it to the function that need the object.

Pull Request: https://projects.blender.org/blender/blender/pulls/128571
2024-10-04 10:52:53 +02:00
Clément Foucault
f308e42d56 Fix: EEVEE: Volume Lightprobe: Division by zero if no object is visible
If no object with valid bounds can be found,
we simply abort the baking process.

This avoid a division by zero during the view planes
computation.
2024-10-03 19:31:04 +02:00
Chris Clyne
5a27280916 EEVEE: Light & Shadow linking
This adds feature parity with Cycles regarding light and shadow liking.

Technically, this extends the GBuffer header to 32 bits, and uses
the top bits to store the object's light set membership index.
The same index is also added to `ObjectInfo` in place of padding bytes.

For shadow linking, the shadow blocker sets bitmask is stored per
tilemap. It is then used during the GPU culling phase to cull objects
that do not belong to the shadow's sets.

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/127514
2024-10-03 18:41:06 +02:00
Miguel Pozo
3af44f9e76 EEVEE: Improve info messages at render time
Print shadow errors at render time.
Ensure all render errors are printed.
Add render error message in the UI.
Don't print the same error twice.

Pull Request: https://projects.blender.org/blender/blender/pulls/128548
2024-10-03 18:34:46 +02:00
Campbell Barton
0f3fdd25bc Cleanup: various non-functional changes for C++
- Remove redundant parenthesis
- Use strings macros
- NULL -> nullptr
2024-10-02 15:47:05 +10:00
Alaska
6c52e4752f Fix #128113: Incorrect display of facing overlay on transparent textures in solid mode
Use DRW_STATE_DEPTH_EQUAL when we know the correct
depth buffer values are available

Pull Request: https://projects.blender.org/blender/blender/pulls/128163
2024-09-30 14:35:42 +02:00
Laurynas Duburas
71098ce904 Overlay-Next: Add NURBS edit handles
Draws NURBS edit handles in Overlay-Next.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/128093
2024-09-30 14:27:21 +02:00
Laurynas Duburas
e40c9b414a Overlay-Next: Attribute viewer
Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127772
2024-09-30 13:55:05 +02:00
Clément Foucault
a39a966328 Overlay-Next: Fix glitches with the grid
The vertex array was allocating uninitialized memory.
This fixes the API usage mistake and do the
intended reserve call.
2024-09-30 13:05:02 +02:00
Clément Foucault
5c42dd3ae7 Overlay-Next: Fix wrong uniform size error 2024-09-30 13:05:01 +02:00
Jeroen Bakker
ac24912736 Fix #128315: EEVEE: Uneven cryptomatte levels
When using uneven cryptomatte levels the number of cryptomatte layers
weren't sufficient due to rounding error.

Issue should be backported to 4.2

Pull Request: https://projects.blender.org/blender/blender/pulls/128358
2024-09-30 12:04:44 +02:00
Pratik Borhade
7665e28b37 GPv3: Assert in weight paint with zero points
Memory allocated to vertex buffer but the total verts are zero. This
triggers assert in bind function when `vbo_size_` is zero. Exit out of
funtion early to prevent the assert.
Also wrap `DRW_shgroup_call_no_cull` with if check.

Pull Request: https://projects.blender.org/blender/blender/pulls/128248
2024-09-27 17:29:08 +02:00
Falk David
19465bec19 GPv3: Add canvas options to the overlay settings
This adds the color, subdivisions, scale, and offset options to the canvas overlay.

Pull Request: https://projects.blender.org/blender/blender/pulls/128259
2024-09-27 16:58:38 +02:00
Campbell Barton
473bd60164 Cleanup: clarify arguments using const or r_ prefixed return args 2024-09-26 15:03:24 +10:00
Miguel Pozo
2223d995fc Fix: Draw: Bounds usage
The first commit ensures IsectBoxes are not set up unless
they are valid.

The second commit renames
`drw_bounds_are_valid` to `drw_bounds_corners_are_valid`,
and `drw_bounds_culling_enabled` to `drw_bounds_are_valid`
so it's harder to set up an invalid `IsectBox` by mistake.

(Continuation of #127807)

Pull Request: https://projects.blender.org/blender/blender/pulls/128125
2024-09-25 19:58:38 +02:00
Laurynas Duburas
84dedfaf4b Curves: smooth handles
Adds antialiasing to curve's handles and thickness to active ones.
Also handles now react to
 `Preferences > Interface > Display > Resolution Scale` and
`Preferences > Themes > 3D Viewport > Edge Width` as they do in
legacy curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/122910
2024-09-25 15:21:31 +02:00
Lukas Tönne
2459247f9f GPv3: Enable selection operators and overlays in vertex paint mode
Vertex paint mode also supports masking based on selection, so the
selection overlay and relevant operators should also be enabled in that
mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/128114
2024-09-25 12:40:46 +02:00
Campbell Barton
840c65f442 Cleanup: spelling in comments 2024-09-25 19:24:20 +10:00
Lukas Tönne
23cd299ba7 GPv3: Selection support in Sculpt mode
Supporting selection operators and overlays in sculpt mode is necessary
to support masking operations.
This enables selection drawing in the overlay in sculpt mode,
and ensures all the necessary operators (pick, lasso, circle, box)
handle the differences in modes correctly.

The selection code so far was expecting object mode, so the `vc->obedit`
object was used without further checks. Now the selection code can be
called outside of edit mode, in which case the `vc->obact` object must
be used instead. Similarly edit mode and sculpt mode have separate
`selectmode` flags, so the correct mode property must be used from the
tool settings depending on the object mode. These changes require some
refactoring of unrelated selection code.

Pull Request: https://projects.blender.org/blender/blender/pulls/128040
2024-09-24 16:27:06 +02:00
Clément FOUCAULT
3d74be9c5b Fix #126947: EEVEE: Color drifting & darkening at high sample count
The hardware seems to truncate the mantissa instead
of rounding. Doing the rounding manually fixes the issue.

See PR for in depth analysis.

Pull Request: https://projects.blender.org/blender/blender/pulls/127948
2024-09-23 11:30:59 +02:00
Campbell Barton
0707369bb0 Cleanup: prefer ASCII symbols in code-comments 2024-09-21 16:18:40 +10:00
Miguel Pozo
88c84e6a37 Fix #124514: Wrong "slight defocus" DoF
The radius was not used for the sampling offset.

Pull Request: https://projects.blender.org/blender/blender/pulls/127880
2024-09-20 15:22:23 +02:00
Campbell Barton
8485aaf105 Cleanup: correct copyright, SPDX header 2024-09-20 13:14:58 +10:00
Clément Foucault
c92514f1e7 Fix #124567: No Normals pass when combining two shader to RGB
The unlit packing could write to the (non-existing) 4th
closure bin inside the gbuffer header leading to no
combined pass shader being invoked for these specific
(complex) materials.

Making sure the unlit workaround writes to bin 0 fixes the
issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/127811
2024-09-19 14:11:20 +02:00
Clément Foucault
318eab5584 Fix: #126455: Missing refraction with only emissive material
When the opaque layer was populated with only emissive
material, no raytracing was used for it and no feedback
buffer was needed. Thus, the refraction layer had nothing
to raytrace against.

This fixes it by forcing the use of feedback buffer in this
corner case.

Pull Request: https://projects.blender.org/blender/blender/pulls/127771
2024-09-18 12:29:02 +02:00
Miguel Pozo
9c54ddff69 Fix #127590: EEVEE: Wrong background motion vectors
Add the missing view matrix multiplication and use the view forward
vector instead of the incident vector.

Pull Request: https://projects.blender.org/blender/blender/pulls/127718
2024-09-17 19:33:35 +02:00
Campbell Barton
b70925a8cc Cleanup: prefer ASCII characters
Use ASCII quotes, punctuation so strings are easily editable.
2024-09-17 17:28:01 +10:00
Clément Foucault
e90a84469f EEVEE: Simplify barycentric_distances_get
This uses the path that metal was using.

This doesn't seems to create any difference in render
tests. This simplify the backend code and avoid
specific path for metal.

Idea suggested by Kevin Chuang

Pull Request: https://projects.blender.org/blender/blender/pulls/127687
2024-09-16 14:19:53 +02:00
Clément Foucault
019bc5127a Overlay-Next: Xray Outline
Port the outline wire prepass shader to primitive
expansion API and enable it for xray mode.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127657
2024-09-16 11:24:40 +02:00
Clément Foucault
11b07cf309 Overlay-Next: Motion Path
Rel #102179

Fixes discrepancies on Mac.

Pull Request: https://projects.blender.org/blender/blender/pulls/127623
2024-09-16 11:22:54 +02:00
Laurynas Duburas
34f9b7e36c Overlay-Next: grid added to ShapeCache
Substitute for `DRW_cache_grid_get()` added to `overlay::ShapeCache`.

Pull Request: https://projects.blender.org/blender/blender/pulls/127594
2024-09-14 18:22:17 +02:00
Clément FOUCAULT
fc5d3fb998 Overlay-Next: Use unique handle per object
Add a new function to the draw manager to only
issue a unique resource ID per `ObjectRef`.
This avoids the memory overhead of duplicating
the handle for each overlay.

The handle is stored inside the `ObjectRef` on
first query.

Rel #102179
2024-09-14 12:43:39 +02:00
Laurynas Duburas
713ca95121 Fix: Overlay-Next: Grid2D tiles background and boundaries
Fixes Grid2D tiles background and boundaries drawing.

To reproduce  switch to mesh edit mode and in UV editing view overlay
options set `Tiles X` or `Y` to more than 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/127516
2024-09-14 11:14:03 +02:00
Laurynas Duburas
d6778f42d4 Overlay-Next: Origin
Overlay-Next  object centers.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127578
2024-09-13 19:14:17 +02:00
Laurynas Duburas
d37eb7a998 Overlay-Next: Edit text
Overlay-Next version of  Edit text.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127513
2024-09-13 19:04:55 +02:00
Clément FOUCAULT
4e25dfb065 Overlay-Next: Mode Transfer
Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127580
2024-09-13 18:39:28 +02:00
Clément FOUCAULT
ffb5226944 Overlay-Next: Edit Mesh: Weight display
Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127566
2024-09-13 17:01:46 +02:00
Clément FOUCAULT
1d3613e75c Overlay-Next: Particle Edit
Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127518
2024-09-13 17:00:51 +02:00
Clément FOUCAULT
bf01ec1113 Fix: Overlay-Next: Broken Curve display in object mode
Logic was incorrect.
2024-09-13 13:14:28 +02:00
Campbell Barton
81e2ccbf2b Cleanup: spelling in comments 2024-09-13 10:56:26 +10:00
Clément FOUCAULT
c0b1091e5b Overlay-Next: Grease Pencil Edit Mode
Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127317
2024-09-12 17:05:51 +02:00
Clément FOUCAULT
e067bf7cf6 Overlay-Next: Paint Overlay
Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127455
2024-09-12 12:29:09 +02:00
Clément Foucault
b4005b73ba Overlay-Next: UV: Fix facedots affected by object matrix 2024-09-11 18:52:12 +02:00
Clément Foucault
8b66d65c44 Cleanup: Overlay-Next: Remove enum keyword in front of enum types 2024-09-11 18:51:10 +02:00
Clément Foucault
f0742d2a42 Overlay-Next: Fix broken shaders 2024-09-11 18:51:10 +02:00
Clément Foucault
79e7749557 Overlay-Next: Add DebugScope for selection and drawing
Allows to selectively capture between
- selection drawing
or
- viewport drawing.
2024-09-11 18:37:44 +02:00
Clément Foucault
7f559799e1 Overlay-Next: Fix compilation error after merge 2024-09-11 18:37:37 +02:00