Improvements in Model Import Tool

The model import tool now covers the most common “problem case” for model imports as well: missing textures or textures that cannot be referenced from the import root folder.

As you know, the path for images and other assets is stored with an absolute path when a j3o file is created. This is why the model import tool needs to know where to put the j3o in advance. Its also why the “trick” with importing the model to the “Textures” folder and then just moving the j3o file to “Models” works / is needed. Furthermore its why references to textures all over the harddisk pose a problem: all the paths would have to be replicated in the project assets folder (yep, like your whole harddisk), otherwise the model could not find its textures when deployed to the user in an application because the user doesn’t have all those files on his harddisk. Even adding locators for all image folders is dangerous because you effectively flatten the assetManagers paths and all “texture.jpg” references in the model would link to the same file.

So until now the model import tool asked you to keep all textures and texture subfolders together in one folder with the model. This structure can then be replicated in a folder inside your projects assets and be available when creating the j3o file as well as when your users load the next level :slight_smile: As for example the ogre exporter puts the textures next to the file, this is easy to achieve in most cases but if you had existing models with references to external images you probably were at a loss.

But now, things have changed :wink: The model import tool will find textures that are referenced as “…/…/…/Textures/MyTexture.png” or “c:/blah/myFiles/tetxure.jpg” and even if it doesn’t, it will allow you to find the right texture yourself:

The texture will be copied to the designated import folder and the whole model will be scanned. Any geometry with materials that have texture references that had to be relocated will be replaced with the correct reference. So when loading the then created j3o file, the textures in the assets folder will be correctly referenced.

As probably those of you who tried to bake their own j3o importers know, this is/was quite complicated to do :wink: Model importers have to play well and not forget the texture key name etc. if the actual unguided mapping is supposed to work among other things. This feature is mainly helpful for external assets that are not created for the project. You should still follow the guidelines for the asset pipeline when setting up your projects and creating assets to avoid such issues in the first place.

Happy importing :smiley:
Normen

5 Likes

Many thanks @Normen. Very useful, as always :wink:

1 Like