Sculpt: Fix #107123: New normals impl. for PBVH_FACES #107456
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#107456
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "temp-pbvh-normals"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This patch rewrites PBVH_FACE's normal update code. The old code worked by calculating normals in loop tris and then adding them to vertices, which were later normalized; unfortunately this is incorrect, the first topological ring surrounding vertices needs to be updated too. This is not possible with the existing code which operates on a list of
PBVHNode
s. We can't add more vertices to the update set without knowing which nodes they belong to.The new code works a bit differently:
pbvh->pmap
, instead of directly propagating normals from loop tris to verts.pbvh->pmap
is now always created, theneed_pmap
(along withneed_mask
) arguments toBKE_sculpt_update_object_for_edit
will be removed in a separate cleanup commit.@ -1446,0 +1417,4 @@
float(*vert_positions)[3] = pbvh->vert_positions;
Vector<int> verts, tris; /* Note: these two vectors can contain duplicates. */
for (int i = 0; i < task_update_verts.size(); i++) {
Same below.
@ -1446,0 +1415,4 @@
/* Don't bother de-duplicating. */
float(*vert_positions)[3] = pbvh->vert_positions;
Vector<int> verts, tris; /* Note: these two vectors can contain duplicates. */
If each vector in
task_update_verts
contain at least one element.Same for
tris
That assumption doesn't really hold, and I don't think using the nodes size as a heuristic really works. You'd have to multiply it by some factor (a percentage of the leaf limit most likely) which would have to be tested across a range of conditions.
This heuristic provides some improvement, but yes, without a real calculation, you can't allocate all the memory. But if it's 100 tasks with 3 verts, you'll be allocating 201, not 300 times.
But yes, this is not some real implementation requirement, but just a weak suggestion, you can close it if you don't think it's really useful
@ -1400,2 +1389,2 @@
{
PBVHUpdateData *data = static_cast<PBVHUpdateData *>(userdata);
task_update_verts.resize(nodes.size());
task_update_tris.resize(nodes.size());
->
@ -1376,3 +1381,1 @@
static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict /*tls*/)
static void pbvh_faces_update_normals(PBVH *pbvh, Span<PBVHNode *> nodes)
const Span<PBVHNode *> nodes
Shouldn't that be
Span<const PBVHNode*>
?The container itself is constant, since you don't change it by value (for example, swap between 2 spans). Its nodes are not contants, so how can you get a
Span<const Node>
from aVector<Node>
? (and you change nodes in code as i can see, not sure why isn't mutable span now)I submitted an alternative fix in #107458, which is more similar to mesh normal calculation and makes more use of the vert -> poly map, and recalculates the entire poly normal at once.
@JosephEagar Since #107458 is merged I think this can be closed right?
Pull request closed