Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Editor] Model importing scale #26

Closed
michaelsakharov opened this issue Nov 23, 2023 · 7 comments
Closed

[Editor] Model importing scale #26

michaelsakharov opened this issue Nov 23, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@michaelsakharov
Copy link
Owner

FBX files and some others seem to import with drastically weird scales
Seems to be related to: assimp/assimp#2166

@michaelsakharov michaelsakharov added bug Something isn't working good first issue Good for newcomers labels Nov 23, 2023
@10xJosh
Copy link
Contributor

10xJosh commented Nov 27, 2023

Ill look into this one, hopefully it goes a bit more smoothly than the other bug 😅

@michaelsakharov
Copy link
Owner Author

michaelsakharov commented Nov 27, 2023

Awesome thanks!
It seems Assimp provides some sort of Unit Scale modifier we can use to scale the models on import.

It would be done inside ModelImporter.cs
Probably on the RootNode/Gameobject which is created around 258, just do
rootNode.Scale = something
Im not sure how exactly to extract the unit scale from assimp though or how it works.

Reading the issue i linked above it might be something like:
scene.Metadata["UnitScaleFactor"].Data;

@michaelsakharov
Copy link
Owner Author

Let me know if you need a some models to test

@10xJosh
Copy link
Contributor

10xJosh commented Nov 27, 2023

Awesome thanks! It seems Assimp provides some sort of Unit Scale modifier we can use to scale the models on import.

It would be done inside ModelImporter.cs Probably on the RootNode/Gameobject which is created around 258, just do rootNode.Scale = something Im not sure how exactly to extract the unit scale from assimp though or how it works.

Reading the issue i linked above it might be something like: scene.Metadata["UnitScaleFactor"].Data;

I tried adding the rootnode stuff but im not sure it worked. I'll have to look more into it tomorrow, I'm a little in over my head here but ill figure it out.

How have you been importing the objects? I've just been putting it in the folder and going into the editor and dragging and dropping. Is there another way to import?

@michaelsakharov
Copy link
Owner Author

That is the correct way, for now, you might have to restart the editor for it to properly import the model.

@michaelsakharov
Copy link
Owner Author

Might be more to this then I initially thought.

@michaelsakharov michaelsakharov removed the good first issue Good for newcomers label Nov 28, 2023
@10xJosh 10xJosh removed their assignment Nov 28, 2023
@michaelsakharov michaelsakharov self-assigned this Nov 28, 2023
@michaelsakharov
Copy link
Owner Author

Added a GlobalScale flag for ModelImporter which may help some cases
Also added a UnitScale modifier value like unity has, this doesn't solve the issue entirely, but it provides a decent enough solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants