Inclusive bounds for VertexWeightEdit? #82831

Closed
opened 2020-11-19 01:23:34 +01:00 by Will · 17 comments

System Information
Operating system: Linux
Graphics card: Intel UHD

Blender Version
Broken: 2.90.1
Worked: ???

Short description of error

The "Group Add" "Threshold" for the VertexWeightEdit modifier seems to be interpreted as an exclusive bound. This may be a deliberate design choice, but it makes it impossible to assign default weights of zero:

image.png

image.png

Exact steps for others to reproduce the error
When dealing with output from generative modifiers or meshes linked from library .blend files, it's useful for me to be able to non-destructively assign a default vertex weight of 0.0 to all vertices so I can then use VertexWeightMix modifiers to add textures to the weights, combine multiple vertex groups, etc.

What I was trying to say was that the VertexWeightEdit modifier has a "Group Add" functionality for setting all weights above a threshold, but it doesn't do anything for weights that are exactly equal to that threshold:

image.png
image.png

This kinda makes sense, but it also makes it impossible to e.g. assign weights of 0.0, or only weights of exactly 1.0.

Blend file below. The threshold is 0.010, so set the "Default Weight" to 0.010 and 0.011 to see what I mean.

VertexWeightEdit_Bounds.blend

Maybe this file makes it a bit clearer:

  • I have added a second vertexgroup and a VertexWeightMix modifier after the VertexWeightEdit modifier
  • none of the vertices are in the first group per se
  • the VertexWeightEdit modifier tries to add all vertices to the group with a value of 0.0 (to be able to be used by the following VertexWeightMix modifier), but "fails" due to the exclusive bounds

VertexWeightEdit_Bounds_repro.blend

**System Information** Operating system: Linux Graphics card: Intel UHD **Blender Version** Broken: 2.90.1 Worked: ??? **Short description of error** The "Group Add" "Threshold" for the VertexWeightEdit modifier seems to be interpreted as an exclusive bound. This may be a deliberate design choice, but it makes it impossible to assign default weights of zero: ![image.png](https://archive.blender.org/developer/F9320317/image.png) ![image.png](https://archive.blender.org/developer/F9320319/image.png) **Exact steps for others to reproduce the error** When dealing with output from generative modifiers or meshes linked from library .blend files, it's useful for me to be able to non-destructively assign a default vertex weight of 0.0 to all vertices so I can then use VertexWeightMix modifiers to add textures to the weights, combine multiple vertex groups, etc. What I was trying to say was that the VertexWeightEdit modifier has a "Group Add" functionality for setting all weights above a threshold, but it doesn't do anything for weights that are exactly equal to that threshold: ![image.png](https://archive.blender.org/developer/F9341342/image.png) ![image.png](https://archive.blender.org/developer/F9341344/image.png) This kinda makes sense, but it also makes it impossible to e.g. assign weights of 0.0, or only weights of exactly 1.0. Blend file below. The threshold is 0.010, so set the "Default Weight" to 0.010 and 0.011 to see what I mean. [VertexWeightEdit_Bounds.blend](https://archive.blender.org/developer/F9341371/VertexWeightEdit_Bounds.blend) Maybe this file makes it a bit clearer: - I have added a second vertexgroup and a `VertexWeightMix` modifier after the `VertexWeightEdit` modifier - none of the vertices are in the first group per se - the `VertexWeightEdit` modifier tries to add all vertices to the group with a value of 0.0 (to be able to be used by the following `VertexWeightMix` modifier), but "fails" due to the exclusive bounds [VertexWeightEdit_Bounds_repro.blend](https://archive.blender.org/developer/F9791525/VertexWeightEdit_Bounds_repro.blend)
Author

Added subscriber: @WCN

Added subscriber: @WCN
Author

I just realized my screenshots don't actually prove anything, as zero weights would be rendered black anyway. But the behaviour I described does occur AFAICT, and the test I did produces the same result with non-zero thresholds and default weights.

I just realized my screenshots don't actually prove anything, as zero weights would be rendered black anyway. But the behaviour I described does occur AFAICT, and the test I did produces the same result with non-zero thresholds and default weights.

Added subscriber: @mano-wii

Added subscriber: @mano-wii

I'm not sure what I'm seeing in the image.
Can you share the file so we can analyze it?

I'm not sure what I'm seeing in the image. Can you share the file so we can analyze it?

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Author

@mano-wii Hey, sorry for being unclear.

What I was trying to say was that the VertexWeightEdit modifier has a "Group Add" functionality for setting all weights above a threshold, but it doesn't do anything for weights that are exactly equal to that threshold:

image.png
image.png

This kinda makes sense, but it also makes it impossible to e.g. assign weights of 0.0, or only weights of exactly 1.0.

Blend file below. The threshold is 0.010, so set the "Default Weight" to 0.010 and 0.011 to see what I mean.

VertexWeightEdit_Bounds.blend

@mano-wii Hey, sorry for being unclear. What I was trying to say was that the VertexWeightEdit modifier has a "Group Add" functionality for setting all weights above a threshold, but it doesn't do anything for weights that are exactly equal to that threshold: ![image.png](https://archive.blender.org/developer/F9341342/image.png) ![image.png](https://archive.blender.org/developer/F9341344/image.png) This kinda makes sense, but it also makes it impossible to e.g. assign weights of 0.0, or only weights of exactly 1.0. Blend file below. The threshold is 0.010, so set the "Default Weight" to 0.010 and 0.011 to see what I mean. [VertexWeightEdit_Bounds.blend](https://archive.blender.org/developer/F9341371/VertexWeightEdit_Bounds.blend)

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Added subscriber: @iss

Added subscriber: @iss

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

I can confirm this is the case, but I am not sure why you need this. Though I have not so much experience in this area.
Can you explain how this is problem in workflow?

I can confirm this is the case, but I am not sure why you need this. Though I have not so much experience in this area. Can you explain how this is problem in workflow?
Author

@iss When dealing with output from generative modifiers or meshes linked from library .blend files, it's useful for me to be able to non-destructively assign a default vertex weight of 0.0 to all vertices so I can then use VertexWeightMix modifiers to add textures to the weights, combine multiple vertex groups, etc.

@iss When dealing with output from generative modifiers or meshes linked from library `.blend` files, it's useful for me to be able to non-destructively assign a default vertex weight of 0.0 to all vertices so I can then use VertexWeightMix modifiers to add textures to the weights, combine multiple vertex groups, etc.
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

I think I get the point.
So for vertices not in the group, it is impossible to add them with a default value of 0.0.

Maybe this file makes it a bit clearer:

  • I have added a second vertexgroup and a VertexWeightMix modifier after the VertexWeightEdit modifier
  • none of the vertices are in the first group per se
  • the VertexWeightEdit modifier tries to add all vertices to the group with a value of 0.0 (to be able to be used by the following VertexWeightMix modifier), but "fails" due to the exclusive bounds

VertexWeightEdit_Bounds_repro.blend

This patch changes it to be inclusive bounds

P1959: T82831_snippet

diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 7209d17735a..9483cadc93b 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5169,7 +5169,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
   RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
   RNA_def_property_ui_text(prop,
                            "Add Threshold",
-                           "Lower bound for a vertex's weight "
+                           "Lower (inclusive) bound for a vertex's weight "
                            "to be added to the vgroup");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
@@ -5179,7 +5179,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
   RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
   RNA_def_property_ui_text(prop,
                            "Remove Threshold",
-                           "Upper bound for a vertex's weight "
+                           "Upper (inclusive) bound for a vertex's weight "
                            "to be removed from the vgroup");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index c5e2ecb9660..b28af1e155c 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -326,7 +326,7 @@ void weightvg_update_vg(MDeformVert *dvert,
 
     /* If the vertex is in this vgroup, remove it if needed, or just update it. */
     if (dw != NULL) {
-      if (do_rem && w < rem_thresh) {
+      if (do_rem && w <= rem_thresh) {
         BKE_defvert_remove_group(dv, dw);
       }
       else {
@@ -334,7 +334,7 @@ void weightvg_update_vg(MDeformVert *dvert,
       }
     }
     /* Else, add it if needed! */
-    else if (do_add && w > add_thresh) {
+    else if (do_add && w >= add_thresh) {
       BKE_defvert_add_index_notest(dv, defgrp_idx, w);
     }
   }

This is certainly not a bug, but possibly a TODO (if this is really beneficial in all cases).
Will confirm for now and let modules make a decision here.

I think I get the point. So for vertices not in the group, it is impossible to add them with a default value of 0.0. Maybe this file makes it a bit clearer: - I have added a second vertexgroup and a `VertexWeightMix` modifier after the `VertexWeightEdit` modifier - none of the vertices are in the first group per se - the `VertexWeightEdit` modifier tries to add all vertices to the group with a value of 0.0 (to be able to be used by the following `VertexWeightMix` modifier), but "fails" due to the exclusive bounds [VertexWeightEdit_Bounds_repro.blend](https://archive.blender.org/developer/F9791525/VertexWeightEdit_Bounds_repro.blend) This patch changes it to be inclusive bounds [P1959: T82831_snippet](https://archive.blender.org/developer/P1959.txt) ```Diff diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 7209d17735a..9483cadc93b 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -5169,7 +5169,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1); RNA_def_property_ui_text(prop, "Add Threshold", - "Lower bound for a vertex's weight " + "Lower (inclusive) bound for a vertex's weight " "to be added to the vgroup"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -5179,7 +5179,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1); RNA_def_property_ui_text(prop, "Remove Threshold", - "Upper bound for a vertex's weight " + "Upper (inclusive) bound for a vertex's weight " "to be removed from the vgroup"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index c5e2ecb9660..b28af1e155c 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -326,7 +326,7 @@ void weightvg_update_vg(MDeformVert *dvert, /* If the vertex is in this vgroup, remove it if needed, or just update it. */ if (dw != NULL) { - if (do_rem && w < rem_thresh) { + if (do_rem && w <= rem_thresh) { BKE_defvert_remove_group(dv, dw); } else { @@ -334,7 +334,7 @@ void weightvg_update_vg(MDeformVert *dvert, } } /* Else, add it if needed! */ - else if (do_add && w > add_thresh) { + else if (do_add && w >= add_thresh) { BKE_defvert_add_index_notest(dv, defgrp_idx, w); } } ``` This is certainly not a bug, but possibly a TODO (if this is really beneficial in all cases). Will confirm for now and let modules make a decision here.
Philipp Oeser removed the
Interest
Animation & Rigging
label 2023-02-09 14:35:57 +01:00
Member

I've confirmed that the behavior is still the same in current main. I agree that this should probably be an inclusive bound. I'll bring it up with the animation & rigging module.

I've confirmed that the behavior is still the same in current `main`. I agree that this should probably be an inclusive bound. I'll bring it up with the animation & rigging module.
Member

Fixed in 4.0 by #108286

Fixed in 4.0 by #108286
Blender Bot added
Status
Archived
and removed
Status
Needs Info from Developers
labels 2023-07-12 18:07:06 +02:00
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#82831
No description provided.