Jump to content

FBX Model Shrinks On Import


gamecreator
 Share

Recommended Posts

I exported the attached FBX from Max.  On importing into the editor, it gets shrunk down greatly.

The attached FBX is simply a right triangle which I created with vertices at 0,0,0 0,1,1 and 0,1,0.  If you open the FBX with a text editor you see the points represented like so

Quote

        Vertices: *9 {
            a: -0.5,-0.5,0,0.5,-0.5,0,0.5,0.5,0

I don't know why it's off by 0.5 but whatever; the triangle is 1 wide and 1 high, just as I created it in Max.  However, when I import it into the Editor and then run the code at the bottom of this post, it prints the following:

Quote

vertex 0: 0.010000, -0.000000, 0.000000
vertex 1: 0.010000, 0.010000, 0.000000
vertex 2: 0.000000, -0.000000, 0.000000

Any idea why?  Seems like Leadwerks shrinks it to 1/100th of its size for some reason (you can't even see it in the Editor Model Viewer (which I guess could be another bug report since the Viewer doesn't zoom in properly)).

#include "Leadwerks.h"

using namespace Leadwerks;

Model* model;


int main(int argc, const char *argv[])
{
	Leadwerks::Window* window = Leadwerks::Window::Create();
	Context* context = Context::Create(window);
	World* world = World::Create();

	Camera* camera = Camera::Create();
    camera->SetRotation(15, 0, 0);
    camera->Move(0, 0, -0.3);

	Light* light = DirectionalLight::Create();
	light->SetRotation(35, 35, 0);

	model = Model::Load("Models/triangle.mdl");

	while (true)
	{
		if(window->Closed() || window->KeyDown(Key::Escape)) return false;

		if(window->KeyHit(Key::Enter))
		{
			//  Print vertex coordinates
			for(int i=0; i<((Model *)model->GetChild(0))->GetSurface(0)->CountVertices(); i++)
			{
				Vec3 vp=((Model *)model->GetChild(0))->GetSurface(0)->GetVertexPosition(i);
				printf("vertex %d: %f, %f, %f\n",i,vp.x,vp.y,vp.z);
			}
		}

		Leadwerks::Time::Update();
		world->Update();
		world->Render();
		context->Sync();
	}
    return 0;
}


 

triangle.FBX

Link to comment
Share on other sites

Seems like that would make sense.  I'm going to compare this file to another one I also created in Max that imported fine.

Edit: you're right.  I created a custom shape a few days ago that was in meters and I swear I didn't change any settings (I don't even know where they are).  Maybe I opened another file before that and File->Reset didn't/doesn't change the scale?  Can be closed.  Sorry.

Edit 2: anyone else that comes across this, go to Customize, Unit Setup, then System Unit Setup button to make sure you're working in the right scale.  You don't need to resize anything, changing that setting seems to export correctly afterwards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...