Fix #122947: Curve stroke on duplicate object doesn't update normals #124268
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
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#124268
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Sean-Kim/blender:fix-112947"
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?
When a mesh is shared between multiple objects, sculpting with a brush
with the Curve stroke type doesnt update normal values for the affected
nodes when using PBVH drawing. This is because when reevaluating the
depsgraph for the objects, the shared PBVH is destroyed and the nodes
are recalculated, losing the existing node flag updates.
This only occurs for the Curve stroke type because all of its stroke
steps are performed within a single call to the overall operator when
the user presses enter, unlike other brush strokes which apply on each
mouse movement.
To fix this, we simply force update the normals before destroying the
PBVH at the end of the stroke step.
It seems #report ID is wrong..\
Fix #112947: Curve stroke on duplicate object doesn't update normalsto Fix #122947: Curve stroke on duplicate object doesn't update normalsWhoops, you're right. Corrected it now.
This might be the least evil if we want the issue to be fixed in 4.2, but it is still very evil thing to do.Disabling PBVH drawing has performance impact, and doing it based on the user count is not exactly correct: mesh might be referenced by a driver, or an object from an inactive scene.
What I don't really get, is why other brushes works fine, and this does not? Can we make some "missing" update to happen in this operator which handles multiple steps, to mimmic what happens with other brushes more closely?
Yeah, this is the confusing part. The difference is that for the curve stroke type, all the samples are calculated in one execution of the modal operator. Then the PBVH is destroyed and the normal update tags are lost. For non-curve stroke types, each sample happens in its own execution of the modal callback. So it's only the last update tags that are lost.
Long term I think it would be great if we stopped clearing the PBVH for every single reevaluation. We should only do that when the mesh topology actually changes. And we actually track that nowadays, whereas we didn't years ago when this was written. Obviously we wouldn't do that for 4.2, but doing it soonish would be great, especially for things like node tools.
Can we handle pending PBVH node updates before we destroy it?
That might be better. Downside is that we may be recalculating normals unnecessarily before object evaluation where positions may be deformed anyway. But it does feel more sound.
Handling the updates before flushing the mesh seems like a potentially risky change. It's processed inside
draw_sculpt.cc
here so I suppose the suggestion would be to clear it before returning from this method, or elsewhere in the draw code?Adding
pbvh::update_normals
right before the call tosculptsession_free_pbvh
would probably do the trick. It would be worth testing that for multires though, in case the evaluatedSubdivCCG
is somehow cleared before that.@ -1856,2 +1856,4 @@
if (ss && ss->building_vp_handle == false) {
if (!ss->cache && !ss->filter_cache && !ss->expand_cache) {
if (ss->pbvh) {
/* Before destroying the pbvh, flush the updates to the underlying representation to ensure
I'll just pick on this comment a little-- I think it's a little more specific than it needs to be, it could mentioned the code of the problem a little more precisely too. I'd suggest: