Smart UV Project operator freezes Blender and never finishes #102843
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#102843
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: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 522.25
Blender Version
Broken: version: 3.3.1, branch: master, commit date: 2022-10-04 18:35, hash:
b292cfe5a9
Worked: (newest version of Blender that worked as expected)
Short description of error
In one of my production files, on a specific mesh object, using Smart UV Project operator freezes Blender and the operation never finishes. The memory grows a little but then stays the same, as if the operator was stuck in a loop.
Exact steps for others to reproduce the error
Result: Blender freezes and the operation never finishes
Expect: Blender does not freeze and operation eventually finishes
Added subscriber: @Rawalanche
Added subscriber: @mano-wii
Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
This object is corrupted.
See the
Mesh.validate()
log:But even validating, the operation is taking a lot of time.
I don't know if it's an infinite loop or if it's just because it takes so long.
The mesh is a product of decimate modifier. I've been using this workflow for years, and never had issues. I don't think invalid mesh is a dealbreaker for Smart UV project. If it is, then there's some small random chance that Decimate Modifier outputs invalid geometry.
Added subscriber: @Chris_Blackbourn
Nice mesh!
Poking around a little, it appears to be a performance issue with the packer. I'm not seeing any obvious bugs other than the fact it's taking a very very long time.
For example:
UV > Unwrap > Sphere Projection
UV > Unwrap > Pack Islands
(Completes in a few seconds with only a few islands.)UV > Unwrap > Cube Projection
(Lots of disconnected islands.)UV > Unwrap > Pack Islands
(I'm still waiting for it to complete. *Update: Completed after 3 hours)Will investigate further...
When I changed the second level displacement map to a lower frequency one, the packing also completed much faster. If this is indeed a packer issue, then shouldn't the Smart UV Project operator get a toggle to opt out of packing? I use UVPackmaster addon for packing anyway. I can't afford to wait 3 hours to pack a mesh with 800k triangles (which is not even considered high poly by today's standards), and the UVPackmaster addon packs it in about 20 seconds. But I need to be able to unwrap the mesh first in a non-manual manner, and for that, the Smart UV project is invaluable.
So I'd say either fix the performance bug or add option to opt out of packing step when performing Smart UV Project operation.
@Chris_Blackbourn, are you working on a fix? If so, can the bug be confirmed?
While we do continue to work on improving performance in general, potential performance improvements are not handled as bug reports :\
What we are talking about here is a unwrap of 800k triangle mesh taking 3+ hours. Let's say for example that adding a modifier to a default cube would suddenly take 50 minutes instead of 5 milliseconds. Would you say that it's a performance improvement, not a bug?
Added subscriber: @Raimund58
To add a bit of context, it's not the triangle count so much as the number of islands. With the cube projection, there's 100k+ UV Islands, and yeah, that's going to take a long time with the current packer.
In terms of fixes, I need to do a bit more investigation. I have a potential "quick fix" on my machine, but am hesitant to check it in if it will make it harder to get even better packing in future versions.
Is it okay to leave this one hanging for a little bit until I know more?
Added subscriber: @GeorgiaPacific
Wouldn't it actually be possible to just introduce new checkbox to Smart UV Project operator called "Pack UVs", and enabled by default? So that users could turn it off, if they intend to use 3rd party packing solution? I mean even if you manage to make the packing step 100x faster, if it used to take 100 minutes to finish, it will still take additional minute of waste for anyone who wants to do the packing themselves. No time wasted is IMO still better than less time wasted.
In principle, "yes", it's possible to just add a new checkbox.
In practice, all of the UV operators, Smart UV Project, Cube projection, Cylinder Projection, Sphere Projection, plus the geometry nodes version, as well as "Project From View" and even the "Add Simple UVs" which are used in texture painting are all interconnected.
Changing any one of them has impacts on all of the others.
Not just from a coding perspective, but also from a documentation POV, testing, as well as user expectation, and of course regressions over time such as forwards and backwards compatibility.
The roadmap is indeed to add a "Don't Pack" option to the Smart UV Project operator, along with other packing options. But it'll probably be a drop down choosing from a list rather than a checkbox, and it's going to take a little bit of time...
(technical) The current packing is worse than
O(N^3)
, so increasing the island count from 1000 -> 10,000 increases the packing time by a factor of 101010 = 1000 slower.(technical) The new packing code will be
O(N log N)
, so increasing the island count from 1000 -> 10,000 increases packing time by a factor of ~14.i.e. The new packer should run faster than the unwrapping.
The PR #105393 adds a new UV Packing strategy, the "Alpaca".
It runs in O(n log n) performance, which means the updated packer is faster than the UV Unwrapper.
For example, on a release build, "UVFreeze.blend" used to take ~3 hours on my machine to Pack Islands.
Now, on a debug build, Pack Islands on UVFreeze.blend takes around 5 seconds:
This is a drop-in replacement. The largest 1024 islands are still packed using the exact same "box_pack" strategy. Only the smaller (16312 - 1024) = 14288 islands are packed using the "Alpaca" strategy.
This is great, but will this ever make it into the main branch?
@Rawalanche - best is to just follow the activity on that PR and you will see lots of work and discussion over the last few days. #105393