This blog series is a part of the write-up assignments of our Game Engineering II class in the Master of Entertainment Arts & Engineering program at University of Utah.

In this assignment, we made a custom Maya plugin that would allow us to create models inside Maya, and then export it as our own format so we can use in the engine.

Result

ThreeMeshes.PNG

(Our game with three models exported with Maya)

Maya exported meshes

I chose to export all of the data from our Maya meshes even though we’re not using all of them now, maybe I can extend our mesh class in the engine in the future to use all of them. Such as using normal to calculate lighting, adding textures to our meshes.

MayaExportedCustomMesh.PNG

Project dependencies

We need to link our new MayaMeshExporter project with our Windows project since we are using an include header from it. Since no other projects depend on it, we don’t have to worry about that.

Debugging

If we want to debug our plug-in, we can simply attach our Visual Studio to Maya and then we can see that the breakpoints are being triggered.

Mesh Vertices Limitation

Since I use an uint16_t (2 bytes) to store the count of a mesh’s vertices, if we receive a mesh that has more than 2^16 – 1 = 65,535 vertices, we are going to have trouble. We need to think about what is the best way to handle it since we want to be explicit about this issue instead of rendering something incorrectly and confuse people. Assert wouldn’t work in this case since people won’t be running under debug settings. What I decided is, having a hard-coded mesh inside my engine called bad mesh. When the game is trying to read and initialize invalid meshes, I swap them with the bad mesh, which is just a red X.

BadMeshCapture.PNG

Executables

Hold down “Z” to change the torus object into a plane. Use “WASD” to move the camera, “J” and “L” to rotate the camera horizontally. “Arrow keys” to move the torus object. “E” and “R” to rotate the cylinder object.

Also, the plane is only using a standard shader that is just displaying its model color, while the other two are using the animating shader to change color over time.

Windows x86 (OpenGL)
Windows x64 (Direct 3D)