Commit Graph

8191 Commits

Author SHA1 Message Date
Campbell Barton
846f86d1ad Cleanup: spelling in comments 2024-06-06 11:35:00 +10:00
Campbell Barton
d98a7a7756 Merge branch 'blender-v4.2-release' 2024-06-06 10:23:16 +10:00
Campbell Barton
7f7648c6ed Cleanup: spelling in code comments & minor edits
- Use uppercase NOTE: tags.
- Correct bNote -> bNode.
- Use colon after parameters.
- Use doxy-style doc-strings.
2024-06-06 09:55:13 +10:00
Lukas Stockner
5891a73785 Merge branch 'blender-v4.2-release' 2024-06-05 20:25:50 +02:00
Hans Goudey
84c4ddbbb9 Cleanup: GPU: Use references for some vertex buffer functions
Pull Request: https://projects.blender.org/blender/blender/pulls/122784
2024-06-05 18:47:22 +02:00
Clément Foucault
dea5db7e70 Fix: EEVEE-Next: Firefly caused by denoising shiny surfaces
This was caused by float imprecision in the NDF computation when
alpha was very close to 0. The alpha clamping threshold for the
eval function needs to be higher than the one for the sampling
function.

Fix #118997
2024-06-05 18:20:14 +02:00
Hans Goudey
905ceaeacc Merge branch 'blender-v4.2-release' 2024-06-05 10:33:04 -04:00
Hans Goudey
05142b3ea8 Fix #122523: Crash/missing loose edge drawing with two viewports
With two viewports, and one viewport with overlays turned off, one viewport
first requests positions without calculating loose geometry, then the second
viewport can request the loose geometry index buffer. In that case the
previously-calculated positions VBO has the wrong size.

To fix this, always calculate loose geometry when the positions are requested.
That's required because we no simple way of checking whether the previously
uploaded positions included loose geometry. That was the state before recent
refactors in this area anyway.

This makes it clear that the optimization to not calculate loose geometry is
meaningless, because the positions buffer will always be requested at some
point when drawing a mesh.
2024-06-05 10:32:27 -04:00
Lukas Stockner
f436d45cb6 Merge branch 'blender-v4.2-release' 2024-06-05 16:28:11 +02:00
Clément Foucault
8f895ec781 Fix: EEVEE-Next: Wrong sun shadow pixel radius calculation
This fixes a number of issue with the pixel radius calculation.
- Fix factor of 2 being in the wrong place.
- `narrowing` is removed as this is not what we want
  to compute (see comment).
- The `lod_min` is not the actual minimum LOD. Clamp by
  both `clipmap_lod_min` and `clipmap_lod_max`.
2024-06-05 16:17:55 +02:00
Hans Goudey
92bfb754af Cleanup: Use unique_ptr for MeshRenderData
Also slightly simplify the main task graph node creation.

Pull Request: https://projects.blender.org/blender/blender/pulls/122722
2024-06-05 14:20:05 +02:00
Hans Goudey
24055d1837 Cleanup: Remove unused MeshExtract virtual iteration abstraction
Part of #116901.
This has been removed step by step in the previous commits.
2024-06-05 14:20:01 +02:00
Hans Goudey
eb4f3516a6 Mesh: Draw: Replace extractor abstraction for attributes buffers
Part of #116901.
The last extractor removed. This was already written in a data-oriented
manner so only the entry point changes in this commit.
2024-06-05 14:20:01 +02:00
Hans Goudey
deedbee971 Mesh: Draw: Replace extractor abstraction for UV edit index buffers
Part of #116901.
This file contains the creation of four different UV edit index buffers:
triangles, lines, points, and face dots. The main changes are about making
it clearer when faces are skipped. Other than that, changes are faily
extensive but straightfoward. In a few places some parts of existing
loops have been split out and parallelized, but the bulk of the work for
each IBO remains largely single threaded.
2024-06-05 14:20:01 +02:00
Hans Goudey
7292667db6 Mesh: Draw: Replace extractor abstraction for face dots UV edit data buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
01b0096b5e Mesh: Draw: Replace extractor abstraction for edit data buffer
Part of #116901.
Due to the BMesh data format, there is less optimization possible here.
2024-06-05 14:20:01 +02:00
Hans Goudey
5931c82238 Mesh: Draw: Replace extractor abstraction for UV angle stretch buffer
Part of #116901.
The algorithm is complicated and isn't tweaked here.
2024-06-05 14:20:01 +02:00
Hans Goudey
4a852cdaa7 Mesh: Draw: Replace extractor abstraction for UV area stretch buffer
Part of #116901.
Besides the typical changes from past similar refactors, the loops are
now multithreaded.
2024-06-05 14:20:01 +02:00
Hans Goudey
498f4ba284 Mesh: Draw: Replace extractor abstraction for mesh analysis buffer
Part of #116901.
The code was already structured to not use the extractor iterators, so I
only changed the entry point.
2024-06-05 14:20:01 +02:00
Hans Goudey
1adb557806 Mesh: Draw: Replace extractor abstraction for ocro buffer
Part of #116901.
A straightforward change like all the others.
2024-06-05 14:20:01 +02:00
Hans Goudey
0edae45d15 Mesh: Draw: Replace extractor abstraction for sculpt overlay buffer
Part of #116901.
Includes a general standardization of the code, removing constant
checks from hot loops, standardizing naming, tweaking BMesh face
iteration. And includes parallelization too.
2024-06-05 14:20:01 +02:00
Hans Goudey
17a3d065f4 Mesh: Draw: Replace extractor abstraction for skin roots buffer
Part of #116901.
To avoid resizing the buffer, the data is added to a temporary vector
first. That should be fine because the number of roots is expected to
be quite small compared to the size of the mesh.
2024-06-05 14:20:01 +02:00
Hans Goudey
f81cfe392d Mesh: Draw: Replace extractor abstraction for UV maps buffer
Part of #116901.
A straightforward change. I did a few smaller changes to make the
copying similar to elsewhere.
2024-06-05 14:20:01 +02:00
Hans Goudey
7d660ef9d1 Mesh: Draw: Replace extractor abstraction for lines adjacency buffer
Part of #116901.
The algorithm is very complicated to I didn't adjust it. The changes are just
removing the data struct and un-sharing some code to make things a bit
simpler. I also changed the loop to iterate over faces rather than triangles
to avoid the reverse triangle to face lookup. This removes the need to
create the `corner_tri_faces` map, saving 4 bytes per triangle.
2024-06-05 14:20:01 +02:00
Hans Goudey
6178ff6c99 Cleanup: Use vector arguments in mesh draw lines adjacency
Also rename variables to use more standard names.
2024-06-05 14:20:01 +02:00
Hans Goudey
6baaf57343 Cleanup: Use references in mesh draw lines adjacency
Also rename a variable.
2024-06-05 14:20:01 +02:00
Hans Goudey
ba45572f04 Cleanup: Reorder mesh draw function in file
Just to make a future diff smaller and easier to read.
2024-06-05 14:20:01 +02:00
Hans Goudey
405a11fb06 Mesh: Draw: Replace extractor abstraction for paint mask lines buffer
Part of #116901.
A straightfoward change this time; the algorithm wasn't adjusted,
it was just put inside of a single loop. I did change some nested if
statements to continue statements to reduce indentation though.
2024-06-05 14:20:01 +02:00
Hans Goudey
d1049f6082 Mesh: Draw: Replace extractor abstraction for edge factor buffer
Part of #116901.
The BMesh version of the algorithm was parallelized because BMesh has
edge to face topology lookup available.

This also allows removing `GPU_vertbuf_steal_data`, by just generating
the correct data type in the first place. Removing that should help dealing
with improvements to VBO data ownership in the future.
2024-06-05 14:20:01 +02:00
Hans Goudey
18e76b5938 Mesh: Draw: Replace extractor abstraction for face dots UV buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
4d72eac0ab Mesh: Draw: Replace extractor abstraction for face dots position buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
ef91db222e Mesh: Draw: Replace extractor abstraction for face dots index buffer
Part of #116901.
Very similar to 07eac30070.
2024-06-05 14:20:01 +02:00
Hans Goudey
28c41b1d42 Mesh: Draw: Replace extractor abstraction for vertex group buffers
Part of #116901.
For meshes, extract vertex group weights to a temporary vertex-sized
array, then gather them to the final VBO array. This reduces duplicate
work, and eventually the gather step could be done on the GPU too.
2024-06-05 14:20:01 +02:00
Hans Goudey
2f3aacb1ac Mesh: Draw: Replace extractor abstraction for indices buffers
Part of #116901.
Most of these loops were extremely simple, so function call overhead
would have been problematic in the existing code. However, they're
also so simple that they're most likely memory bound, so I wouldn't
expect a large performance change.
2024-06-05 14:20:01 +02:00
Hans Goudey
070ffeea22 Mesh: Draw: Replace extractor abstraction for facedot normals buffer
Part of #116901.
Also allows removing the "extractor overrides" code and deduplicating
the handling of high quality normals with templates.
2024-06-05 14:20:01 +02:00
Hans Goudey
2eaab5bbb0 Mesh: Draw: Replace extractor abstraction for tangents buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
a1b6989ddc Mesh: Draw: Replace extractor abstraction for vertex normals buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
aa81e2dd4a Fix #122455: Wireframe overlay can crash with loose geometry
The `nor` vertex buffer wasn't large enough for the indices in the lines
index buffer. This is undefined behavior at best AFAIK. On some drivers
it caused crashes when there was only loose geometry.

This commit makes the VBO large enough for all indices, filling the loose
geometry normals with (0,0,0,0), which the overlay wireframe shader
already checks for.

Pull Request: https://projects.blender.org/blender/blender/pulls/122720
2024-06-04 17:43:11 +02:00
Clément Foucault
57e92e9192 Fix: Overlay: Facing overlay is not transparent with zero alpha
The recent changes removed the blending when rendering
to the framebuffer. The blending was doing the
premultiplication.

Fix #122470
2024-06-04 17:19:22 +02:00
Clément Foucault
cc0d12dd20 EEVEE: Remove EEVEE-Legacy
This handles the transition to EEVEE-Next (now EEVEE).

This removes some things that make no sense to keep
even for compatibility.
- Scene.eevee.light_cache_data
- Scene Light cache operators
- Scene Light cache RNA properties

The remaining legacy properties will be removed later
on to avoid python API breakage.

We keep the identifier of EEVEE-Next as `BLENDER_EEVEE_NEXT`
to avoid addons being incorrectly silently made compatible
with the EEVEE-Next where the Python API is different.
This renaming should be done in 5.0 release.

Thank you EEVEE-Legacy, you served us well.

Pull Request: https://projects.blender.org/blender/blender/pulls/122433
2024-06-04 14:17:58 +02:00
Jeroen Bakker
31efb29dc4 Workbench: Incorrect padding
The ExtrudedFrustum was incorrectly padded which made the GPU struct to
be larger then the CPU struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/122703
2024-06-04 13:47:44 +02:00
Clément Foucault
6ce4e94eb9 Fix: EEVEE-Next: Shadow acnee during viewport transform
The issue would happened in any situation where the light
moves (update, animation, jitter) or have a lot of LOD
tagged by moving casters. In these cases, the actual
effective LOD min is bigger than the one from the UI which
results in shadow acnee artifacts (because the computed bias
is too small).

This patch saves the effective min LOD per tilemaps and
amend the `light.lod_min` to replace it by the min of
all tilemaps in used by one light.
2024-06-04 12:47:14 +02:00
Vitaljok
3f67abfe3c Fix: EEVEE-Next: Wrong Camera Viewport Render with enabled overscan
Fix for #122285

`Viewport Render Image` feature uses full parameters of the 3D view
to capture the scene.
Rendering `camera view` is a special case: viewport zoom/pan
parameters should be ignored in order to match render.

Pull Request: https://projects.blender.org/blender/blender/pulls/122467
2024-06-03 14:23:55 +02:00
Christoph Lendenfeld
5069d41b18 Fix: GPU issue because of bound depth buffer
This fixes an issue reported when launching Blender with
`--debug-gpu`. The newly added "thick wires" feature for
bone shapes caused that problem.
The issue was that the shader definitions used
the depth tex as a sampler and at the same time wrote to it.

The fix is to remove the code that uses the depth texture.
This is just the simplest solution for now, and it doesn't change
the visual appearance of the bone shapes.

------

Note: the code I copied from was `overlay_edit_mesh_frag.glsl`.
So I assume the depth sampler is needed, but the pipeline
for bone shapes isn't set up to handle that.

Pull Request: https://projects.blender.org/blender/blender/pulls/122558
2024-06-03 14:02:18 +02:00
Hans Goudey
e2402eb4a9 Cleanup: Use C++ types, references for CCGElem access 2024-06-02 20:36:33 -04:00
Hans Goudey
49b52b35d5 Cleanup: Move BKE_ccg.h to C++ 2024-06-02 20:36:33 -04:00
Clément Foucault
46ace12a46 EEVEE-Next: Add base page tagging for punctual shadow
This avoid missing tiles artifacts during tracing or
filtering of shadow maps.

Fixing it for directionnal is a bit more complex and
will be done in another commit.

Fix #121618

Pull Request: https://projects.blender.org/blender/blender/pulls/122597
2024-06-01 17:29:38 +02:00
Hans Goudey
7e5f061851 Fix: Assert in mesh draw edit UV tris extraction
Caused by e916cd5d69.
2024-06-01 11:17:51 -04:00
Clément Foucault
135377a54f Fix: EEVEE-Next: Wrong factor in pdf_to_lod 2024-06-01 15:04:17 +02:00
Clément Foucault
0d7d6b00c9 EEVEE-Next: LightProbe Bake: Add better feedback when allocation fail
- Add a report to explain why allocation fails and display
  the current limit.
- Add heuristic to avoid out of memory issue.
- Remove the delay property that did not do anything
  right now.
- Reduce default clip end by half.

Fix #121916

Pull Request: https://projects.blender.org/blender/blender/pulls/122572
2024-05-31 22:55:05 +02:00