New 3.1 OBJ exporter writes incorrect polygon/vertex groups in some cases #96824
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#96824
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: Mojave 10.14.6
Graphics card: NVIDIA GeForce GT 750M 2 GB
Blender Version
Broken: Version 3.1.0 (3.1.0 2022-03-09)
Worked: Version 2.93.4
Summary
Blender OBJ import has the option to "keep vertex order". When exporting the Blender Object back out, the v's, g's and f's should be in the same order as they were imported.
Details
The bug is triggered if the input file spreads a single group's faces over multiple g labels. If a group's faces are in a single g label, then the OBJ exports correctly. the OBJ format allows a group's faces to be declared in multiple separate g labels. They are logically connected into a single group. Some applications export OBJs with faces in single groups, some export in internal vert order, adding g labels as needed.
Implications
Some commercial packages use objects as shape keys for morphs and animations. A specific requirement is that vertex order is maintained. This includes faces and group compositions. This has worked correctly up until the new C++ OBJ importer.
Steps
Import an OBJ with the faces of a single group spread over multiple g labels, with the only option being "poly groups" and "keep vertex order". Export with same options. The exported OBJ in 3.1.0 has broken groups. The v order, f structures, and f order are correct. But some of the f's show up in the wrong g's
Dawn.obj
2.93.4-Dawn.obj-import.blend
2.93.4-Dawn.obj-import.obj
3.1.0-Dawn.obj-import.blend
3.1.0-Dawn.obj-import.obj
The following script compares the files. The vert count and face count's are equal, but their distribution within groups in the 3.1.0 exported OBJ are incorrect
output
Added subscriber: @unreality
Added subscriber: @aras_p
@unreality does the issue still happen in the latest 3.1.1 nightly builds (https://builder.blender.org/download/daily/)? There were a handful of new OBJ exporter regression fixes there since 3.1.0.
Added subscriber: @PrefoX
they removed the "keep vertex order" in blender 3.1 at least for me a my friends. that counts for export.
And even in Version 3.1.1 the option is completly missing!!!
@PrefoX in 3.1+ the "keep vertex order" is effectively always on, as far as I can tell.
Yes. The OBJ output, as far as v's, g's, and f's is the same as 3.1.0: the order is still maintained correctly (vertex and winding), but the group composition is incorrect.
To be clear, it's removed as an option in export. It's still an option in import. It may be intentional in that selecting it in import; a user would almost certainly want it in export (no other reason to use the option). And the only reason to select it in export is BECAUSE it was selected in import. Essentially, one less option for the user to mess up. That's probably not a bad thought :)
It seems (and I hope it's intentional) that so long as the OBJ was imported with that option, it will export with that option (assuming no changes to vert count and vertex groups).
The help and tip on the "keep vert order" import option should mention that, as the way it's presented in the workflow (with the export option missing) could confuse people looking at any reference to the process prior to version 3.x; they would wonder where the heck the export option went
I'm not sure where blender is storing that info. It must be stored with the file since it persists, and it's stored with the obj, since it's copied with copies of the object. Both of those features are useful.
Uhm... Trying to understand the source code. Is the importer/exporter C++? It looks like it's python.
Am I looking at the wrong place? https://developer.blender.org/diffusion/BA/browse/master/io_scene_obj/init.py
And yet that's not what the export panel looks like.
Changed status from 'Needs Triage' to: 'Confirmed'
@unreality in 3.1.x the OBJ exporter is in C++ (the old exporter python code still exists but is disabled), but the importer is the same as in previous version, i.e. written in Python.
Anyway, I can definitely see the problem with your repro files, thanks! Something is messed up in the polygon vertex group calculation code, it seems, will try to fix it.
Incorrect groups in exported .obj from imported .obj with "keeping vertex order" optionto New 3.1 OBJ exporter writes incorrect polygon/vertex groups in some casesThis issue was referenced by
b32cb0266c
Changed status from 'Confirmed' to: 'Resolved'