KhronosGroup / glTF-CSharp-Loader

C# Reference Loader for glTF
Other
219 stars 58 forks source link

Could you please help me with fixing the model viewer rendering issue in the code? #53

Closed nikeruga closed 11 months ago

bghgary commented 11 months ago

I'm not sure how this is related to this project. Did you post this in the right repo?

nikeruga commented 11 months ago

I am creating a gltf viewer, and the gltf loading part is being developed using "glTF2Loader". I am using the eyeshot library for the viewport, but there is a problem with generating normals data in the mesh data generation part. I was going to ask an inquiry (code related to binary data usage), but if there is any problem, you can delete the post.

bghgary commented 11 months ago

Do you have a specific question about glTF2Loader? I don't know anything about this eyeshot library to help with that part.

nikeruga commented 11 months ago

"The part I'm curious about is not related to Eyeshot. Since Eyeshot also supports Mesh, I believe that creating Triangles, Vertices, Normals, and TextureCoords values will visualize the mesh on the screen. So, I searched the web for code to convert binary data, created it, and assigned the values. I assigned Matrix information for each node to specify their positions and also created and applied materials.

Eyeshot mentioned that there is an issue with the code for generating the list of Normals values. "Could it be an issue with the code for loading and reading binary information? --> No, I'm pretty sure the issue is in the normals assignment. The number of normals does not match the one expected by the mesh nature type.

Another thing I'm curious about is whether I need to reapply the Rotation, Scale, and Translation values of the node's properties, considering that I only applied the Matrix information of the node. I found in my Google search that these values are similar to Matrix values, so they shouldn't be applied redundantly.

In the end, the part I'm curious about is the following code, which represents the class structure: var loadModelGltfData = glTFLoader.Interface.LoadModel(vModelFile);

And since I need to retrieve binary data, I used the following code. I'm wondering if there is an issue with the part of this binary code where values are generated:

var loadBufferBytes = loadModelGltfData.LoadBinaryBuffer(idxAllBufferView, vModelFile);

bghgary commented 11 months ago

This project doesn't deal with how to interpret the binary data, it just gives you access to the glTF JSON with some helpers for accessing the buffers and images. How the data is interpreted is up to the consumer. Unless you are saying the buffer being returned is wrong, I'm not sure how to help.

nikeruga commented 11 months ago

"Thank you. Please delete the post."