Maniphest T93663

Geometry Nodes: Dual Mesh Node doesn't handle materials
Closed, ResolvedBUG

Assigned To
Wannes Malfait (Wannes)
Authored By
Santiago (Sanctus)
Dec 4 2021, 7:42 PM
Tags
  • Geometry Nodes
  • Nodes & Physics
Subscribers
Hans Goudey (HooglyBoogly)
Santiago (Sanctus)
Wannes Malfait (Wannes)

Description

System Information
Operating system: Windows 10
Graphics card: RTX 3070

Blender Version
3.1 Alpha

Short description of error
The mesh created with the dual mesh node doesn't have default material slots, and doesn't transfer materials. This causes things like the 'set material' node to not work properly.

Exact steps for others to reproduce the error

Muting the dual mesh in the given node tree works as expected. The set material node only works properly after assigning a default material to all the faces. The selection itself is being created correctly on the mesh (checked via the viewer).

Revisions and Commits

Event Timeline

Santiago (Sanctus) created this task.Dec 4 2021, 7:42 PM
Wannes Malfait (Wannes) changed the task status from Needs Triage to Confirmed.Dec 5 2021, 5:59 PM
Wannes Malfait (Wannes) added a subscriber: Wannes Malfait (Wannes).

Assigning materials in geometry nodes to the mesh from dual mesh seems to broken.

Wannes Malfait (Wannes) updated the task description.Dec 5 2021, 6:02 PM
Wannes Malfait (Wannes) edited projects, added Geometry Nodes; removed BF Blender.
Wannes Malfait (Wannes) renamed this task from Geometry Nodes Dual Mesh Node strange behavior with Index to Geometry Nodes: Dual Mesh Node doesn't handle materials.Dec 6 2021, 1:25 PM
Wannes Malfait (Wannes) updated the task description.
Wannes Malfait (Wannes) changed the subtype of this task from "Report" to "Bug".
Hans Goudey (HooglyBoogly) added a subscriber: Hans Goudey (HooglyBoogly).Apr 16 2022, 1:53 AM

@Wannes Malfait (Wannes), I believe part of this problem is because BKE_mesh_new_nomain is used instead of BKE_mesh_new_nomain_from_template, which copies the materials/slots.

Another is probably that face attributes are transferred to vertices, but that isn't possible with material indices. I guess there's probably some way to transfer face attributes to new faces? Though maybe that exposes some arbitrary decisions in the edge cases.

Wannes Malfait (Wannes) added a comment.Apr 16 2022, 10:58 AM
In T93663#1342061, @Hans Goudey (HooglyBoogly) wrote:

@Wannes Malfait (Wannes), I believe part of this problem is because BKE_mesh_new_nomain is used instead of BKE_mesh_new_nomain_from_template, which copies the materials/slots.

Another is probably that face attributes are transferred to vertices, but that isn't possible with material indices. I guess there's probably some way to transfer face attributes to new faces? Though maybe that exposes some arbitrary decisions in the edge cases.

If BKE_mesh_new_nomain_from_template fixes the problem of not being able to assign materials correctly then I think just making that change should be good enough.

There is no "good" way to copy material indices like you said. I don't think it's possible to to any better than if you used the Set Material Index node with the to point domain converted Material Index attribute. Since it's possible to do this with the current node, I don't think it's worth the added effort and complexity to add this to the node itself. I think in general you would want to assign materials after all the geometry processing is done anyway.

Hans Goudey (HooglyBoogly) added a comment.Apr 18 2022, 3:20 PM

That makes sense, thanks. I guess we can just do the first fix then.

Hans Goudey (HooglyBoogly) added a project: Nodes & Physics.Apr 28 2022, 6:59 PM
Wannes Malfait (Wannes) closed this task as Resolved.Jul 5 2022, 4:44 PM
Wannes Malfait (Wannes) claimed this task.

This bug seems to actually not be present anymore in latest master, so I'll just close this as resolved.