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: 16 Nov 2023, 16:26 Add Reflection
This script adds Environment Lighting even though one exists already.
Enviro Lighting duplicated.png
Thanks, added to the TODO list
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 »

MetalShaderFixed.jpg

Improved handling of the metallic value in the non-texture model shader
Left is before and right is after

Easiest to see the difference in the gold spheres 3rd column from the left. As it goes up the metal factor increases and the highlight color changes from white to gold and the reflection properties change.
This change also requires a change to the lights so they are bright enough to illuminate it. Using unofficial update lights the intensity before was 2 and in the after image it was something like 200.

Next the texture based model shader will need a similar fix.
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: 16 Nov 2023, 17:02
trueBlue wrote: 16 Nov 2023, 16:26 Add Reflection
This script adds Environment Lighting even though one exists already.
Enviro Lighting duplicated.png
Thanks, added to the TODO list
Really love your Environment Lighting :bananathumb:
Makes for some awesome Real time Gold material
Playing with the Roughness Scale
EnviroLightingRoughness.png
.
EnviroLightingRoughness2.png
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 »

MetalShaderEnvironmentFixed.jpg
Old is on the left and new is on the right. The new is much closer to how it should look.
Texture based model shader was updated and a new texture environment to go with it.
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 »

Here is a Wolf scene
Export does not export the Alpha Fur image
Import Fur is Solid Color
Attachments
Wolf.RsScn
(1.8 MiB) Downloaded 36 times
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: 17 Nov 2023, 14:44 Here is a Wolf scene
Export does not export the Alpha Fur image
Import Fur is Solid Color
In gltf the alpha is a part of the color image. No color image so no alpha.

ColorToColorImage.jpg

You can use the "solid color image" compositing node with a TextureShader to create a color image.

The final result will have alpha but it will be reversed because of the special TextureAlpha3. It has an internal reverse of the alpha values.
GLTFWolfAlphaReversed.jpg
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: 18 Nov 2023, 18:14
trueBlue wrote: 17 Nov 2023, 14:44 Here is a Wolf scene
Export does not export the Alpha Fur image
Import Fur is Solid Color
In gltf the alpha is a part of the color image. No color image so no alpha.


ColorToColorImage.jpg


You can use the "solid color image" compositing node with a TextureShader to create a color image.

The final result will have alpha but it will be reversed because of the special TextureAlpha3. It has an internal reverse of the alpha values.

GLTFWolfAlphaReversed.jpg
Tried a different Alpha Shader and a Black Color Texture
Results:
BaseColorTextureResults.png
.
BaseColorTexture.png
The imported Alpha Image is Inverted
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 changed the Wolf materials to Compiled Textures
I get much better results with Exporting and then Importing into trueSpace
Except it is Imported with Shinny textures
But the Alpha Fur is as expected
Wolf Compiled Materials.png
.

FYI:
I discovered that trueSpace's TextureBumpAlphaMetal & TexxtureBumpAlpha compiled textures does not show the AlphaTest & AlphaTestValue attributes
And you can get Transparent Shadows
Transparent Shadows.png
.
Modifications
Expose:
AlphaTest
AlphaTestValue


AlphaTest = Enabled
AlphaTestValue = 0.100 'Transparent Shadows'
AlphaTestValue = 1.000 'No Transparent Shadows'
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 »

Something odd about the Imported Spotlights with No Shadow
Imported Spotlights No Shadow issue.png
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: 20 Nov 2023, 17:20 Something odd about the Imported Spotlights with No Shadow
Imported Spotlights No Shadow issue.png
steps:

add cube to default scene
export gltf
import gltf
set light intensity to brighten it up
disable shadow on spotlight

see the problem

temporary workaround for now: change ThresholdAttenuation from 0.05 to 0.005

TODO: light export needs to look at the attenuation values to adjust the exported intensity and tinygltf won't load gltf with empty buffer, if empty remove from the file
Clinton Reese

http://clintons3d.com
Post Reply