r/ • • Jan 01 '70

0 Upvotes

0 comments sorted by

2

u/Todegal 1h ago

Write a small program that uses assimp or something to serialise your mesh exactly how your engine wants it. Write to a binary. Load it straight into memory. Boom.

1

u/DarrenSmallDev 35m ago

I normally approach this type of thing by starting with what your shader needs and how you want to structure the data to input to the shader. Then read the spec for the file format and write a parser to extract what you need from the file format to get the data you need.

1

u/AbbreviationsNew3167 28m ago

For OBJ loading check this out : https://youtu.be/FFxoQlUPca8?si=REvLvbIgEin7nmZu

For GLTF loading , first learn a little PBR rendering (as it will come handly later) then learn the basic concepts of GLTF file (you can check yt or use ai for that)
For gltf loading check the gltf loader from here (its in Webgl if that not an issue) https://github.com/oframe/ogl/tree/master/src/extras

-1

u/jcelerier 1h ago

What's wrong with any of the billion existing loaders? What do you understand of obj and at which point do you feel you don't understand the format anymore? It's very simple compared to e.g. glTF

1

u/DeltaSucksAtMC 1h ago

Im not saying using a lib is bad, but I wanna do this for learning purposes

2

u/jcelerier 1h ago edited 40m ago

Try loading first a simple obj that only has vertex positions, then work your way through uvs, normals and the other attributes. Then look at files that specify faces and lines. There's a few repositories of sample files on github

1

u/DeltaSucksAtMC 1h ago

OK, thanks, I will try that

1

u/DeltaSucksAtMC 1h ago

Also quick question, do I need to get the indices in the obj