vpenades / SharpGLTF

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

[QUESTION] Could you please help me with fixing the model viewer rendering issue in the code? #197

Closed nikeruga closed 8 months ago

nikeruga commented 8 months ago

"I apologize for the initial inquiry about a different library. If it violates the policy, feel free to delete the post. I am having difficulty using the SharpGLTF library, so I am creating a viewer with the glTF-CSharp-Loader library instead. Could you please assist me? Thank you."

"I have written code to load and viewer a file, but the model viewer displays shapes differently. I am not sure if there is an issue with point transformation or binary processing. In Eyeshot, it seems there might be a problem with the 'normals' generation part of the point creation code, but I am uncertain if there is an error in my code. My code is available at the following link, so please take a look and provide assistance. Thank you."

vpenades commented 8 months ago

SharpGLTF has an extension method that allows exporting the model to Wavefront OBJ. This method is designed to capture a snapshot of the actual geometry stored in the model, so it can be used to debug and diagnose the contents of a glTF

So, you can try loading the model in sharpGLTF, and then use the extension method to export it to Wavefront OBJ.

If the exported wavefront OBJ still looks wrong, then the problem is, most probably, in the source model you're trying to import.

If the wavefront OBJ looks fine, then the problem is, most probably, in the model viewer, which is not correctly interpreting the glTF node transforms.

nikeruga commented 8 months ago

"The model file I used has been thoroughly validated in PixyzStudio. It seems there might be an issue with my code. I'm stuck here. If you have time, could you please take a look at the attached project in the link?"

vpenades commented 8 months ago

At first sight of your code, it would take me a few hours to review your code in order to find the issue, and probably more to offer a solution, which is beyond what I can do in my spare time for free.

If you want me to dig deep into your code, I think you might consider purchasing a one time 50$ sponsorship so I can justify expending that amount of time on your code.

nikeruga commented 8 months ago

"Thank you for your kind reply. I think I might stop here as this is just at a learning level. It's not easy..."

vpenades commented 8 months ago

I understand; glTF is very complex file format, and I tried to make the library as easy to use as possible... but in the end it's still a very complex format and it's the responsability of the end developer to deal with these difficulties.

If you want to keep looking into glTF rendering on your own, I would suggest you to look into this other library:

https://github.com/vpenades/SharpGLTF/tree/master/src/SharpGLTF.Runtime

SharpGLTF.Runtime does not do the rendering, but it prepares the model to make it easier to integrate into other rendering engines.

On my side I can't do much more because I am extremely busy and I have very little time left to help.