New OBJ exporter no longer groups faces by material, causing issues with some other apps (e.g. Procreate) #96511

Closed
opened 2022-03-16 04:01:45 +01:00 by Kuzey · 21 comments

Blender Version
Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-03-14 19:06, hash: fc259d4c30
Worked: I tried it with Blender 2.93.0 2021-04-19

Short description of error
When exporting obj from blender 3.2 with multiple materials assigned breaks object in some other apps (e.g. Procreate on iPad).

The issue seems to be that the new exporter does not group faces by material, whereas the old exporter did.

Exact steps for others to reproduce the error
Load the monkey model

add subdivision surface modifier and set to level 3

apply modifier

in edit mode assign different materials to the object ( at least 3)

export obj (try all settings and or combinations there of)

import into procreate

see video of the new obj vs old obj exporter

objexport.mov

**Blender Version** Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-03-14 19:06, hash: `fc259d4c30` Worked: I tried it with Blender 2.93.0 2021-04-19 **Short description of error** When exporting obj from blender 3.2 with multiple materials assigned breaks object in some other apps (e.g. Procreate on iPad). The issue *seems* to be that the new exporter does not group faces by material, whereas the old exporter did. **Exact steps for others to reproduce the error** Load the monkey model add subdivision surface modifier and set to level 3 apply modifier in edit mode assign different materials to the object ( at least 3) export obj (try all settings and or combinations there of) import into procreate see video of the new obj vs old obj exporter [objexport.mov](https://archive.blender.org/developer/F12929358/objexport.mov)
Author

Added subscriber: @kuzey

Added subscriber: @kuzey
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

I can not reproduce when importing same file back to Blender.
Does this only happen when importing obj file in Procreate?

I think Procreate is only available for ipad, right?
#96511.blend

I can not reproduce when importing same file back to Blender. Does this only happen when importing obj file in Procreate? I think Procreate is only available for ipad, right? [#96511.blend](https://archive.blender.org/developer/F12929654/T96511.blend)
Author

Yes ipad only.

Yeah the object seems normal in blender, it's a bit strange.

what if you exported the obj from 2.9 and 3.2 and compare the files, would that narrow things down?

Thanks

Yes ipad only. Yeah the object seems normal in blender, it's a bit strange. what if you exported the obj from 2.9 and 3.2 and compare the files, would that narrow things down? Thanks
Member

Hi, I exported in .obj format from 2.93 & 3.2 then imported back to respective versions and I don't see any difference after comparing them.

Hi, I exported in .obj format from 2.93 & 3.2 then imported back to respective versions and I don't see any difference after comparing them.

Added subscriber: @aras_p

Added subscriber: @aras_p
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Author

Without access to procreate it would be difficult to test I guess.

I exported the obj from both versions of blender and opened them up in sublime text and saw something interesting.

Could it be the formatting and or the order of lines that's causing the issue?

in the old version (highlighted) the text is:

'usemtl Material.001
s off'

in the new version (highlighted) the text is:

's 0
usemtl Material.001'

Maybe it's the change from text to binary (line 's off' to 's0') that is the problem or the fact that in the new version, 's0' is above "usemtl Material.001" ?

It could explain why there is no issue importing it back into blender, maybe, I'm just guessing :)
oldobj.jpg

newobj.jpg

Without access to procreate it would be difficult to test I guess. I exported the obj from both versions of blender and opened them up in sublime text and saw something interesting. Could it be the formatting and or the order of lines that's causing the issue? in the old version (highlighted) the text is: 'usemtl Material.001 s off' in the new version (highlighted) the text is: 's 0 usemtl Material.001' Maybe it's the change from text to binary (line 's off' to 's0') that is the problem or the fact that in the new version, 's0' is above "usemtl Material.001" ? It could explain why there is no issue importing it back into blender, maybe, I'm just guessing :) ![oldobj.jpg](https://archive.blender.org/developer/F12930001/oldobj.jpg) ![newobj.jpg](https://archive.blender.org/developer/F12930002/newobj.jpg)

@kuzey I can't reproduce the issue here in Procreate. Export monkey models with multiple materials with blender 3.0 & 3.1, and yes the .obj content is slightly different like you mention above, but importing both into Procreate on iPad, everything seems to work fine.

Could you attach your "works fine" and "is broken" .obj files to the bug report?

@kuzey I can't reproduce the issue here in Procreate. Export monkey models with multiple materials with blender 3.0 & 3.1, and yes the .obj content is slightly different like you mention above, but importing both into Procreate on iPad, everything seems to work fine. Could you attach your "works fine" and "is broken" .obj files to the bug report?
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Author

I redid them, I'll include 3 files:

worksfine.obj is from 2.93.0

broken.obj is from 3.2

broken2.obj is the same as the previous one, but I selected a random square patch on the left side of the head and assigned that to one of the existing materials. This one is the most broken, it has many more layers in procreate.

Hope they help

broken2.obj

broken.obj

worksfine.obj

I redid them, I'll include 3 files: worksfine.obj is from 2.93.0 broken.obj is from 3.2 broken2.obj is the same as the previous one, but I selected a random square patch on the left side of the head and assigned that to one of the existing materials. This one is the most broken, it has many more layers in procreate. Hope they help [broken2.obj](https://archive.blender.org/developer/F12930213/broken2.obj) [broken.obj](https://archive.blender.org/developer/F12930214/broken.obj) [worksfine.obj](https://archive.blender.org/developer/F12930216/worksfine.obj)
Contributor

Added subscriber: @scurest

Added subscriber: @scurest
Contributor

The old exporter groups all faces with one material under a single usemtl line. The new exporter doesn't and switches back and forth between materials many times.

Perhaps Procreate treats each usemtl line as the start of a different "material slot", while Blender treats all usemtl M lines (with the same M) as reusing the same material slot.

I'll attach a ZIP with two .obj files of a three-material Cube that differ only in this aspect. If BrokenCube.obj is broken and WorkingCube.obj works, then you'll know this is the reason.

TestCubes.zip

The old exporter groups all faces with one material under a single `usemtl` line. The new exporter doesn't and switches back and forth between materials many times. Perhaps Procreate treats each `usemtl` line as the start of a different "material slot", while Blender treats all `usemtl M` lines (with the same M) as reusing the same material slot. I'll attach a ZIP with two .obj files of a three-material Cube that differ only in this aspect. If BrokenCube.obj is broken and WorkingCube.obj works, then you'll know this is the reason. [TestCubes.zip](https://archive.blender.org/developer/F12930511/TestCubes.zip)
Author

So the question is, which is the current industry standard?

The old way or has it changed and is Blender just using the newest convention?

I think I might report this as a bug with Procreate as well, just to be on the safe side.

If this is indeed the industry standard, would it be wise to bring back the old exporter and call it legacy for a few months or so?

Update: I Just sent a bug report to Procreate

So the question is, which is the current industry standard? The old way or has it changed and is Blender just using the newest convention? I think I might report this as a bug with Procreate as well, just to be on the safe side. If this is indeed the industry standard, would it be wise to bring back the old exporter and call it legacy for a few months or so? Update: I Just sent a bug report to Procreate

I can see an issue with the monkey repro files in Procreate, but I can't quite validate that theory with the simpler "TestCubes" case. It's as if, yes, the fact that 3.1+ obj exporter does not "group" faces by material is creating some issue for Procreate, but it's not as simple as "each usemtl group ends up creating it's own subset". Looks like the Procreate logic in obj importing is "something else".

That said, I think the best course of action would be to fix 3.1+ OBJ exporter to group faces by material again. Who knows how much other random software is out there that implicitly assumes that faces are grouped. I'll try to make that fix.

I can see an issue with the monkey repro files in Procreate, but I can't quite validate that theory with the simpler "TestCubes" case. It's as if, yes, the fact that 3.1+ obj exporter does not "group" faces by material is creating *some* issue for Procreate, but it's not as simple as "each usemtl group ends up creating it's own subset". Looks like the Procreate logic in obj importing is "something else". That said, I think the best course of action would be to fix 3.1+ OBJ exporter to group faces by material again. Who knows how much other random software is out there that implicitly assumes that faces are grouped. I'll try to make that fix.
Aras Pranckevicius self-assigned this 2022-03-17 08:52:47 +01:00

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Aras Pranckevicius changed title from new Obj exporter messes up if object has multiple materials assigned to New OBJ exporter no longer groups faces by material, causing issues with some other apps (e.g. Procreate) 2022-03-17 08:54:24 +01:00
Author

I gave the link to this thread in my Procreate bug report, hopefully it'll be useful for them going forward.

Thanks everyone and cheers :)

I gave the link to this thread in my Procreate bug report, hopefully it'll be useful for them going forward. Thanks everyone and cheers :)

This issue was referenced by b444ed2b38

This issue was referenced by b444ed2b3835f46b63c0d398ac499debbec291a2

This issue was referenced by eb1755be35

This issue was referenced by eb1755be355a7dc71e1274da53e2ba1405c08a9b

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
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
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#96511
No description provided.