playcanvas / editor

Issue tracker for the PlayCanvas Editor
https://playcanvas.com/
159 stars 28 forks source link

GLB Import #485

Closed eddy18891 closed 1 year ago

eddy18891 commented 3 years ago

Edit from the PlayCanvas team: This has been moved to a new ticket to track progress and support for specific features: https://github.com/playcanvas/editor/issues/963

Hi all,

I have a frequent issue where I need to use glb files in PlayCanvas but they are not easily accessible in the editor's scene viewer. In order to use these assets, I incorporated the scripts found in this example project: https://playcanvas.com/project/730738/overview/loading-gltf-glbs

However, this solution is difficult to work with because it does not scale well if I have a library of assets to load. It also doesn't preview my work in the editor scene because everything is loaded at launch, which can be very difficult to work with.

I'm working with glb files because Blender creates quite a few animation issues when I export as an fbx file. It is also more convenient in PlayCanvas because all of my asset data is contained in a single glb file.

slimbuck commented 3 years ago

Hi @eddy18891,

Yeah totally agree. We have plans to support glb in editor for sure, though no timeline as yet.

Thanks!

eXponenta commented 2 years ago

GLTF is generic transmission format (not only for web), FBX outdated as fact and proprietary.

A lot of 3D models is use GLTF as main format and only support it as export target, other not garateed a valid materials/animation.

I was surprised that editor still not support GLTF for impor but support GLB as internal format.

Yep, we can use GLTF internally with manual loading process, but this is not useful fore editor because require manual managment and placementes, that is problematic for a lot of designers that use editor.

GLTF spec released at 2015 and latest revision was passed at 2017, this is stable very popular ad special designed transmission format. First support for PC was requested at 2019 and still not timelined.

https://forum.playcanvas.com/t/how-to-load-gltf-in-the-playcanvas-editor/11160

yaustar commented 2 years ago

@eXponenta One of the questions that we have in the air is what happens when you import a GLB to the Editor and what user expectations are?

Should it behave like a FBX where it becomes a source asset and creates a GLB asset with animation, render, template, texture and material assets? Or something else entirely?

This year, we will be focusing on the GLTF format and looking to update the roadmap for 2022 soon :)

eXponenta commented 2 years ago

Expected that it will emit material, template and asset model component.

Or will ok if editor will support RAW gltf as model component (with fixed material, node tree etc), which will be presented in editor space without running application.

We use a hack atm: we create special dummy node with GLTF loader from asset and place it on scene. This is works, but looks like as Hammer editor from Valve with cube placements, and wery problematic to contol something manually from editor. For static environment this not useful at all.

Maksims commented 2 years ago

If gltf has textures and other assets in it, it should extract them, to give control to a developer for reusing assets. Many other engines benefit from simplicity of loading gltf with textures in it, but they don't have Editor. So reusing textures between gltf models, has to be same as reusing them with FBX's. No difference there.

This gives flexibility to a developer, and provides better integration with an engine.

insof commented 2 years ago

Bump, still need it.

ki11roy commented 2 years ago

We need this feature too.

yaustar commented 2 years ago

Currently a bandwidth issue at the moment with the team. We are considering doing a stop gap solution where you can upload a GLB as a container/gltf binary so that it can render in the Editor as a self contained model (ie you can't edit textures, materials, etc in the Editor but you can view it, scale the parent, position it etc) while we get the import as hierarchy underway.

No firm decisions yet though. However, it is something we would like to do sooner rather than later.

yinchy commented 2 years ago

Still very very keen to have in-editor glb loading. I see gltf/glb format support rising everywhere and it is a curious and painful hurdle that I can't load a glb viewably in the editor

yaustar commented 2 years ago

@yinchy This is something that is high on our priority list and it's a bit tricky about how we would import into the Editor.

The ideal would be that we treat like an FBX and split out all the assets. The downsides to doing that are that the GLTF spec allows for custom data to be added and the materials created/needed for the spec don't map well with the Standard Material used by the Editor

So we need to work out have that all be compatible with limiting ourselves in the feature

CodyPChristian commented 2 years ago

Currently a bandwidth issue at the moment with the team. We are considering doing a stop gap solution where you can upload a GLB as a container/gltf binary so that it can render in the Editor as a self contained model (ie you can't edit textures, materials, etc in the Editor but you can view it, scale the parent, position it etc) while we get the import as hierarchy underway.

No firm decisions yet though. However, it is something we would like to do sooner rather than later.

This would be a great solution for now, not being able to see my models in editor makes it hard to position things. Also I noticed when loading the gtlfs at runtime there is no collision generated. I had to mess with a work around to load in a low-poly mesh and append it via code to add collisions.

yaustar commented 2 years ago

You can add a mesh collision to GLB models loaded at runtime as seen in this example: https://developer.playcanvas.com/en/tutorials/first-person-shooter-starter-kit/

Specific code: https://playcanvas.com/editor/code/626211?tabs=51215998

yaustar commented 2 years ago

I've made some Editor extensions that can load the GLBs in the Editor for viewing as a stopgap for myself https://github.com/yaustar/yaustar.github.io/tree/master/playcanvas-editor-api-tools

marcusx2 commented 2 years ago

There's this plugin for Unity that can serve as inspiration.

yaustar commented 1 year ago

Created a new ticket for this so that we can track stages of work for this :) : https://github.com/playcanvas/editor/issues/963

Expect an Editor release tomorrow that adds initial support https://github.com/playcanvas/editor/releases/tag/v1.24.0