How to load glTF in the PlayCanvas Editor

Hi

I am learning play canvas in my own interest
i want to know about how to import/load gltf glb files in play canvas

kindly share any tutorial

Thanks in advance

Thereā€™s an external library to load GLTF. The editor (AFAIK) doesnā€™t yet support importing GLTF filesā€¦

1 Like

how and where can we run thisā€¦

is there any link to know about this

this is my projects https://playcanvas.com/editor/scene/816938

We really need glTF as part of the Editor import workflow.

The filesizes on glTF are amazing, the Editor ends up converting to a JSON which from my experience, doubles the size of the original FBX it was imported from.

Example of a mesh I just tested with 2000 tris:

  • Blender FBX export: 99KB.
  • Imported in the Editor: 216KB.
  • Blender glTF export: 11KB!!

@will @daredevildave @moka What are your opinions on integrating glTF on the Editor?

1 Like

Native loading of GLBs is already in the engine :wink:

Iā€™m waiting on the engine release for 1.28.0 to share an example of loading a GLB as a container.

We will be deprecating the JSON format in the near future and be using GLB to both model and animation data.

2 Likes

@devMidgard - Iā€™ve added you to the closed beta for FBX -> GLB import (go to Settings -> Import Tasks -> Convert to GLB), Basis compression and Templates.

2 Likes

Damn you are already deep into integrating that I see :wink:

Thanks Team, will check it out & let you know of any feedback!

1 Like

Hello there,

I still use the github library playcanvas-gltf to import my gltf models but since the last update I get the error TypeError: Cannot read property ā€˜nameā€™ of undefined at new MorphTarget.

Is there still a way to load gltf models with the new version? I donā€™t want to change to glb because I have some extra information in the gltf file that I read while loading. Thanks in advance!

Do you have a test model we can take a look at please? (As an aside, it is likely we will be deprecating the external GLTF loader repo at some point)

I have a fix PR, should get approved / merged in soon.

1 Like

and the fix is in now, sorry about missing this.

It works with the fix. Thanks a lot for the fast help! I thought so, that you will deprecate the external repo at some point. But what formats are you planning to support in the future? Do you want to support glb and obj only or are you planning to intergrate gltf or something else, too?

Currently it looks like GLB as a container and also model and animation assets. We will be deprecating the JSON model format that we are currently using and FBXs when imported will create GLBs instead.

@will
Hey Will, is there a way to add our company to the closed beta?
We would profit heavily from GLB / GLTF support in our project.

There are two sides to this.

Do you want to load existing GLB files or use the beta FBX -> GLB importer in the Editor @js-zrm?

Hi @yaustar, thanks for the quick reply.
We would love to import existing GLB files.

We currently donā€™t have full Editor support for that but it is possible.

See scene: https://playcanvas.com/editor/scene/924388
Code: https://playcanvas.com/editor/code/655732?tabs=31081107

The container asset will give you access to the model, textures, animations and materials assets in the container.

There arenā€™t many examples of this so itā€™s recommended to use the Engine source and the viewer example in the Engine repo.

Thanks for the reply.
I see. At the moment it is only possible to see and manipulate the loaded file at ā€œruntimeā€ and not in the editor, basically?

At the moment, yes. There are thoughts on what to do about this when a GLB is added to the project that havenā€™t been finalised.

If you have access to the FBX files, it is currently recommended that those to be used instead.

Thanks for clarifiaction!
The last project we did was with fbx files but would love to use a different asset pipeline this time.
We would love to export GLB files from Blender directly with all materials setup by our artists already and work with them in the editor. Looking forward to future updates :slight_smile:

1 Like