vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
457 stars 72 forks source link

SharpGLTF assumes hardwired folder structure #137

Closed deccer closed 1 year ago

deccer commented 2 years ago

Excuse the amount of tickets but I am either too stupid to use this library, or just dont know how to use this library.

After I cant use relative paths (as stated in #136) I tried to provide the full path which is P:\Private\Code\Games\SpaceConflict\src\SpaceConflict\bin\Debug\Models\BarberShopChair_01_1k.gltf

But now it seems SharpGLTF assumes a hardcoded folder structure to resolve all the things it needs to load (glb/textures/whatever)

Could not find a part of the path 'P:\Private\Code\Games\SpaceConflict\src\SpaceConflict\bin\Debug\Models\textures\BarberShopChair_01_nor_gl_1k.jpg'.

:(

A Getting Started or Wiki might shed some light on how to use that thing.

vpenades commented 2 years ago

I've recently updated the code to handle relative paths.

Did this change fix this and the other issue for you?

deccer commented 2 years ago

Hey, thanks for taking a look.

I have played a bit with your current master version. For meshes with embedded textures or no external ones it seems to be working so far. But as soon as I am trying to load a mesh with external textures I am getting this exception again

Could not find a part of the path 'P:\Private\Code\Games\SpaceConflict\src\SpaceConflict\bin\Debug\Models\textures\head_diffuse.png'

Obviously I don't keep textures in Models\ Hmm unless one would keep each model asset as its own folder. Hmm I have to think about that kind of system :)

Anyway, I have attached the model file in question (minus texture files).

Models.zip

I don't know if it makes sense to provide a readerSetting/Option to not just try to load texture data right when loading the model itself, but just provide the fileName in the inner structures, so that I can take care of image/texture loading in my own time/engine.

vpenades commented 2 years ago

with the model you attached, I created a subdirectory called "textures" and added 4 textures matching the paths in the gltf, and the model loads just fine with the latest code.

So can you write a working demo so I can reproduce it?

deccer commented 1 year ago

I am sorry for the late reply.

Currently I am using 1.0.0-alpha0026 and it does work almost as intended. I am able to load various models, and found a flaw on my side consuming your library.

I will therefor close this issue and make sure to provide a repro-repo next time.

I like to start sentences with I :)

I wanted to thank you for this library by the way, works better than Khronos' "official" one.