Direct loading of FBX files

Is it possible to load a fbx file? I tried to modify (just changed the path from statue.json to my fbx model) the load_model example from the repository but it didnt work. For my current project i need to load dynamicly generated fbx files. Is there a way to realize this in Playcanvas?

Playcanvas can only load from the JSON format. Fortunately the JSON format is pretty human-readable. Open it up in a text editor and take a look.

So you could either generate the models in JSON format (or even directly inside the game engine), or write a converter from FBX to json.

In theory, yes, it is possible to load an FBX file at runtime. In reality, FBX is designed to be an interchange format for graphics applications not a runtime engine format, which is why we don’t have support for loading them in the engine.

To see how models are loaded. Take a look at resources_model.js and parser_jsonmodel.js in the github repo. Currently the JSON format is the only format we support, but if you write a new parser you could patch it into the model resource loader and load from any format you like.

Also, it’s worth pointing out, in case there has been a misunderstanding…

To use FBX files in your playcanvas project, you can simply drag the FBX into the asset panel in the editor. We convert the FBX into the json format which is designed to be small and fast for runtime performance. Then you can just add you model to the scene.

Hey Dave, just a quick question. Is the code to convert FBX into the json format of playcanvas available in the engine? or it’s just part of the playcanvas editor asset pipeline which i assume runs in the server side of playcanvas editor?

Dam, i can’t use the PC Webeditor because the FBX models will be uploadet by the ‘user’ in my current project. I would like to use PC to build a 3D asset library with realtime gallery/preview.

This is actually a good question.

Is there an example of:

  • loading an external file
  • detecting it as an FBX and sending it over to the FBX-to-JSON parser
  • loading the resulting JSON + texture + animation files at runtime

That would be great.