Ncurses Render Engine Tutorial: pt 10 (Model Loading & Rendering!)

Published: 03 February 2021
on channel: KayOS Code
811
28

In this tutorial, I go over the OBJ file format and write the code for how to load models from that format and render them!


MINOR BUG ALERT: Some complicated models will refuse to render with the code as it's setup. I have fix for the next tutorial which I will publish very soon

github: https://github.com/youngbrycecode
--MODELS UNDER TUTORIAL10/res--


Chapters:
0:00 Introduction
0:24 Blender Models
1:07 Obj File Format
5:23 Implementation
35:45 Conclusion

Casual Coder:    / pivotofpower  


OBJ file format reference:
#comments are ignored
'v ' indicates a vertex where three floats follow on the same line
'vt' indicates a texture coordinate where two floats follow
'vn' indicates a normal where three floats follow
'f ' indicates a face and connects three vertices to draw a triangle

Model loading process:
1. Load the file contents line by line
2. Load all positions, texture coords, and normals
3. Load each face and create unique vertices from that data - store in an efficient data structure such as an unordered set
4. Store an index for each unique vertex and store in the index list a pointer to it's correct vertex
5. There are three positions for every index, three normals, and two texture coordinates
6. Loop through each vertex in the set and write to the correct locations in the array the REAL values of the positions, normals, and texture coords
7. When rendering, loop through the model's indices in groups of three and draw triangles between the points - interpolate between the data points!


On this page of the site you can watch the video online Ncurses Render Engine Tutorial: pt 10 (Model Loading & Rendering!) with a duration of hours minute second in good quality, which was uploaded by the user KayOS Code 03 February 2021, share the link with friends and acquaintances, this video has already been watched 811 times on youtube and it was liked by 28 viewers. Enjoy your viewing!