GLTF Import Export

Post Reply
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

GLTF Import Export

Post by clintonman »

NightChurchInBlender.jpg

Night Church scene exported in GLTF format and imported to Blender.
The exporter has a few limitations, so the scene needed some alterations.

First the old scene uses old format materials. I found this command to update all the materials in the scene at once.

Code: Select all

Space.ConvertToMatList(Space.CurrentScene(),'{328915F2-9B2F-43c1-9168-CBA26A9B8F43}')
I think the long number means D3D material. This might be a good command to add the the material converter.

The GLTF exporter only works with scene instanced materials, so the material converter was run to make it happen.

Finally, the exporter does not work with grouped objects, so I ran the Unencapsulate 3D to break them down. I'll try to add group support before publishing. If no groups then a script to convert groups to parenting relationships which will export.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: GLTF Import Export

Post by trueBlue »

Awesome! :bananathumb:

Code: Select all

Space.ConvertToMatList(Space.CurrentScene(),'{328915F2-9B2F-43c1-9168-CBA26A9B8F43}')
Always wondered what the above command was for
It also converts Lights and Cameras and maybe other unknowns
Any lights that have Intensity will no longer work
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: GLTF Import Export

Post by clintonman »

trueBlue wrote: 28 Oct 2023, 14:59 Awesome! :bananathumb:

Code: Select all

Space.ConvertToMatList(Space.CurrentScene(),'{328915F2-9B2F-43c1-9168-CBA26A9B8F43}')
Always wondered what the above command was for
It also converts Lights and Cameras and maybe other unknowns
Any lights that have Intensity will no longer work
Yes, I just noticed it updated a skeleton material. Maybe it can be run on individual nodes instead of the whole scene.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: GLTF Import Export

Post by trueBlue »

clintonman wrote: 28 Oct 2023, 17:04
trueBlue wrote: 28 Oct 2023, 14:59 Awesome! :bananathumb:

Code: Select all

Space.ConvertToMatList(Space.CurrentScene(),'{328915F2-9B2F-43c1-9168-CBA26A9B8F43}')
Always wondered what the above command was for
It also converts Lights and Cameras and maybe other unknowns
Any lights that have Intensity will no longer work
Yes, I just noticed it updated a skeleton material. Maybe it can be run on individual nodes instead of the whole scene.

Code: Select all

Space.ConvertToMatList(Node.FirstSelected(),'{328915F2-9B2F-43c1-9168-CBA26A9B8F43}')
First selected works

Code: Select all

Space.ConvertToMatList(Space.CurrentScene(),'{328915F2-9B2F-43c1-9168-CBA26A9B8F43}')
Space.CurrentScene() works on groups too

So the key will be to avoid Lights, Cameras, and whatever else
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: GLTF Import Export

Post by clintonman »

BackYardGLTFtoBlender.jpg

Did a lot of testing and fixing. This is the BackYard scene transferred via GLTF to Blender.
The only issue is the floor. The color and normal bitmaps had the same filename so the color got overwritten during the export.

Things todo before release:

A script to ungroup or convert groups to parenting structures. Adding group support to the plugin would be more work than it's worth.

Cleanup script to remove temporary objects and add the imported items directly to the scene.

I'm hopeful for a release tomorrow.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: GLTF Import Export

Post by clintonman »

GLTFExportDucati.jpg

This shows the "ungroup all" function working. The Ducati scene from modelspace has a lot of groups and groups inside groups. After un-grouping the process is the same, convert materials to scene instanced and export.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: GLTF Import Export

Post by clintonman »

Already found/discovered a new issue with actor import export.

Truespace actor structure is different from everyone else in that the mesh is parented to the skeleton, that's to say that the OwnerMatrix is connected to the skeleton WldMatrix and both live inside the actor. The skeleton is connected to the actor internally. In other programs the mesh and the skeleton are both attached internally to the actor.

Notes for the export say actor, skeleton and mesh have to all be at 0,0,0 with 0 rotations. The tS actor structure is the reason for this.

I'm going to try to find a way to properly translate between the different structures later this week. For collada export I see that truespace moves the mesh out of the actor.
Clinton Reese

http://clintons3d.com
garcia
Petty Officer First Class
Posts: 65
Joined: 23 Jan 2023, 02:51
Type the number ten into the box: 10

Re: GLTF Import Export

Post by garcia »

impressive!
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: GLTF Import Export

Post by trueBlue »

A Beautiful Game
glTF-Sample-Models-master\2.0\ABeautifulGame\glTF
I scaled all of the 2048x2048 images to 256x256
I Imported the ABeautifulGame.gltf into Rosetta UU9
I changed all of the TextureBumpMetal's SpecularStrength to 1.000
Saved the scene to a Library
Before.png
.
I unencapsulated all of the objects and Exported the scene to C:\Temp\New folder
Note to self: Never Export to the Desktop and Always Export to an Empty Folder :o
Cleared the scene and Imported this Exported - A Beautiful Game.gltf file
After.png
.
I think the Infinite lights Imported as Spotlights
The materials are not the same
The Chessboard mesh is messed up
Floating unconnected points.png
.
Looks like a lot of unconnected floating points
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: GLTF Import Export

Post by clintonman »

ChessBoardExported.jpg

Imported and Exported
Import to Blender

The board is messed up. When I take it into model mode it shows the magic number of 65536 vertices. The original in tS says 108441 verts.
Import the original file into Blender and it also shows 108441 verts.
I think something in the plugin is using a "unsigned short" data type which is limited 0 to 65536. hopefully it's that simple...

Not surprised about the materials. It was imported to tS with some loss of data then exported from tS again with some loss. Maybe some of it can be fixed but there is a big difference in the materials in tS and those used in glTF files. There should be less loss if you select High Material Complexity when importing.
Clinton Reese

http://clintons3d.com
Post Reply