Material Assignment broken when multiple materials assigned to Object #95417

Closed
opened 2022-02-02 03:47:55 +01:00 by Erindale · 7 comments

System Information
Operating system: Windows-10-10.0.22000-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.65

Blender Version
Broken: version: 3.0.1, branch: master, commit date: 2022-01-25 17:19, hash: dc2d180181

Short description of error
With multiple materials assigned to the Object data, the Set Material and Set Material Index nodes are non-functional on generated geometry.
With a Set Material followed by a Set Material Index node, you can get it to switch between index 0 and 1.
With just a Set Material node, you can only display Index 1.
With just a Set Material Index node, you can only display index 0.

Also happens in 3.1 builds.

Exact steps for others to reproduce the error
Create a node tree and generate geometry. Assign materials to the Object rather than mesh and attempt to use the Set Material or Set Material Index nodes to change them.

Attached file is set up accordingly.

2022-02-02 02-36-56.mp4

material bug.blend

**System Information** Operating system: Windows-10-10.0.22000-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.65 **Blender Version** Broken: version: 3.0.1, branch: master, commit date: 2022-01-25 17:19, hash: `dc2d180181` **Short description of error** With multiple materials assigned to the Object data, the Set Material and Set Material Index nodes are non-functional on generated geometry. With a Set Material followed by a Set Material Index node, you can get it to switch between index 0 and 1. With just a Set Material node, you can only display Index 1. With just a Set Material Index node, you can only display index 0. Also happens in 3.1 builds. **Exact steps for others to reproduce the error** Create a node tree and generate geometry. Assign materials to the Object rather than mesh and attempt to use the Set Material or Set Material Index nodes to change them. Attached file is set up accordingly. [2022-02-02 02-36-56.mp4](https://archive.blender.org/developer/F12841041/2022-02-02_02-36-56.mp4) [material bug.blend](https://archive.blender.org/developer/F12841046/material_bug.blend)
Author

Added subscriber: @Erindale

Added subscriber: @Erindale
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

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

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

Can confirm with mesh primitives.

Can confirm with mesh primitives.
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

The issue is that the generated mesh does not have as many material slots as the object. Currently, the "ground truth" for the number of materials is the number on the mesh. Therefore, if the object overwrites material slots that don't exist on the mesh, the overwrites are ignored.
This behavior is documented in the second to last paragraph in 1a81d268a1.
Fixing this should be possible, but I'm not quite sure how involved that would be currently.
Functions like DRW_curve_material_count_get and DRW_pointcloud_material_count_get would have to be updated to get the Object as parameter.

The issue is that the generated mesh does not have as many material slots as the object. Currently, the "ground truth" for the number of materials is the number on the mesh. Therefore, if the object overwrites material slots that don't exist on the mesh, the overwrites are ignored. This behavior is documented in the second to last paragraph in 1a81d268a1. Fixing this should be possible, but I'm not quite sure how involved that would be currently. Functions like `DRW_curve_material_count_get` and `DRW_pointcloud_material_count_get` would have to be updated to get the `Object` as parameter.

Closed as duplicate of #87335

Closed as duplicate of #87335
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
4 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#95417
No description provided.