Geometry nodes material index attribute not working correctly on generated/instanced geometry #87335
Labels
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
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
11 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#87335
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Linux-5.8.0-7630-generic-x86_64-with-glibc2.32 64 Bits
Graphics card: Quadro RTX 6000/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.32.03
Blender Version
Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-04-08 17:19, hash:
1ec9ac2016
FYI, the history on this:
prior to
1a81d268a1
this was working in editmode (but not objectmode)after
1a81d268a1
no material was shown in the viewport at allthen with
6583fb67c6
we had first material showing again, but setting index was not working in either objectmode nor editmodeShort description of error
changing the material_index attribute does not seem to have an effect on created/instanced data, even though the material index seems to change accurately in the spreadsheet and the material slots are set to
Object
type. What is especially strange about this is that the issue does not persist for cycles rendering.geo-nodes_material_index_bug-2021-04-09_12.25.49.mp4
(same for geometry generated with a primitive node)
Exact steps for others to reproduce the error
Original file:
geo-nodes_material_index_viewport.blend
Updated to fields:
geo-nodes_material_index_viewport.blend
Added subscriber: @SimonThommes
#95417 was marked as duplicate of this issue
#87786 was marked as duplicate of this issue
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @JacquesLucke
Looks like the issue is that the material slots on the mesh and the object are not in sync. The number of material slots on the other object and on the grid mesh is zero. Eevee seems to check the number of materials, while cycles probably handles it differently. Since the number of materials on the mesh is zero, eevee does not look for materials on the object.
A workaround in your demo file is to add some material slots to the icosphere.
This commit fixes a related issue:
3de5fbba3a
Also related: #86737.
Added subscriber: @Eary
I encountered this problem a few weeks ago, and after discussion with my friends, we came to the conclusion that all we needed to do for solving the problem is this:

So basically the icosphere needs to have the same amount of slots (even empty slots count) as the geometry node object
EDIT: Ops, I didn't see Jacques' reply, I guess I am just repeating what he said, lol
Added subscriber: @vasiln
Note that this can also interact with instancing a collection. In this case, the workaround doesn't help (in 2.93.3 release.) It appears that the entire collection gets a set of materials that depends on the order that objects were created, or the order of input noodles in any join geometry nodes, or something else:
Here, it's getting the material of the first created object in the collection, rather than the materials of any other objects. Changing the material index assignment does nothing. I've renamed the first created object to "z" to see if it's alphabetic, but no, it appears to be creation order.
Change the noodles around and you get:
Now we're getting the material of the referenced object. Again, changing the material index assignment doesn't change anything.
It would be nice if instanced geometry inherited all materials of all instanced objects, as space permitted, so that we could do material assignments, but if that's not possible, choosing materials on the basis of noodle order or creation order is probably not a good way to do it. Creation order is especially poor, since there's no apparent way to change it without starting over from scratch.
Note that the material assignments aren't necessarily getting updated with changes to the geometry nodes, which can confuse some troubleshooting. Sometimes you need to drag some objects around to force recalculation of nodes. It also happens that the geometry nodes show different materials when the node object is in edit vs object mode.
Added subscriber: @lichtwerk
Note that this works in editmode afaics.
Geometry nodes material index attribute not working correctly on generated/instanced geometryto Geometry nodes material index attribute not working correctly on generated/instanced geometry (in objectmode, editmode is fine)Added subscriber: @NahuelBelich
Correction: this is only true for 2.93 LTS, in 3.0, this does not work in either object or editmode
FYI, the history on this:
prior to
1a81d268a1
this was working in editmode (but not objectmode)after
1a81d268a1
no material was shown in the viewport at allthen with
6583fb67c6
we had first material showing again, but setting index was not working in either objectmode nor editmodeGeometry nodes material index attribute not working correctly on generated/instanced geometry (in objectmode, editmode is fine)to Geometry nodes material index attribute not working correctly on generated/instanced geometry@HooglyBoogly : are we still keeping reports for the "legacy" nodes?
Added subscriber: @crowe
I'd just like to let you know this bug still happens with the new nodes. Set Material Index doesn't affect generated or instanced geometry, nor does the new Named Attribute node from the builds with "material_index" as the attribute—this one will crash Blender.
My guess is that generated/instanced geometry has a separate list of materials which is out of sync with the object's material slots. It's logic is wild and with more materials it can be hard to keep track of.
Examples:
As long you don't repeat materials, it works. You can use only materials not in the object, only materials in the object but out of other, or mix them.
Without using Set Material Index to pick the material, you always get the highest index the geometry tree allows. Whether the material it'll be drawn from the object data or the geometry node depends on the number of slots created by geo nodes.


Results...
a) 2 slots x tree with 2 materials not in obj = slot 2 mat
b) 2 slots x 1 material not in obj = slot 1 mat
c) 2 slots x 3 materials not in obj = overwritten by Set Material's mat (idx higher than original slots)
Added subscribers: @Erindale, @PratikPB2123
Added subscriber: @Shiki-1
Added subscriber: @Yevtushenko-Oleksandr
Added subscriber: @HooglyBoogly