Joining objects can create more customdata layers (e.g. UVMaps) than allowed, can eat huge amounts of RAM, bloats the filesize #111608
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#111608
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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-6.1.18-200.fc37.x86_64-x86_64-with-glibc2.36 64 Bits, WAYLAND UI
Graphics card: AMD Radeon Graphics (renoir, LLVM 15.0.7, DRM 3.49, 6.1.18-200.fc37.x86_64) AMD 4.6 (Core Profile) Mesa 22.3.7
Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-08-27 18:51, hash:
8a735d0aa4c7
Worked: never
Short description of error
Joining objects can create more customdata layers (e.g. UVMaps) than allowed.
While there is no hard limit for UV layers (yet), we usually restrict this to 8 from the UI.
Why can this be a problem?
See reports #111564, #71823, #96926
Joining many (hundreds or thousands -- which is not uncommon for CAD data) small objects with uniquely named UV layers will result in many, many UV layers (not only UVs, other customdata layers / attributes may be affected as well, but encountered most frequently for those), each then taking up memory/space for the whole -- now possibly very large -- mesh.
This will - unexpectedly - bloat up the filesize tremendously, also take up huge amounts of RAM for the joining operation, leading to possible crashes.
This is also not actually supported for UVMaps (the UI limit/restriction of 8 is there for a reason since e.g. Eevee, probably Cycles, too, dont handle more then 8).
Exact steps for others to reproduce the error
uv_maps_on_merge_single_user_mesh_unique_uv_layer_names.blend
(1.6MB)Will put on my desk for further investigation, possible solutions:
Note to myself:
LayerTypeInfo
could have alayers_max()
function forCD_PROP_FLOAT2
(it did have one forCD_MTFACE
--layerMaxNum_tface
)@Baardaap might be interested
Just dropping a workaround for folks running into this: you can of course rename the UVs (probably best thing to do is by index) prior to joining (so names are equal on participating meshes -- this way the layers get merged instead of created)
If I'm understanding this correctly, this behaviour is because that every face corner should have a UV coordinate in all uv layers present in the mesh? (Or every layer of UV will have all face corners of the mesh, I guess the same idea)
Yes, all layers have the size of the whole mesh.
Quoting @HooglyBoogly from chat:
I should clarify we're pretty far from being able to do that (we have to replaces uses of
CustomData_*
with the attribute API first), but it's good to keep such sparse attribute storage in mind.I do think it's better if joining stays predictable/simple and name based. A "Rename UV Maps by Index" operator might make sense, though it may be a bit specific?
I also want to clarify that there is no limit to the number of UV attributes in the design now-- that was an important part of the switch to the generic attribute API.
We still limit it from the UI though (at least from the UIList, adding more than 8 is prevented)
Interesting, didn't realize that. I know the transition to remove the limit from some areas is still incomplete, maybe that's the reasoning (hence the "on a design level")
The limit is there for a reason, see
BKE_mesh_validate_all_customdata
The limit cant be removed from everywhere (at least not in a way that layers above the limit will actually work as expected), so even if we would allow them internally (which might not be the best idea due to the problems presented in this report), we have to counter-act on the UX level (warnings, cleanup operators, defaulting to merge by index in the join operator, ...)
I'm not completely sure about this, since it has been a while I really dove into this code, but I think only the uv layers referenced from the material get copied to the renderer. So that gives it some leeway as a mesh can have more uv layers.
Extra UV layers can be useful in GN trees which have no problem using them. But it does lead to a quite messy situation which would need clear warnings in the UI some maybe it would be simpler to just keep the restriction on the number of UV layers in place.
Stepping down since I currently not plan on actually working on this (although it is still a big issue)