Open ileniTudor opened 5 years ago
I would suggest just look up how a .obj works. One such link is this.
In computer graphics, everything is expressed in form of triangles. So, any 3D object is made up of triangles. An obj is a format to represent 3D object similar to the way txt is a format to store text files. Each triangle in an object is defined by its 3 vertices and is called a face. The ordering of the vertices say clockwise or counter-clockwise defines the direction in which the triangle is facing i.e upwards or downwards.
In this project, vertices are the vertices in the 3D object. Triangles
stores the information which tells the renderer which of these vertices form a face/triangle i.e say face 1 might be made up of vertex 1, vertex 2 and vertex 3. Colors are color of each vertex in this 3D object.
If you need more details, I would suggest to look up some introductory course on computer graphics .
Thank you for your generously sharing!
@gsssrao
Is it from first to third column means (x, y, z)
coordinates in the Triangles
array?
@GewelsJI No, it isn't the x, y, z
coordinates. triangles
array just stores the face/triangle ordering in the mesh. Each line in it just says which of the vertices form that triangle. Say if the line in the obj reads f 1 2 3
, it just means that vertices 1, 2 and 3 together form that triangle/face. The x, y, z
coordinates of say vertex 1 would usually be in the first line of the obj file in the following format v x y z
. The vertex 2 in the second line and so on...
I would suggest reading up the way obj is written to file and this document which explains obj file structure.
Note: Please note the reverse ordering of faces while saving the obj here. The ordering defines the normals for those faces.
Thanks @gsssrao
Hello, thanks for sharing this work. I'm new in the 3d field. Can someone explain in a few lines, or share some tutorials about those concepts: vertices, triangles and colors? What is the relation between them. As far I can see is that the triangles are load from a file, so they are statically elements. What do they represent? Thank you