Store/Remove Named Attribute issues with vertex groups #99873

Closed
opened 2022-07-20 14:16:34 +02:00 by Alexander Gavrilov · 10 comments

Blender Version

Broken: 3.3 alpha 8d69c6c4e7

Short description of error

Using geometry nodes to store or remove vertex groups doesn't work correctly.

Exact steps for others to reproduce the error

Open the file:

test-store-attribute.blend

It contains examples of Store and Remove Named Attribute, paired with an emulation using the Vertex Weight Mix modifier: the bottom 4 lines should form two identical pairs. However, the geometry node versions instead look like the top line, which is incorrect.

Technical analysis

The problem in the Store Named Attribute is that it starts by deleting the attribute, i.e. basically does Remove Named Attribute first. This loses the attribute's identity as a vertex group, and also triggers the Remove issue.

Remove Named Attribute appears to trigger a bug in the Armature modifier where it for some reason uses the original list of vertex groups with evaluated weight data, thus causing a shift mismatch with the names (emulated by the top line).

**Blender Version** Broken: 3.3 alpha 8d69c6c4e7 **Short description of error** Using geometry nodes to store or remove vertex groups doesn't work correctly. **Exact steps for others to reproduce the error** Open the file: [test-store-attribute.blend](https://archive.blender.org/developer/F13303020/test-store-attribute.blend) It contains examples of Store and Remove Named Attribute, paired with an emulation using the Vertex Weight Mix modifier: the bottom 4 lines should form two identical pairs. However, the geometry node versions instead look like the top line, which is incorrect. **Technical analysis** The problem in the Store Named Attribute is that it starts by deleting the attribute, i.e. basically does Remove Named Attribute first. This loses the attribute's identity as a vertex group, and also triggers the Remove issue. Remove Named Attribute appears to trigger a bug in the Armature modifier where it for some reason uses the original list of vertex groups with evaluated weight data, thus causing a shift mismatch with the names (emulated by the top line).
Author
Member

Added subscriber: @angavrilov

Added subscriber: @angavrilov
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Hans Goudey self-assigned this 2022-07-22 00:50:56 +02:00
Author
Member

There is one more issue with deleting groups that I noticed by the way: the viewport weight overlay also seems to use original name mapping when displaying weights for the active vertex group/bone and is affected by the same shift mismatch. But maybe that should be a separate bug to simplify tracking...

There is one more issue with deleting groups that I noticed by the way: the viewport weight overlay also seems to use original name mapping when displaying weights for the active vertex group/bone and is affected by the same shift mismatch. But maybe that should be a separate bug to simplify tracking...
Member

That's partially solved by adding this code to VertexGroupsAttributeProvider::try_delete:

    if (index < mesh->vertex_group_active_index) {
      mesh->vertex_group_active_index--;
    }

However, I'm not sure what should happen when you delete the active vertex group. I guess the overlay should just turn off then?

That's partially solved by adding this code to `VertexGroupsAttributeProvider::try_delete`: ``` if (index < mesh->vertex_group_active_index) { mesh->vertex_group_active_index--; } ``` However, I'm not sure what should happen when you delete the active vertex group. I guess the overlay should just turn off then?

This issue was referenced by c40971d79a

This issue was referenced by c40971d79a887820d621705b29f65f833d9b9f52
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Author
Member

In #99873#1394194, @HooglyBoogly wrote:
That's partially solved by adding this code to VertexGroupsAttributeProvider::try_delete:

No, the problem is the same as with the Armature modifier: the overlay rendering clearly uses indices based on the unevaluated name list, so it displays weights from the wrong group. Painting itself is based on the original mesh with substituted evaluated vertex coordinates so it should be fine, but viewport rendering uses evaluated weights and thus should use evaluated names.

> In #99873#1394194, @HooglyBoogly wrote: > That's partially solved by adding this code to `VertexGroupsAttributeProvider::try_delete`: No, the problem is the same as with the Armature modifier: the overlay rendering clearly uses indices based on the unevaluated name list, so it displays weights from the wrong group. Painting itself is based on the original mesh with substituted evaluated vertex coordinates so it should be fine, but viewport rendering uses evaluated weights and thus should use evaluated names.
Member

That's not right actually. Renderers like EEVEE and workbench and the overlay engine get evaluated objects with the Object::data field replaced with the evaluated geometry. So the draw cache uses the object-level functions, but those use the names from the evaluated mesh.

Anyway, I wasn't just making that up, I tested both changes and the one I mentioned is the only thing that had an effect.

That's not right actually. Renderers like EEVEE and workbench and the overlay engine get evaluated objects with the `Object::data` field replaced with the evaluated geometry. So the draw cache uses the object-level functions, but those use the names from the evaluated mesh. Anyway, I wasn't just making that up, I tested both changes and the one I mentioned is the only thing that had an effect.

This issue was referenced by 80b2fc59d1

This issue was referenced by 80b2fc59d11d5814afe7e219c535525a8d494c17
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
3 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#99873
No description provided.