Maniphest T96415

New obj exporter: Scale factor is applied incorrectly
Closed, Resolved

Assigned To
Aras Pranckevicius (aras_p)
Authored By
Yahya Janani (yaiiaj)
Mar 13 2022, 10:41 PM
Tags
  • BF Blender
  • Import/Export
Subscribers
Howard Trickey (howardt)
Pratik Borhade (PratikPB2123)
Scurest (scurest)
Yahya Janani (yaiiaj)

Description

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: GeForce 840M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 388.73

Blender Version
Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: rBc77597cd0e15
Worked: (newest version of Blender that worked as expected)

Short description of error
There is not an error but it's a little problem to exporting object(s) as .obj format from blender to maya.
I tested it on my own lap top and our studio's computers too and got same result at all of them.

In previous versions, the position of all vertices of an imported object was maintained in wherever they were in blender, and only the origin was moved to the (0, 0, 0) which was true.
In the new version, all verts position is shifted along with object's origin

Exact steps for others to reproduce the error

  • Open .blend file in previous version (say 3.0.0)
  • Export object in .obj format. In obj export settings , set scale to 10
  • Open default scene -> delete everything -> Import back the .obj file
  • Open same .blend file in 3.1 release
  • Export object in .obj format. In obj export settings , set scale to 10
  • Open default scene -> delete everything -> Import back the .obj file
3.0.03.1.0

Test File:

Revisions and Commits

rB Blender
Closed

Event Timeline

Yahya Janani (yaiiaj) created this task.Mar 13 2022, 10:41 PM
Pratik Borhade (PratikPB2123) changed the task status from Needs Triage to Needs Information from User.Mar 14 2022, 4:32 AM
Pratik Borhade (PratikPB2123) added a subscriber: Pratik Borhade (PratikPB2123).

Hi, thanks for the report.
In both the cases object origin has moved to world origin (as shown in the image).
So what exactly the issue is? Or is that the issue itself?

Yahya Janani (yaiiaj) added a comment.Mar 14 2022, 8:55 AM

Hello dear Pratik and thank you for your answer.
If you look closely at the pictures, I'm not just talking about origin itself but about vertices.
In previous versions, the position of all vertices of an imported object was maintained in wherever they were in blender, and only the origin was moved to the (0, 0, 0) which was true.
In the new version, the movement of all vertices with origin is problematic, not just the origin itself.

Thank you again.

Scurest (scurest) added a subscriber: Scurest (scurest).Mar 14 2022, 11:48 AM

Looks like the Python exporter transforms verts with

scaling_factor @ axis_conversion @ ob_mat

while the C++ exporter is using

axis_conversion @ ob_mat @ scaling_factor

The difference is in the latter, the scaling factor does not affect the translation in ob_mat.

Probably swapping these lines will fix it.

Pratik Borhade (PratikPB2123) added a comment.EditedMar 14 2022, 12:25 PM

Now I see, thanks for clarifying. I will make some edits in task description before confirming
I've not tested the proposed fix yet but will do in a bit :)

Yahya Janani (yaiiaj) added a comment.Mar 14 2022, 12:37 PM

Thank you very much.

Pratik Borhade (PratikPB2123) changed the task status from Needs Information from User to Confirmed.Mar 14 2022, 12:38 PM
Pratik Borhade (PratikPB2123) updated the task description.
Pratik Borhade (PratikPB2123) updated the task description.
Pratik Borhade (PratikPB2123) added a project: Import/Export.
Pratik Borhade (PratikPB2123) added a subscriber: Howard Trickey (howardt).Mar 14 2022, 1:00 PM

Probably swapping these lines will fix it.

@Scurest (scurest)'s suggestion actually works for me.
@Howard Trickey (howardt) , can you take a look?

Pratik Borhade (PratikPB2123) renamed this task from obj export problem to New obj exporter: Scale factor is applied incorrectly .Mar 15 2022, 12:43 PM
Aras Pranckevicius (aras_p) claimed this task.Mar 15 2022, 12:48 PM
Howard Trickey (howardt) closed this task as Resolved by committing rB5bfdaaa80082: Fix T96415: new OBJ exporter was applying scaling factor incorrectly.Mar 19 2022, 10:17 PM
Howard Trickey (howardt) added a commit: rB5bfdaaa80082: Fix T96415: new OBJ exporter was applying scaling factor incorrectly.
Aras Pranckevicius (aras_p) added a commit: rB9ed566efb67a: Fix T96415: new OBJ exporter was applying scaling factor incorrectly.Mar 23 2022, 12:23 PM