leozide / leocad

A CAD application for creating virtual LEGO models
https://www.leocad.org
2.45k stars 205 forks source link

OBJ Export orientation issue #497

Closed nathaneltitane closed 2 years ago

nathaneltitane commented 4 years ago

Exporting object files results in a rotated coordinate system upon opening with a viewer.

image

VS

image

leozide commented 4 years ago

OBJ is just a file format, there's no right or wrong way to choose the orientation. The viewer you're using chose a certain orientation and other viewers have different orientations, if I change this it will "break" something else.

nathaneltitane commented 4 years ago

OBJ is just a file format, there's no right or wrong way to choose the orientation. The viewer you're using chose a certain orientation and other viewers have different orientations, if I change this it will "break" something else.

Understood... just a bummer because i figured they'd be useful under windows to preview file contents using the built-in 3D Viewer.

Any chance you could have an orientation correction/selection dialog built into the exporter?

nathaneltitane commented 2 years ago

OBJ is just a file format, there's no right or wrong way to choose the orientation. The viewer you're using chose a certain orientation and other viewers have different orientations, if I change this it will "break" something else.

turns out that there is no consistency in the axis orientation that leocad seems to specify for exports: at the very least, under a proper case scenario, one would expect leocad to output the model export as it is oriented in model space.

In the case of this ticket, collada respects the orientation but not wavefront - after switching from collada to wavefront due to transparency related issues on a threejs web rendering canvas i wrote for my gallery, none of the paramaters for orientation, position and scale are being respected due to the changes brought by using wavefront exports.

see here via bleander import (no odifications to file whatsoever: take note of placement, scale and orientation...)

Screenshot_20220417_231632

EDIT: after further inspection, and relative to other tickets regarding materials and transparencey, it seems that collada material shaders work fine now but the wavefront mtl file reads opaque (right)

leozide commented 2 years ago

All formats are exported the same way, the lack of consistency is in the importer app.

nathaneltitane commented 2 years ago

All formats are exported the same way, the lack of consistency is in the importer app.

@leozide @Genome36

From a purely engineering standpoint, I understand your perspective on the matter, but if you were to look at it from a user'S perspective (with said user not knowing anything about imports, exports, standards etc) one should expect the result of the export to mimic/duplicate exactly what has been set into leocad's model space.

None of the viewers i have used thus far, when using obj/mtl specify the right orientation ('right' being the same orientation that is specified in leocad)

here is yet another example of a third party online viewer in which i have dropped an obj/mtl exported by leocad without any changes to it whatsoever

Screenshot_20220419_155914

here is the collada export (materials did not resolve so i set it to x-ray / wireframe):

Screenshot_20220419_160417

at the very least: 1 - Since orientation changes for wavefront, could there be an option to specify the up axis on export from within leocad to ensure orientation is respected? 2 - hardcode an orientation correction for wavefront to specify correct Zup axis position and have the model show exactly as it should?