Object-linked material slot not working correctly with generated geometry in geometry nodes #88455

Closed
opened 2021-05-21 11:01:36 +02:00 by Simon Thommes · 10 comments
Member

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: 3.0.0 Alpha, branch: master, commit date: 2021-05-21 07:43, hash: c154b078b5
Worked: last week (no specific hash, sorry)

Short description of error
An object-linked material slot does not properly assign a material to generated geometry. This worked previously and adding an Assign Material node seems to fix it, even though nothing is filled in. I guess this has to do with the evaluated material slot list not behaving as it should.
object_material_bug.mp4

Exact steps for others to reproduce the error
See this file:
material_assing_object.blend

**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: 3.0.0 Alpha, branch: master, commit date: 2021-05-21 07:43, hash: `c154b078b5` Worked: last week (no specific hash, sorry) **Short description of error** An object-linked material slot does not properly assign a material to generated geometry. This worked previously and adding an `Assign Material` node seems to fix it, even though nothing is filled in. I guess this has to do with the evaluated material slot list not behaving as it should. [object_material_bug.mp4](https://archive.blender.org/developer/F10133507/object_material_bug.mp4) **Exact steps for others to reproduce the error** See this file: [material_assing_object.blend](https://archive.blender.org/developer/F10133505/material_assing_object.blend)
Author
Member

Added subscriber: @SimonThommes

Added subscriber: @SimonThommes

#88446 was marked as duplicate of this issue

#88446 was marked as duplicate of this issue
Member

Added subscribers: @HooglyBoogly, @JacquesLucke

Added subscribers: @HooglyBoogly, @JacquesLucke
Member

The issue here is that the number of materials on the geometry is the ground truth (this was mentioned in 1a81d268a1). In your example, the generated cylinder has no materials and therefore no material can't be overwritten by the object.
The Material Assign node currently does add a material slot to the mesh, even though it is empty. Because it exists, it can be overwritten by the object.

The proper solution might be to create one empty material slot in the mesh primitive nodes. This material slot is referenced by all faces anyway, because their material_index is 0.
@HooglyBoogly What do you think?

The issue here is that the number of materials on the geometry is the ground truth (this was mentioned in 1a81d268a1). In your example, the generated cylinder has no materials and therefore no material can't be overwritten by the object. The Material Assign node currently does add a material slot to the mesh, even though it is empty. Because it exists, it can be overwritten by the object. The proper solution might be to create one empty material slot in the mesh primitive nodes. This material slot is referenced by all faces anyway, because their `material_index` is 0. @HooglyBoogly What do you think?
Member

Added subscriber: @LloydAlmeida

Added subscriber: @LloydAlmeida
Member

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

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

Adding a material slot to newly created meshes is a bit hacky, but it's also simple, and not user-visible, so it seems like a fine solution. We would have to take care to do this for all new meshes, not just the mesh primitives. It's also inconsistent with regular mesh primitive objects.

It would definitely be more complicated, but another solution would be refactoring code so that the information of the number of materials in the object is always available when rendering meshes.
The situation we're in currently where we retrieve materials from the object with a callback except for the length of the material array is a little odd IMO. I don't have a strong opinion about which approach is the best though.

Adding a material slot to newly created meshes is a bit hacky, but it's also simple, and not user-visible, so it seems like a fine solution. We would have to take care to do this for all new meshes, not just the mesh primitives. It's also inconsistent with regular mesh primitive objects. It would definitely be more complicated, but another solution would be refactoring code so that the information of the number of materials in the object is always available when rendering meshes. The situation we're in currently where we retrieve materials from the object with a callback except for the length of the material array is a little odd IMO. I don't have a strong opinion about which approach is the best though.
Member

Maybe we could change eevee so that it can read the number of materials from the object, not sure how much needs to be changed for that. Could be simple but might also be a more complex refactor.
Note that this refactor should not only be done for meshes, but for the other types as well.

Maybe we could change eevee so that it can read the number of materials from the object, not sure how much needs to be changed for that. Could be simple but might also be a more complex refactor. Note that this refactor should not only be done for meshes, but for the other types as well.
Jacques Lucke self-assigned this 2021-05-31 16:31:20 +02:00

This issue was referenced by 6583fb67c6

This issue was referenced by 6583fb67c6e1e5d714d723a09312e9dd25e02152
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
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
5 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#88455
No description provided.