glTF import and export (webGL, Paint3D)

My first extensions have been published to the Sketchup Extension Warehouse.
Special thanks, hugs, and cookies to @ThomThom, who helped me get over the hurdle of validation.

http://extensions.sketchup.com/en/content/gltf-exporter
http://extensions.sketchup.com/en/content/gltf-import

With the glTF importer, you can download the glTF models from https://sketchfab.com and import them into Sketchup.

With the glTF exporter, you can take your Sketchup creations into Microsoft Paint3D for painting. (It does the texture mapping for you, so just start painting!).

Both are free.

The glTF 2.0 file format (glTF Overview - The Khronos Group Inc) is the new standard in 3D file formats which should eventually replace Collada DAE. It is envisioned to be the ‘JPEG of 3D’. I hope that one day Sketchup will support import and export of glTF 2.0 natively.

glTF Geometry is stored in binary form. This makes it faster to load, with smaller file size, and not prone to information loss.

The exporter has three options: Embedded glTF, Binary glTF (.glb), and a Binary glTF (.glb) which creates a GLB file compatible with the initial release of Microsoft Paint3D.

The glTF importer uses the surface normals defined in the glTF geometry to determine if an edge is smooth.

Presently the workflow of Sketchup → Paint3D → Sketchup doesn’t work very well because of issues with Scaling (and rotations made in Paint3D change your model, not just the view), hopefully Microsoft will fix this in later versions of Paint3D.

Limitations:
Exporter will only export triangle meshes, so no lines (for now)
Importer will not import lines either. (Let me know if you need lines!)
The Importer is very slow when dealing with large geometry, so you will need to be patient.

Feedback welcome!

7 Likes

It looks hopeful. I have a model importing, if it finishes at some point I’ll tell you how it looks!

Didn’t notice when it had finished, but it looks good.

1 Like

Saving the SKP had some things to fix. Here’s the list:
Results of Validity Check.

The front or back texture coordinates for CFaceTextureCoords (485147) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (506777) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (506794) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (506810) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (533610) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (533627) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (533643) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (600660) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (600679) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (600697) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (600837) is not valid - fixed
The front or back texture coordinates for CFaceTextureCoords (600896) is not valid - fixed

and so on for another bunch of lines.

Thanks for testing!

I’m sure I can locate that model on SketchFab if that is where you got it from, and I will take a look at the texture issues.

There might be a scale issue there as well.

1 Like

This one:

https://sketchfab.com/models/e18c433cdd1c49f8ac152348b7384037

I didn’t change the scale, and it looks only a little bit too big for T Rex.

I’ve seen a T-Rex, (not a live one), and they are big, but not that big!

I can confirm that the scale issue is either in the original fbx file or is in the SketchFab exporter - it is unscaled in the glTF file and the geometry really is that size. The only scale I apply in the extension is to convert glTF’s meters to Sketchup’s inches.

Interestingly, I didn’t have any issues with the texture during save, and nothing was reported as needing to be fixed - it may be a difference with the Mac version?

One thing I did notice is that the eyes were not textured. That may need further investigation.

Edit: Found the issue there, the eyes were being textured but there is a transparent layer over the eyes, and I am not setting the transparency properly - that will require a fix to the importer.

1 Like

Thanks for the plugin! Looks promising and working quite well so far. Please consider to upload it to SketchUcation Pluginstore as well.

Some feedbacks:
1- Consider adding import option to Extensions > Khronos gITF
2- We should be able to name our export rather than autoname with saved .skp model.


Also there is an online glTF viewer to see models quickly. (I found out it from the embedded glTF demo here, feels very lightweight. It’s WebGL right?

Testing to see how it goes in forum:


One issue with above viewer: when i upload a glTF model that i get from Sketchfab, it doesn’t appear but exported glTF models from SketchUp works fine. Why that might be?


Found a good material to read (pdf): glTF 2.0 Launch . It has quite useful/interesting links inside such as: glTF-WebGL-PBR.

OK, I’ve pushed out version 1.2.1, which fixes the transparency issue…

@filibis,

  1. That is a good idea, but I think the complication there is that if two extensions create the same top level menu item, then there will be two menu items created. It really is an issue with the Sketchup API - I think I’ve read somewhere of a workaround for this from DanRathbun, or some other master developer, it may warrant looking into and it would certainly appear nicer. It is a pity there is no export API like there is the import API, so it could appear in the export menu.

  2. Also a good idea, I will look at how that is implemented, and push out a new release.

Don McCurdy’s glTF viewer was what I used for the most part to develop this extension, that and the glTF Validator (glTF Validator) and yes, it is WebGL.

The glTF specification is here: glTF/specification/2.0 at main · KhronosGroup/glTF · GitHub

Models from SketchFab are a bit strange - bad orientations etc, and some don’t validate in the above validator, which they should. Also they use extension materials, and not the standard PBR (Physically Based Materials). I also note that some models fail to have a glTF file generated, and looking at the source models, it is often because they use different image formats such as TGA or DDS instead of the more usual JPeg and PNG.

I will look into uploading to SketchUcation, but I wasn’t particularly impressed by their website requiring users to login for a a free download - so no promises there.

Thanks for the feedback!

2 Likes

The reason i suggested is that they have very useful plugin called: ExtensionStore which you can think it as advanced version of Extension Manager. Some notable features are bundles and tracking/making updates of installed plugins.

They also have a nice and active community/forum.

1 Like

Congratulations. Well done with these.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.