Some modifiers affect sculpting brushes (normals not updating) #114692

Closed
opened 2023-11-10 08:06:53 +01:00 by renderluz · 8 comments

System Information
Operating system: Window11
Graphics card: Gforce 1080

Blender Version
Broken: Blender 4.0.0 Release Candidate
Worked: Blender 3.6.5

Caused by 5af8b839cf

Short description of error
If particular modifiers are present, sculpting normals wont update
Problem is that modifiers of type eModifierTypeType_NonGeometrical will still result in the PBVH being considered pbvh->deformed

Affected modifiers:

  • Geometry Nodes
  • UV Project
  • Smooth by Angle
  • UVWarp
  • VertexWeightEdit
  • VertexWeightMix

Exact steps for others to reproduce the error

  • add a plane with plenty subdivisions (e.g. 50 -- to see normals on sculpting)
  • enter sculptmode
  • sculpt (normals properly updating)
  • add an empty geometry nodes modifier (or any of the above mentioned modifiers)
  • sculpt again (normals dont update properly anymore)

Original report

If I have a cube with the Uv project on in the viewport and I try to sculpt
the brushes behave weirdly like they pull the vertices too much.

Create a cube add a Uv project modifier, remesh it inside the sculpt mode using ctr+r
try to use the scrape brush to flatten an area or the Clay strip, the way they behave should
look odd right away.

**System Information** Operating system: Window11 Graphics card: Gforce 1080 **Blender Version** Broken: Blender 4.0.0 Release Candidate Worked: Blender 3.6.5 Caused by 5af8b839cfc6e3e93869ab6371f2f3c94d35136f **Short description of error** If particular modifiers are present, sculpting normals wont update Problem is that modifiers of type eModifierTypeType_NonGeometrical will still result in the PBVH being considered pbvh->deformed Affected modifiers: - Geometry Nodes - UV Project - Smooth by Angle - UVWarp - VertexWeightEdit - VertexWeightMix **Exact steps for others to reproduce the error** - add a plane with plenty subdivisions (e.g. 50 -- to see normals on sculpting) - enter sculptmode - sculpt (normals properly updating) - add an empty geometry nodes modifier (or any of the above mentioned modifiers) - sculpt again (normals dont update properly anymore) **Original report** If I have a cube with the Uv project on in the viewport and I try to sculpt the brushes behave weirdly like they pull the vertices too much. Create a cube add a Uv project modifier, remesh it inside the sculpt mode using ctr+r try to use the scrape brush to flatten an area or the Clay strip, the way they behave should look odd right away.
renderluz added the
Severity
Normal
Type
Report
Status
Needs Triage
labels 2023-11-10 08:06:54 +01:00
Member

Can confirm, looks like sculpt normals are wrong in this case, will check...

Can confirm, looks like sculpt normals are wrong in this case, will check...
Philipp Oeser added
Status
Confirmed
Module
Sculpt, Paint & Texture
and removed
Status
Needs Triage
labels 2023-11-10 09:27:38 +01:00
Member

Bisecting...

Bisecting...
Philipp Oeser added
Severity
High
and removed
Severity
Normal
labels 2023-11-10 10:58:52 +01:00
Member

Other modifiers also affected:

  • Smooth by Angle
  • UVWarp
  • VertexWeightEdit
  • VertexWeightMix
Other modifiers also affected: - `Smooth by Angle` - `UVWarp` - `VertexWeightEdit` - `VertexWeightMix`
Member

Caused by 5af8b839cf

CC @HooglyBoogly

Caused by 5af8b839cfc6e3e93869ab6371f2f3c94d35136f CC @HooglyBoogly
Philipp Oeser added the
Interest
Modeling
label 2023-11-10 11:41:25 +01:00
Philipp Oeser changed title from UV Project modifier affects sculpting brushes Clay strip and Scrape to Some modifiers affect sculpting brushes Clay strip and Scrape (normals not updating) 2023-11-10 11:42:03 +01:00
Philipp Oeser changed title from Some modifiers affect sculpting brushes Clay strip and Scrape (normals not updating) to Some modifiers affect sculpting brushes (normals not updating) 2023-11-10 11:42:57 +01:00
Member

Problem is that modifiers of type eModifierTypeType_NonGeometrical will still result in the PBVH being considered pbvh->deformed

So stuff like the following is actually true if only such modifiers are present 8which is quite confusing in my opinion)

  • check_sculpt_object_deformed
  • sculpt->deform_modifiers_active
  • BKE_pbvh_is_deformed

Havent dug deeper, but code form 5af8b839cf takes another route for pbvh->deformed than prior (rightfully so), it is just wrong assumptions of what "deformed" can mean.

We could do something like

diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index 4f0f2987419..11d7a39c5d9 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -1628,6 +1628,10 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
       continue;
     }
 
+    if (mti->type == eModifierTypeType_NonGeometrical) {
+      continue;
+    }
+
     if (mti->type == eModifierTypeType_OnlyDeform) {
       return true;
     }

But that in turn results in those modifiers actually being ignored for drawing in sculptmode (BKE_sculptsession_use_pbvh_draw)...

Looks like this could be a bit untangled, not sure wht the short-term solution might be.

Problem is that modifiers of type `eModifierTypeType_NonGeometrical` will still result in the PBVH being considered `pbvh->deformed` So stuff like the following is actually true if only such modifiers are present 8which is quite confusing in my opinion) - `check_sculpt_object_deformed` - `sculpt->deform_modifiers_active` - `BKE_pbvh_is_deformed` Havent dug deeper, but code form 5af8b839cfc6e3e93869ab6371f2f3c94d35136f takes another route for `pbvh->deformed` than prior (rightfully so), it is just wrong assumptions of what "deformed" can mean. We could do something like ```Diff diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 4f0f2987419..11d7a39c5d9 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -1628,6 +1628,10 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) continue; } + if (mti->type == eModifierTypeType_NonGeometrical) { + continue; + } + if (mti->type == eModifierTypeType_OnlyDeform) { return true; } ``` But that in turn results in those modifiers actually being ignored for drawing in sculptmode (`BKE_sculptsession_use_pbvh_draw`)... Looks like this could be a bit untangled, not sure wht the short-term solution might be.
Member

Thanks for the investigation! I think the core of the issue is that sculpt code expects that deform modifiers actually change positions (causing a normals recalculation), but these modifiers don't. If I put BKE_mesh_tag_positions_changed in the UV project modifier, that fixes the issue.

Indeed this is pretty much a huge mess. Though it isn't a massive issue since it just affects drawing in sculpt mode.
It's probably better to detect differences in the pointers of the custom data layers between the original and evaluated object. That can tell for sure if PBVH drawing should be used.

If it helps to guide us to the right solution, the goal should be sculpting on the original positions of these objects, without allocating separate arrays in the PBVH for normals and positions.

Thanks for the investigation! I think the core of the issue is that sculpt code expects that deform modifiers actually change positions (causing a normals recalculation), but these modifiers don't. If I put `BKE_mesh_tag_positions_changed` in the UV project modifier, that fixes the issue. Indeed this is pretty much a huge mess. Though it isn't a massive issue since it just affects drawing in sculpt mode. It's probably better to detect differences in the pointers of the custom data layers between the original and evaluated object. That can tell for sure if PBVH drawing should be used. If it helps to guide us to the right solution, the goal should be sculpting on the original positions of these objects, without allocating separate arrays in the PBVH for normals and positions.
Pratik Borhade added this to the 4.0 milestone 2023-11-14 07:02:45 +01:00
Member

#115433 tells us that Geometry Nodes modifiers are also affected

#115433 tells us that Geometry Nodes modifiers are also affected
Pratik Borhade removed this from the 4.0 milestone 2024-01-11 06:55:21 +01:00

@HooglyBoogly It is not very fair to consider this not a massive issue. Wrong display in sculpt mode is a serious issue for people doing sculpting. While underlying code can be a mess, it is not a reason to ignore huge user level regression.

@HooglyBoogly It is not very fair to consider this not a massive issue. Wrong display in sculpt mode is a serious issue for people doing sculpting. While underlying code can be a mess, it is not a reason to ignore huge user level regression.
Sergey Sharybin self-assigned this 2024-01-11 16:06:50 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-01-11 16:16:50 +01:00
Hans Goudey added
Type
Bug
and removed
Type
Report
labels 2024-01-11 16:51:38 +01:00
Sign in to join this conversation.
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
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#114692
No description provided.