Hans Goudey
5052e0d407
Mesh: Make vertex normal calculation deterministic
...
Currently, atomic additions in vertex normal calculation introduce
non-determinism that can influence the result of other operations,
sometimes causing non-reproduceable renders (in cases like #100250
and #101726 ). This is because the order used during threading when
accumulating face normals changes.
This commit fixes that non-determinism, using a vertex to face topology
map to calculate vertex normals without atomics. When the map is already
available, this can be faster too.
In the longer term future, this method of vertex normal calculation
means it will be easier to do partial recalculations when only part
of a mesh changes. That might be essential for cases like transforming
small selections in a non-BMesh edit mode.
As an experiment I tried a "fast" code path that avoids weighting face
normals by the corresponding corner angle when averaging them to
create vertex normals. This significantly reduces the necessary
computation and memory bandwidth for vertex normal calculation.
The results are shown below too, but it's not part of this PR.
I measured the FPS with two smooth shaded 16 million face grids:
| | Before | After | After (fast) |
| -------------------------------- | ------ | ----- | ------------ |
| Created from scratch every frame | 0.96 | 0.91 | 0.92 |
| Deformed by geometry nodes | 0.99 | 1.32 | 1.40 |
Though many other things besides normals are being tested here,
it's clear that the performance difference isn't that large either way,
though there is an observable regression with meshes created from
scratch, and there is a noticeable improvement when the topology
stays the same and is persistent.
Pull Request: https://projects.blender.org/blender/blender/pulls/111718
2023-11-10 15:19:01 +01:00
..
2023-11-10 15:19:01 +01:00
2023-08-29 14:31:18 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-24 16:33:31 +02:00
2023-05-31 16:19:06 +02:00
2023-05-31 16:19:06 +02:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-09-25 10:56:12 +02:00
2023-09-26 14:17:21 +02:00
2023-08-16 00:20:26 +10:00
2023-09-26 16:38:50 +02:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-09-26 20:30:46 +02:00
2023-09-03 13:37:50 +02:00
2023-09-03 13:37:50 +02:00
2023-09-03 13:37:50 +02:00
2023-09-03 13:37:50 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-11-09 21:33:34 -03:00
2023-05-31 16:19:06 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-05-31 16:19:06 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-07-10 18:12:41 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-10 14:51:40 +03:00
2023-05-31 16:19:06 +02:00
2023-08-16 00:20:26 +10:00
2023-09-25 17:06:04 +10:00
2023-08-24 16:33:31 +02:00
2023-08-16 00:20:26 +10:00
2023-05-31 16:19:06 +02:00
2023-08-30 22:36:36 +02:00
2023-10-30 21:40:35 +01:00
2023-09-08 16:53:30 +10:00
2023-09-19 15:43:56 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-11-02 17:10:59 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-09-06 22:03:16 +10:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-10-30 21:40:35 +01:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-05 13:57:14 +11:00
2023-07-24 22:06:55 +02:00
2023-05-31 16:19:06 +02:00
2023-06-15 22:18:28 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-05-31 16:19:06 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-07-31 13:02:30 +10:00
2023-08-16 00:20:26 +10:00
2023-09-05 11:04:27 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-09-27 14:47:50 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-09-04 18:02:16 +02:00
2023-09-22 12:21:18 +10:00
2023-08-16 00:20:26 +10:00
2023-08-25 09:40:42 +10:00
2023-07-04 17:03:02 +02:00
2023-08-16 00:20:26 +10:00
2023-05-31 16:19:06 +02:00
2023-08-16 00:20:26 +10:00
2023-07-31 13:02:30 +10:00
2023-10-30 21:40:35 +01:00
2023-07-31 13:02:30 +10:00
2023-08-16 00:20:26 +10:00
2023-07-24 22:06:55 +02:00
2023-08-16 00:20:26 +10:00
2023-07-31 13:02:30 +10:00
2023-08-25 09:40:42 +10:00
2023-07-31 13:02:30 +10:00
2023-10-10 16:56:48 +02:00
2023-08-23 16:44:56 +02:00
2023-09-05 11:04:27 +10:00
2023-05-31 16:19:06 +02:00
2023-09-25 18:00:28 +02:00
2023-05-31 16:19:06 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-07-27 16:21:38 +02:00
2023-08-16 00:20:26 +10:00
2023-08-08 17:36:06 +02:00
2023-08-16 00:20:26 +10:00
2023-05-31 16:19:06 +02:00
2023-11-03 09:27:59 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-30 23:41:59 +02:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-11-10 15:19:01 +01:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-03 01:11:28 +02:00
2023-09-27 13:03:29 +10:00
2023-10-30 21:40:35 +01:00
2023-11-07 09:50:51 +01:00
2023-08-16 00:20:26 +10:00
2023-09-22 15:43:59 +02:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-05-31 16:19:06 +02:00
2023-11-09 10:05:24 +01:00
2023-10-20 16:47:41 +02:00
2023-11-09 11:00:58 +01:00
2023-08-16 00:20:26 +10:00
2023-11-09 13:23:41 +01:00
2023-08-18 08:56:12 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-09-22 08:08:19 -04:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-08 17:36:06 +02:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-30 22:36:36 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-31 19:40:39 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-10-30 21:40:35 +01:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-29 17:00:33 +02:00
2023-08-16 00:20:26 +10:00
2023-09-19 11:09:20 +10:00
2023-06-07 14:17:37 +02:00
2023-09-14 13:25:24 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-06-26 13:09:06 +10:00
2023-05-31 16:19:06 +02:00
2023-09-27 11:09:39 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-05-31 16:19:06 +02:00
2023-06-19 12:40:37 +10:00
2023-06-19 12:40:37 +10:00
2023-10-09 23:41:53 +02:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00
2023-08-16 00:20:26 +10:00