stephomi / sculptgl

DEVELOPMENT STOPPED I'm now working on Nomad Sculpt instead
https://stephaneginier.com/sculptgl/
MIT License
1.39k stars 360 forks source link

Set pivot point to centre in exportOBJ file #96

Closed xyzdcgan closed 5 years ago

xyzdcgan commented 5 years ago

Hi @stephomi

When we export any 3D file in .sgl format which uses exportSGL file, the pivot is set to center of the 3D object, but if we export that in obj format the pivot is not set in centre.

Can you please help in that so that pivot is set to centre while we export 3D object in obj format

Thanks @stephomi

stephomi commented 5 years ago

Hi, sorry for the long delay in the reply but I don't maintain sculptgl anymore.

The issue is that OBJ can't store matrix information so I bake the matrix in the vertices, thus the matrix/pivot information is lost for good.

The baking is done here: https://github.com/stephomi/sculptgl/blob/88de649a9ae2e6ee4b0413f450cbe54a714402b3/src/files/ExportOBJ.js#L60-L71

PLY and STL can't store matrix information either, so there is no clean solution to your problem.