top of page

Game Engine Engineering Assignment - 8

  • Writer: Vikram Venkatesh
    Vikram Venkatesh
  • Oct 22, 2020
  • 2 min read

Updated: Sep 25, 2023

This was a cool assignment, as the main objective of this was to tackle one of the issue I had discussed in the previous assignment, which was loading High-Poly models. As discussed in the last assignment. I had a high poly Gun mesh(vertices > 60,000, tris >25,000 ), I was wanting to import into the project but it froze the program when loading the index and vertex data information.

We had created a pipeline to load JSON meshes, which is more human readable but is wasteful in terms of memory. This can be mitigated by having a JSON copy in the engine source, but when the game is loading the mesh, it should load the mesh from a binary file instead. This leads to our goal for this assignment, which is to create a binary file from the JSON file, and use that now to load our meshes.


Currently there are four pieces of information, which is vital to create a mesh, which are:

  • The number of Vertices

  • The vertex data

  • The number of Triangles

  • The index data

This is what our JSON file for a plane mesh looks like:



And now if we look at the output binary file, which our MeshBuilder tool is now capable of creating, we can see this info



If you take a look at the data closely, you can also notice the little-endianness, which I'm guessing, comes from Intel's (my CPU) architecture. I imagine this might become a problem on systems using big endianness.

Given we are handling winding order in the graphics module, it should be fine for both OpenGL and Direct3D to load the same binary mesh file.


Here is a snippet of how I'm extracting mesh data from the binary file.

And here is the Gun, now loaded in it's full glory

For the gun, the mesh file (JSON) = 3682KB , while the binary mesh file = 633KB, which is a huge reduction in size.


Also I was able to make the OpenGL build work, but there are other problems in it, which doesn't make the object move. So will try to get this fixed by the next one :(


Controls:

ESC – exit.

Up/Down/Left/Right - Move the Gun

W/A/S/D - Move Camera Forward/Left/Backward/Right



Comments


bottom of page