Blender 4.0 creates many invalid materials, corrupts file, Eevee crashes #114428
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
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#114428
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: macOS 14
Graphics card: M1 (Metal, GPU-only)
Blender Version
Broken:
f6c52849b5
(would be nice if this could be copied from the splash screen)Worked: Don't know
Short description of error
When assigning a new material to some meshes (not all), Blender creates hundreds of empty/invalid materials. Possibly one per face? This increases the file size and causes incorrect rendering (both the default/no material and the set material). It's impossible to remove these materials with the material cleanup (Material utilities -> Clean slots only gives me a Python stack trace).
Exact steps for others to reproduce the error
Open the file, there is a "Bad" and a "Good" object. A material "Feet" has been assigned to the good object. Try assigning it to the bad object and it will create many empty materials. I once managed to solve it by recalculating the outer normals, which sometimes but not always works, so I suspect it could be related to that?
This event somehow corrupts the file, so switching over to to the Material Preview-view, after this has happened, even after it has been remedied, causes Eevee to crash as it's populating the materials cache.
I'm a newbie so I could be doing something stupid, but it doesn't seem like the application should segfault at least...
Crash report attached along with the example.
We have corrupted material indices here
These can easily be corrected:
Bad
objectC.active_object.data.validate_material_indices()
Now the question is: how can this corruption be reproduced?
How has the mesh been created? Was this imported (which importer)? Was this modelled with blenders tools (which)?
Please try to find ways to reproduce (otherwise we cannot continue with this report)
Help > Report a Bug
🙂I can confirm that extra materials slots are generated but unable to identify the reason.
oh, nice findings. I did not consider to check the spreadsheet 😅
I created the geometries in Blender from scratch, with a combination of adjustments in edit mode (manual + bevel), and two boolean difference modifiers. I will try to reproduce...
I have tried for about 30 minutes to reproduce the issue, but it seems non-trivial. I could spend more time, but I'm not sure that the corruption you mention specifically is the cause, although I don't doubt that there is some form of corruption.
Start by running
validate_material_indices
, the output returnsTrue
, and ensure that it worked in the spreadsheet. So far so good. Both the 3D printing toolbox and the spreadsheet now indicates that the geometry is clean, as far as I can understand. Go back to the Layout view and assign theFeet
material, and the problem persists.I tried to rule out the material itself being the cause, by creating a new material and assigning that, but the issue persists nonetheless.
I suppose it could also be argued that if I did something stupid in edit mode, the fallback could still be more graceful than a Blender segfault, i.e. even if there isn't a clear solution to the problem, one might consider mitigating its consequences with some form of error handling perhaps. This seems Eevee specific however, as Cycles does not segfault, but the Eevee segfault brings all of Blender down along with it.
OK, can confirm that doing
C.active_object.data.validate_material_indices()
cleans up the indices, but assigning the material creates additional material slots.It would still be good to know how we got to the corrupted state, but cleaning up the indices should really give us a clean plate.
Will put on my desk to investigate more later...
I will let you know if it happens again, now that I'm aware I'll be able to detect it earlier and more easily trace back to the operation causing it. Just curious: after assigning the material, causing the extra material slots to be added, can you use Eevee in the viewport or does Blender crash?
Eevee doesnt crash for me
agree
Btw. as a workaround you can use https://docs.blender.org/manual/en/4.1/scene_layout/object/editing/cleanup.html#remove-unused-material-slots to get rid of the unwanted material slots
That didn't work for me either once the slots are there, like I wrote in my initial post:
But one thing that does work for me, is to create a new material for "Bad" rather than assigning a material. Then you can assign another material...
OR: simply type
C.active_object.active_material_index = 0
before assigning the material(when opening the file, C.active_object.active_material_index is 19976 ... )
It is actually very easy to break:
From the default startup cube:
C.active_object.active_material_index = 100
I find this quite questionable behavior of setting the
active_material_index
(this should probably be clamped to the number of available slots?)