gameknife / gkNextRenderer

A Modern gkRenderer
41 stars 4 forks source link

broken glb import #30

Closed tigrazone closed 2 months ago

tigrazone commented 3 months ago

on some files vertices and whole model imported as broken scene for reproduce https://sketchfab.com/3d-models/rank-3-police-unit-d7698f6a7acf49c68ff0a50c5a1b1d52 one more scene https://sketchfab.com/3d-models/spherical-ship-a1bed2ab95544638ba24589679a0e898 and https://sketchfab.com/3d-models/free-character-bot-blast-r-325-by-oscar-creativo-7c3843d203aa4044ae38f7a74645b345 and https://sketchfab.com/3d-models/sci-fi-buggy-085bd97876a64eacbc041299ac945e9c ... many of

gameknife commented 3 months ago

ok, I will check this models, gltf import have some known issues need to fix 😆

tigrazone commented 3 months ago

Maybe is better to use fastgltf but without draco yet? I post to author and he plan to implement draco in few weeks

gameknife commented 3 months ago

seems it is tinygltf's draco issue, I resave with blender no compression, it renders ok

tigrazone commented 3 months ago

Maybe it is not draco problem. I will read success reference code to import glb/gltf and maybe fix it

gameknife commented 3 months ago

sketchfab downloaded glb have the same problem, and it will be ok resaved by blender. I just notice that sketchfab glb have some wireframe data and the indices always be unsigned int. maybe some corner-case when using tinygltf there.

and yes, sketchfab not use draco compress.

gameknife commented 3 months ago

fixed in https://github.com/gameknife/gkNextRenderer/commit/17837126a462965719e077eee83e4df5e7ac8bfe

gameknife commented 3 months ago

buggy still have some TRS order issue, this is the known issues, I will work on it tomorrow~

gameknife commented 3 months ago

TRS order is ok, but some glb provide matrix directly, fixed in https://github.com/gameknife/gkNextRenderer/commit/fedc8f1571ead276dc66b5d8b350ae32029792c5

gameknife commented 3 months ago

Maybe is better to use fastgltf but without draco yet? I post to author and he plan to implement draco in few weeks

the tinygltf is a widely used library, performance is acceptable in release build. currently bugs was the wrong way to use it, I think is not the time to change it~

tigrazone commented 3 months ago

I can try to use fastgltf in experimental branch and compare. One of goods of tastgltf is supported meshopt compression. I dont find supported meshopt with tinygltf

tigrazone commented 3 months ago

Also yesterday I find one of bugs is wrong camera import. Maybe matrix wrong use or so

tigrazone commented 3 months ago

I checked last commits and now glb import doesnt broke vertices and model imported ok. But camera imported sometimes wrong - wrong fov, position wrong. Please get camera info directly from glb file without presets or something else

gameknife commented 3 months ago

the glb above seems has no camera,so I use the obj's auto focus