Post

Engine - Maya Export Plugin and Blinn-Phong Shading

October 13, 2026

Objective

This week, I implemented an export function for a Maya plugin that exports a .lua representation of the mesh that can be imported into my engine. Additionally, I took the chance to implement Blinn-Phong Shading in my engine but taking advantage of the easily accessible vertex normals exported from Maya.

Gameplay

Playable Builds

Download x64 .ZIP Download x86 .ZIP

Gameplay Footage

Footage of alternating exported meshes, bound to keys 1, 2, and 3.

MayaMeshExporter Project

Getting the MayaMeshExporter Project up and running was relatively simple once I had Maya 2019 installed and the Maya 2019 devkit setup. The project skeleton provided by the professor did not need any references to be added. Additionally, no other projects depend on it. My implementation did not require any additional references.

Since last week, I also updated the amount of information stored in the human-readable .lua mesh file to include both vertex normals and texture coordinates. As can be seen in the next section, the normals are used for Blinn-Phong Shading. The texture coordinates are not used for anything yet, but I plan to use them in the future to apply textures. I don’t have plans to use the tangents or bitangents, so I chose not to include them.

1
2
3
4
5
6
7
8
9
10
vertices = {
    -- vertices ...
    -- a random vertex
    {
        position = { -1.256, -0.969915, 0.92176, },
        normal = { -0.536393, -0.748091, 0.390695, },
        uv = { 0.4, 0.48, },
    },
    -- vertices ... 
},

Blinn-Phong Shading

I took CS 6610 - Interactive Graphics in Spring of 2026, so it felt like a no-brainer to add in extra functionality to get meshes in my engine looking a bit prettier! To start, I copied over the GLSL shaders that I wrote for that class and converted it into the structure that this engine expects. For more information about how to compute Blinn-Shading, check out the video lecture below:

Interactive Graphics 08 - Lights & Shading

Assignment screenshot
Screenshot of Cem Yuksel's lecture covering Blinn-Phong Shading.

Implementing this required a few very important changes to the engine. First, the vertex normals were added to the mesh file exporter, importer, and buffers covered in previous weeks of this project. Next, new data has to be stored in the constant buffers. This data includes g_transform_normal and g_cameraPosition. Learn more about both of these in the lecture up above.

1
2
3
4
5
6
7
8
9
10
11
12
13
struct sDrawCall {
    Math::cMatrix_transformation g_transform_localToWorld;
    Math::cMatrix_transformation g_transform_normal;
};

struct sFrame {
    Math::cMatrix_transformation g_transform_worldToCamera;
    Math::cMatrix_transformation g_transform_cameraToProjected;
    Math::sVector g_cameraPosition;
    float g_elapsedSecondCount_systemTime = 0.0f;
    float g_elapsedSecondCount_simulationTime = 0.0f;
    float padding[3]; // For float4 alignment
};

I also had to implement more matrix math functions to support the inverse-transpose needed for g_transform_normal.

1
2
constexpr void eae6320::Math::cMatrix_transformation::Transpose();
constexpr void eae6320::Math::cMatrix_transformation::Invert();

Debugging the MayaMeshExporter Plugin

It was good practice to practice debugging other processes in Visual Studio. Below is a demonstration of the working debugger.

Footage debugging the Maya export process.

In my engine, if you try to load a mesh with too many vertices, it will send an eae6320::Results::InvalidFile result and log it as an error, continuing on gracefully. Note that the builds I uploaded don’t have this error checking, but you can see it in few spots including line 136 of cMesh.cpp.