New obj exporter: Scale factor is applied incorrectly #96415

Closed
opened 2022-03-13 22:41:55 +01:00 by Yahya Janani · 15 comments

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: c77597cd0e
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.0 3.1.0
image.png image.png

Test File:
#96415.blend

**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: `c77597cd0e` 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.0 | 3.1.0 | | -- | -- | | ![image.png](https://archive.blender.org/developer/F12926661/image.png) | ![image.png](https://archive.blender.org/developer/F12926663/image.png) | Test File: [#96415.blend](https://archive.blender.org/developer/F12926666/T96415.blend)
Author

Added subscriber: @yaiiaj

Added subscriber: @yaiiaj
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

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?

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?
Author

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.
pic h.jpg pic_e.jpg pic_i.jpg

Thank you again.

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. ![pic h.jpg](https://archive.blender.org/developer/F12926343/pic_h.jpg) ![pic_e.jpg](https://archive.blender.org/developer/F12926351/pic_e.jpg) ![pic_i.jpg](https://archive.blender.org/developer/F12926369/pic_i.jpg) Thank you again.
Contributor

Added subscriber: @scurest

Added subscriber: @scurest
Contributor

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.

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](https://github.com/blender/blender/blob/8eb189925e028a480d13e43d60216b98b73cfa16/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc#L242-L243) will fix it.
Member

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

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

Thank you very much.

Thank you very much.
Member

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

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

Added subscriber: @howardt

Added subscriber: @howardt
Member

Probably swapping these lines will fix it.

@scurest's suggestion actually works for me.
@howardt , can you take a look?

> Probably swapping [these lines](https://github.com/blender/blender/blob/8eb189925e028a480d13e43d60216b98b73cfa16/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc#L242-L243) will fix it. @scurest's suggestion actually works for me. @howardt , can you take a look?
Pratik Borhade changed title from obj export problem to New obj exporter: Scale factor is applied incorrectly 2022-03-15 12:43:33 +01:00
Aras Pranckevicius self-assigned this 2022-03-15 12:48:58 +01:00

This issue was referenced by 9ed566efb6

This issue was referenced by 9ed566efb67a20c66e6d8c2965546b89bdd9764e

This issue was referenced by 5bfdaaa800

This issue was referenced by 5bfdaaa80082be12af9850a2af294823005abb72
Member

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#96415
No description provided.