GLTF Import Export

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: 08 Nov 2023, 17:33 Dang it Jim, I just converted several textures for nothing! :(
Much better!
I can actually see the Cloth Texture
Cloth texture.png

On a different note, pressing the Apply Morphs button is throwing errors
Examples:
With nothing selected, press Apply Morph
Select a primitive, press Apply Morphs, and Cancel "Convert to an Editable mesh?" dialog
Most likely other examples...

Edit: Using "Individual Mesh Primitives" creates a lot of Nulls
Flatten Nulls.png
.
Is there any way to create a script that Flattens the Nulls?
Fixed Apply Morphs errors - not released yet.

Use of "Individual Mesh Primitives" should be rare. For most things leave it off. It was created because of the Sponza single object with many materials slowing down trueSpace and then no other samples had that problem so... don't use it unless you have to.

I forgot to mention earlier, but you can use a viewer page to see what the gltf samples looks like in 3d

https://github.khronos.org/glTF-Sample-Viewer-Release/
Clinton Reese

http://clintons3d.com
User avatar
the_ant
Chief Petty Officer
Posts: 149
Joined: 02 Jun 2009, 09:26
Type the number ten into the box: 0
Location: Perugia - Italy

Re: GLTF Import Export

Post by the_ant »

:worship: :worship: :worship: :worship:
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: 12 Nov 2023, 06:11
trueBlue wrote: 08 Nov 2023, 17:33 Dang it Jim, I just converted several textures for nothing! :(
Much better!
I can actually see the Cloth Texture
Cloth texture.png

On a different note, pressing the Apply Morphs button is throwing errors
Examples:
With nothing selected, press Apply Morph
Select a primitive, press Apply Morphs, and Cancel "Convert to an Editable mesh?" dialog
Most likely other examples...

Edit: Using "Individual Mesh Primitives" creates a lot of Nulls
Flatten Nulls.png
.
Is there any way to create a script that Flattens the Nulls?
Fixed Apply Morphs errors - not released yet.

Use of "Individual Mesh Primitives" should be rare. For most things leave it off. It was created because of the Sponza single object with many materials slowing down trueSpace and then no other samples had that problem so... don't use it unless you have to.

I forgot to mention earlier, but you can use a viewer page to see what the gltf samples looks like in 3d

https://github.khronos.org/glTF-Sample-Viewer-Release/
:bananathumb:

glTF-Sample-Viewer
If we only had those Materials and Enviroments :!:

Individual Mesh Primitives
Yeah, but faster and those textures in the Sponza scene are far superior!
Wonder why the other Complexity options are different and are of less quality?
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 »

In your Notes on your website:
Import Export Notes
Does not export grouped objects

Just noticed that Groups are Imported as TempNulls
If you use Convert Nulls, these Groups are converted to Nulls

There is also MeshInstance nodes
I was able to add/Remove these to the GLTFCleanup script similar to the way you are removing the other helper objects

Not sure about the Groups as they could possibly be in two different states
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 »

GLTF_LightIntensity.jpg

Started working on importing light intensity. Image left is default tS lights and right is modified lights with intensity taken into account. The lamp was imported at a scale of 10 so it came in a dimmer than if the scale had been 1. There is some compensation for scale. I didn't check how valid the scale mod is though and only scale = 1 import lighting is valid in actual reality.

I also imported this file into Blender and found that it is importing lights with intensity 1000 times smaller than it should be. Fixed it by multiplying the intensity by 1000 or if it shows mW units change it to W.
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: 14 Nov 2023, 05:56 GLTF_LightIntensity.jpg


Started working on importing light intensity. Image left is default tS lights and right is modified lights with intensity taken into account. The lamp was imported at a scale of 10 so it came in a dimmer than if the scale had been 1. There is some compensation for scale. I didn't check how valid the scale mod is though and only scale = 1 import lighting is valid in actual reality.

I also imported this file into Blender and found that it is importing lights with intensity 1000 times smaller than it should be. Fixed it by multiplying the intensity by 1000 or if it shows mW units change it to W.
The lights that you are using from the preobects folder are the lights that Model uses
I suspect that the Spot and Projector's AttQuadratic, Angle and EnableShadow attributes are not setup correctly, that are installed by the trueSpace installer
If you load either of these lights in Model, the Shadow is disabled, Angle is set to 1.047, and AttQuadratic is set to 0.000
If you change these attributes and overwrite the original rsobj(s), as noted, they Import using your GLTF Import Export into trueSpace correctly
SpotLight2.png
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 »

I did a test that includes all of the Model lights from the preobjects folder and Exported as glTF
I Imported this glTF scene into trueSpace
Results:
AmbientLight is converted to Null and is no longer a AmbientLight
DirectionalLight2 is converted to Infinite light
Projector light is converted to a Spotlight
AreaLight is converted to an OmniLight
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 »

link to gltf light info

https://github.com/KhronosGroup/glTF/bl ... /README.md


It has 3 types of light: point , spot and directional
There is no concept of ambient light. GLTF uses a completely different lighting and material system.
Directional would be the equivalent of tS infinite light but with shadow casting ability.
An option to choose infinite or tS directional light on import was added a few days ago - not published yet.
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: 15 Nov 2023, 19:09 link to gltf light info

https://github.com/KhronosGroup/glTF/bl ... /README.md


It has 3 types of light: point , spot and directional
There is no concept of ambient light. GLTF uses a completely different lighting and material system.
Directional would be the equivalent of tS infinite light but with shadow casting ability.
An option to choose infinite or tS directional light on import was added a few days ago - not published yet.
Just pointing out the issue with the hopes that you could find a way to avoid the problem lights
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 »

Add Reflection
This script adds Environment Lighting even though one exists already.
Enviro Lighting duplicated.png
Post Reply