Maniphest T96511

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

Assigned To
Aras Pranckevicius (aras_p)
Authored By
Kuzey (Kuzey)
Mar 16 2022, 4:01 AM
Tags
  • BF Blender
  • Import/Export
  • Pipeline, Assets & I/O
Subscribers
Aras Pranckevicius (aras_p)
Kuzey (Kuzey)
Pratik Borhade (PratikPB2123)
Scurest (scurest)

Description

Blender Version
Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-03-14 19:06, hash: rBfc259d4c30cb
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

Revisions and Commits

rB Blender
D14368
D14368

Related Objects

Mentioned In
T96241: 3.1: Potential candidates for corrective releases
rBL62859: Update OBJ test output expectations for T96511 fix
D14368: Fix T96511: New OBJ exporter no longer groups faces by material
Mentioned Here
M1: Bevel Tool Toolbar Layout - Multiple Overflow Popovers

Event Timeline

Kuzey (Kuzey) created this task.Mar 16 2022, 4:01 AM
Pratik Borhade (PratikPB2123) added a subscriber: Pratik Borhade (PratikPB2123).Mar 16 2022, 6:39 AM
Pratik Borhade (PratikPB2123) changed the task status from Needs Triage to Needs Information from User.Mar 16 2022, 6:59 AM

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?

Kuzey (Kuzey) added a comment.Mar 16 2022, 7:22 AM

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

Pratik Borhade (PratikPB2123) added a comment.Mar 16 2022, 7:58 AM

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.

Aras Pranckevicius (aras_p) added a subscriber: Aras Pranckevicius (aras_p).Mar 16 2022, 8:15 AM
Pratik Borhade (PratikPB2123) changed the task status from Needs Information from User to Needs Triage.Mar 16 2022, 9:37 AM
Kuzey (Kuzey) added a comment.Mar 16 2022, 12:30 PM

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 :)

Aras Pranckevicius (aras_p) added a comment.Mar 16 2022, 2:41 PM

@Kuzey (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?

Pratik Borhade (PratikPB2123) changed the task status from Needs Triage to Needs Information from User.Mar 16 2022, 2:49 PM
Kuzey (Kuzey) added a comment.Mar 16 2022, 3:22 PM

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

Scurest (scurest) added a subscriber: Scurest (scurest).EditedMar 16 2022, 8:17 PM

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.

Kuzey (Kuzey) added a comment.EditedMar 17 2022, 6:27 AM

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

Aras Pranckevicius (aras_p) added a comment.Mar 17 2022, 8:52 AM

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 (aras_p) renamed this task 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).Mar 17 2022, 8:52 AM
Aras Pranckevicius (aras_p) changed the task status from Needs Information from User to Confirmed.
Aras Pranckevicius (aras_p) claimed this task.
Aras Pranckevicius (aras_p) updated the task description.
Aras Pranckevicius (aras_p) added projects: Import/Export, Pipeline, Assets & I/O.
Aras Pranckevicius (aras_p) changed the subtype of this task from "Report" to "Bug".
Kuzey (Kuzey) added a comment.Mar 17 2022, 11:23 AM

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 :)

Bastien Montagne (mont29) moved this task from Backlog to Bugs on the Pipeline, Assets & I/O board.Mar 20 2022, 4:43 PM
Aras Pranckevicius (aras_p) mentioned this in rBL62859: Update OBJ test output expectations for T96511 fix.Mar 21 2022, 7:19 PM
Aras Pranckevicius (aras_p) closed this task as Resolved by committing rBeb1755be355a: Fix T96511: New OBJ exporter no longer groups faces by material.Mar 21 2022, 7:21 PM
Aras Pranckevicius (aras_p) added a commit: rBeb1755be355a: Fix T96511: New OBJ exporter no longer groups faces by material.
Aras Pranckevicius (aras_p) added a commit: rBb444ed2b3835: Fix T96511: New OBJ exporter no longer groups faces by material.Mar 23 2022, 12:23 PM