2
\$\begingroup\$

I need to import model in OpenGL via Fbx SdK, and for testing purposes I created a simple box centered in the (0, 0, 0), length 3, in 3ds max. Here's the image: enter image description here

But when i exported it, and imported in the OpenGL it wasn't in the center. Then I exported it in ASCII format, and opened the file in Notepad, and really Z coordinates were 0, and 3. When I converted model to editable mesh and checked every vertex in 3ds max it had expected (+-1.5, +-1.5, +-1.5) coordinates. Can anyone help me with this one? I'm really stuck. I tried to change whole bunch of parameters in 3ds max export, but every time it changes Z koordinate.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

By the look of the gizmo attached to your cube in the image, your cube appears to have its local origin in the center of the bottom face which gives the vertices on the bottom face a local z value of 0 and the vertices on the top face a local z value of 3.

So to make the cube appear centered in the world origin, there is a matrix (transform) that when applied (and 3ds is applying it in your image), scoots all the vertices down for rendering 1.5 and makes it appear as if the vertices were at 1.5 & -1.5.

In the fbx export file, you get both the original vertices and that transform. Most likely, you drew just the original vertices without applying the transform to them.

To solve it, grab the transform while parsing the fbx and apply it to the vertices or go back to 3ds and reset the transform to change the local origin from the bottom face to the center of the cube and re-export.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .