Week 4 - Finalizing glTF loader

Published: 07/19/2022

What did you do this week?

This week I had to travel back to my college since the summer vacations have ended. I had a coding session with Serge this week, we modified the exporter function and looked at some bugs I faced.

We managed to use the io.load_io function. There was a strange issue with loading png files. I had to convert the PIL Image to RGB format, and it fixed the issue, turns out png images are stored as P (pallet) mode.

I also added the glb format support to the importer. While loading a .glb model, I noticed that the image data is also stored in the buffer and there can be a bufferview index to get the buffer.

During this time, I also tested the glTF loader with all models in the KhronoosGroup/glTF-samples repository. Here's the table of models working well: see file.

Model Name Status Error Type
BoxInterleaved No "BoxInterleaved.gltf: shapes (4,4) and (7,12) not aligned: 4 (dim 1) != 7 (dim 0)"
Box Yes  
SpecularTest Yes  
AnimatedCube Yes  
NormalTangentMirrorTest Yes  
AnimatedTriangle Yes  
SpecGlossVsMetalRough No SpecGlossVsMetalRough.gltf: 'NoneType' object has no attribute 'baseColorTexture'
CesiumMilkTruck Yes  
VC Yes  
WaterBottle Yes  
AnimatedMorphCube Yes  
Sponza Yes  
SciFiHelmet No SciFiHelmet.gltf: Python int too large to convert to C long
Triangle No None: file not downloaded
IridescenceMetallicSpheres No None: file not downloaded
Corset Yes  
Cube Yes  
TextureLinearInterpolationTest Yes  
SimpleMeshes Yes  
Lantern Yes  
TextureTransformMultiTest Yes  
TextureSettingsTest Yes  
LightsPunctualLamp Yes  
DamagedHelmet Yes  
CesiumMan Yes  
Cameras Yes  
BarramundiFish Yes  
MetalRoughSpheresNoTextures Yes  
EnvironmentTest No None: file not downloaded
MosquitoInAmber No MosquitoInAmber.gltf: buffer is smaller than requested size
BoxTexturedNonPowerOfTwo Yes  
BrainStem Yes  
SimpleMorph Yes  
OrientationTest Yes  
BoxAnimated Yes  
StainedGlassLamp Yes  
TextureTransformTest No None: file not downloaded
ClearCoatTest Yes  
IridescenceLamp No None: file not downloaded
DragonAttenuation No DragonAttenuation.gltf: buffer is smaller than requested size
RecursiveSkeletons No RecursiveSkeletons.gltf: cannot reshape array of size 120 into shape (9)
Suzanne Yes  
RiggedSimple Yes  
TextureEncodingTest Yes  
2CylinderEngine Yes  
NormalTangentTest Yes  
MorphStressTest Yes  
IridescenceDielectricSpheres No None: file not downloaded
TextureCoordinateTest Yes  
Duck Yes  
AlphaBlendModeTest Yes  
TriangleWithoutIndices Yes  
MultiUVTest Yes  
BoomBoxWithAxes Yes  
Box With Spaces No Box%20With%20Spaces.gltf: 'NoneType' object has no attribute 'shape'
SheenCloth Yes  
ToyCar No None: file not downloaded
MaterialsVariantsShoe No MaterialsVariantsShoe.gltf: buffer is smaller than requested size
IridescentDishWithOlives Yes  
VertexColorTest Yes  
SheenChair Yes  
Fox Yes  
AntiqueCamera Yes  
TransmissionTest No None: file not downloaded
TransmissionRoughnessTest Yes  
BoxVertexColors Yes  
ReciprocatingSaw Yes  
MorphPrimitivesTest Yes  
MetalRoughSpheres Yes  
GearboxAssy Yes  
TwoSidedPlane Yes  
Buggy Yes  
SimpleSparseAccessor Yes  
BoxTextured Yes  
UnlitTest Yes  
SimpleSkin Yes  
FlightHelmet Yes  
Unicode❤♻Test No Unicode%E2%9D%A4%E2%99%BBTest.gltf: 'NoneType' object has no attribute 'shape'
Avocado Yes  
InterpolationTest Yes  
GlamVelvetSofa Yes  
RiggedFigure Yes  
BoomBox Yes  
EmissiveStrengthTest No None: file not downloaded
AttenuationTest Yes  
AnimatedMorphSphere Yes  
IridescenceSuzanne Yes  

What is coming up next week?

  • Adding tests and merging export function PR.
  • Start working on Simple Animations.

Did you get stuck anywhere?

  • To create a texture, we needed the RGB values, However .png images were returning a 2D array when read using PIL. It is fixed by

  • pygltflib's load method doesnot handle glb files very well. It does not contain the buffer uri. I used glb2gltf method as of now.