Sculpt mode with Mask modifier enabled result an instant crash #47170

Closed
opened 2016-01-12 18:01:29 +01:00 by Mohammad Eideh · 19 comments

Note, crash is resolved, but normal calculation logic looks like it may not be correct still. (though it doesn't result in visible errors, just extra calculations).


System Information
Win 7 64 bit

Blender Version
Broken: 2.76b official and build c986e93

As the title says; If you add a Mask modifier to a mesh (with a vertex group assigned), then switch to Sculpt mode...Blender will always crash for me. If you disable the modifier, switch to Sculpt mode and then re-enable the modifier...it'll crash once you start sculpting.

Exact steps for others to reproduce the error
mask.blend: Just switch to Sculpt mode .

*Note, crash is resolved, but normal calculation logic looks like it may not be correct still. (though it doesn't result in visible errors, just extra calculations).* ---- **System Information** Win 7 64 bit **Blender Version** Broken: 2.76b official and build c986e93 As the title says; If you add a Mask modifier to a mesh (with a vertex group assigned), then switch to Sculpt mode...Blender will always crash for me. If you disable the modifier, switch to Sculpt mode and then re-enable the modifier...it'll crash once you start sculpting. **Exact steps for others to reproduce the error** [mask.blend](https://archive.blender.org/developer/F273188/mask.blend): Just switch to Sculpt mode .
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @quacker

Added subscriber: @quacker

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Caused by 4d33c37c9e

Caused by 4d33c37c9e

Added subscriber: @mont29

Added subscriber: @mont29

Crash confirmed, will have a look later.

Crash confirmed, will have a look later.
Bastien Montagne self-assigned this 2016-01-12 20:32:16 +01:00

Added subscriber: @Psy-Fi

Added subscriber: @Psy-Fi

Looked into some different fixes.

At first I looked into passing mapping data to BKE_pbvh_update (pass polygon CD_ORIGINDEX and dm->numPolyData), then use this to array to only fill in the subset of faces used in the final CDDM (needs the reverse of the orig-index array). In this report the orig-index data isn't available (although it could be required and made available if it was important).


On further investigation I couldn't see why this call is even necessary, commenting all calls to cdDM_update_normals_from_pbvh, works well on my tests, with this report and with the file from #46726.

@Psy-Fi, any hints on what case this is needed for?


Assuming I missed some test case and this call is needed:

This is a possible fix: P313: only update normals on deform derived meshes since constructive modifiers wont have aligned arrays.


Further issues

  • When testing this report, I noticed you can sculpt onto invisible parts of the mesh (not a new bug, checked 2.71, 2.75 and 2.76 releases).

  • cdDM_update_normals_from_pbvh makes BKE_pbvh_update is running every redraw, where its mostly finding 0 nodes, yet it still runs pbvh_update_normals and allocates vertex array... which is never used (simple to return when totnode == 0, but probably best this bug gets sorted out first).

Looked into some different fixes. At first I looked into passing mapping data to `BKE_pbvh_update` (pass polygon `CD_ORIGINDEX` and `dm->numPolyData`), then use this to array to only fill in the subset of faces used in the final CDDM (needs the reverse of the orig-index array). In this report the orig-index data isn't available (although it could be required and made available if it was important). ---- On further investigation I couldn't see why this call is even necessary, commenting all calls to `cdDM_update_normals_from_pbvh`, works well on my tests, with this report and with the file from #46726. @Psy-Fi, any hints on what case this is needed for? ---- *Assuming I missed some test case and this call is needed:* This is a possible fix: [P313](https://archive.blender.org/developer/P313.txt): only update normals on deform derived meshes since constructive modifiers wont have aligned arrays. ---- Further issues ---- - When testing this report, I noticed you can sculpt onto invisible parts of the mesh *(not a new bug, checked 2.71, 2.75 and 2.76 releases)*. - `cdDM_update_normals_from_pbvh` makes `BKE_pbvh_update` is running every redraw, where its mostly finding 0 nodes, yet it still runs `pbvh_update_normals` and allocates vertex array... which is never used (simple to return when `totnode == 0`, but probably best this bug gets sorted out first).

cdDM_update_normals_from_pbvh makes sure normals are updated even when we don't use optimal drawing from pbvh. It basically flushes the changes from PBVH to the derivedmesh itself. It's mostly useful on non-solid draw mode or when we can't do optimized drawing with PBVH (check can_pbvh_draw function)

cdDM_update_normals_from_pbvh makes sure normals are updated even when we don't use optimal drawing from pbvh. It basically flushes the changes from PBVH to the derivedmesh itself. It's mostly useful on non-solid draw mode or when we can't do optimized drawing with PBVH (check can_pbvh_draw function)

Note - if you comment this out, you'll probably be able to sculpt normally but your normals will be wrong in non-optimal drawing. The change is very subtle, you might miss the error unless you expect it, it should be apparent there. Try GLSL mode it should appear there.

Note - if you comment this out, you'll probably be able to sculpt normally but your normals will be wrong in non-optimal drawing. The change is very subtle, you might miss the error unless you expect it, it should be apparent there. Try GLSL mode it should appear there.

This issue was referenced by 3e0f117ef5

This issue was referenced by 3e0f117ef574e1bbab5793db6cfe3fc8bd0fdce9

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

@Psy-Fi, to fix the crash, committed check that the derived mesh isn't using a constructive modifier (it doesn't make any sense to copy normals between the arrays in that case - its random luck if their aligned or not).

Regarding your last comments, I think I see what you mean in principle, but I still can't see any shading difference with GLSL+Sculpt (matcaps / flat / smooth / with/without autosmooth ...).

When you have a modifier applied, the modifier stack will calculate the derived-mesh normals.

In the file from this report, for example - its calling CDDM_calc_normals_mapping_ex,
in fact with a deform modifier, with and without autosmooth, its calculating normals in sculpt mode, see call stack: P314.

(IIRC auto-smooth normals were meant to be disabled while sculpting).

@Psy-Fi, to fix the crash, committed check that the derived mesh isn't using a constructive modifier *(it doesn't make any sense to copy normals between the arrays in that case - its random luck if their aligned or not)*. Regarding your last comments, I think I see what you mean in principle, but I still can't see any shading difference with GLSL+Sculpt (matcaps / flat / smooth / with/without autosmooth ...). When you have a modifier applied, the modifier stack will calculate the derived-mesh normals. In the file from this report, for example - its calling `CDDM_calc_normals_mapping_ex`, in fact with a deform modifier, with and without autosmooth, its calculating normals in sculpt mode, see call stack: [P314](https://archive.blender.org/developer/P314.txt). *(IIRC auto-smooth normals were meant to be disabled while sculpting).*

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'

Re-opening this report, since there are some unresolved issues with normal calculation, (even though the crash is fixed).

Re-opening this report, since there are some unresolved issues with normal calculation, *(even though the crash is fixed).*
Bastien Montagne removed their assignment 2016-01-14 10:31:29 +01:00
Campbell Barton was assigned by Bastien Montagne 2016-01-14 10:31:29 +01:00

@Psy-Fi, would you be able to show a test-case (simple blend file) that requires cdDM_update_normals_from_pbvh to run?

@Psy-Fi, would you be able to show a test-case (simple blend file) that requires `cdDM_update_normals_from_pbvh` to run?

Added subscriber: @Sergey

Added subscriber: @Sergey

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Remaining confusion should now be fixed in 7776f03.

Remaining confusion should now be fixed in 7776f03.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
EEVEE & Viewport
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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
EEVEE & Viewport
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
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#47170
No description provided.