Regression: OBJ import: Clamp Bounding Box does not work #122256
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#122256
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.8.9-arch1-2-x86_64-with-glibc2.39 64 Bits, X11 UI
Graphics card: Mesa Intel(R) HD Graphics 520 (SKL GT2) Intel 4.6 (Core Profile) Mesa 24.0.6-arch1.2
Blender Version
Broken: 3.6 - 4.2
Worked: 3.6 with OBJ Legacy importer
Short description of error
The "Clamp Bounding Box" OBJ import option does not seem to work.
Exact steps for others to reproduce the error
Import this OBJ file
In 3.6, using the legacy Python importer and setting the Clamp Size option to 2, the object has the expected scale of (0.001, 0.001, 0.001).
In 3.6 - 4.2, using the new OBJ importer and setting Clamp Bounding Box to 2, the OBJ has the default scale (1, 1, 1). The option had no effect.
Can confirm, exporting a cube of size 4 and reimporting with different clamp_size still results in cube of same dimensions.
Just tested with latest
4fc8a72780
on win10This is what i get for the cube bounds in
https://projects.blender.org/blender/blender/src/source/blender/io/wavefront_obj/importer/importer_mesh_utils.cc#L107
Mesh bounds min: (1.07229e-13, 8.98232e-43, 1.30249e-08)
Mesh bounds max: (3.47522e-43, 0, 0)
Max diff: -8.98232e-43
Not excatly what it should be.
OBJ import: Clamp Bounding Box does not workto Regression: OBJ import: Clamp Bounding Box does not workConfirmed. The data returned from
mesh->bounds_min_max
is invalid at this point. If you call it afterBKE_mesh_nomain_to_mesh
it will work.I was going mad, then realized the
BKE_mesh_nomain_to_mesh
was just called before thetransform_object
.Now, i think the math is wrong:
This is the same loop as in the 3.6 python importer, but i believe this would be the correct way of setting the scale
Using this and importing the 4m cube i get
which seems correct.
Should i make 2 different pull request?
One for the bounds and one for the calculation?
The intention of the calculation is obviously to scale down by the first power of ten that makes it fit in the box. That is, (a) it only scales down or not at all, never up (scale <= 1), and (b) it only scales by powers of ten (1, 0.1, 0.01, etc).
import_params.clamp_size / max_diff
would change both behaviors. It would scale either up or down to make the object fit the box exactly.(a) is expected from the tooltip ("Resize the objects to keep bounding box under this value"). I did not expect (b). Whether (a) and (b) are desirable is a separate question from this bug though. They are obviously intentional and long-standing behaviors.
(I actually think there is a more serious problem with the calculation, which is that the scale appears to be set from each object's bounding box individually, which will distort the relative position of different objects if they are assigned different scales. The Python importer correctly determines a single scale from all the objects together and gives them all that scale. This is just from looking at code though, I can't test it until this bug is fixed.)
That is absolutely right.
I just sent a pull request for fixing the bound values, you may now try to use that patch.
On the behaviour of the
clamp_size
itself i would argue that it would make more sense to use it to make the object fit exactly the dimension desired.I don't think there's a similar behaviour anywhere else in blender where you could get a 1 order of magnitude of error as output.
But maybe opening a new issue for just that would problably be better.
Since a fix is not forthcoming, here is a script I am using after import as a workaround. It scales both up or down to fit the target cube size.