I was sitting in my room one day, scrolling through Reddit as I usually do, when I come across an astronomical amount of memes from the game Persona 4: Dancing All Night. The original game is a spinoff of the JRPG Persona 4, except that it is a rhythm game featuring the characters from the game. Normally, I would just laugh at the meme and move on, but considering that I had a Computer Graphics final project coming up, I decided to tackle the meme but in OpenGL form.
I should probably just show you
How to use:
When the program loads in, press the "P" key to play the animation. Move the camera around with WASD and the mouse. The animation will loop until the program is closed ("ESC").
Process
This is the Mario MMD model I found online (see References). When you open it in Blender with MMD-Tools, it includes a model complete with bones needed for the VMD file. Since MMD is a file only really used in Japanese Vocaloid music videos, most of the descriptions are in Japanese. These had to be translated with MMD-Tools to work with Assimp, since most Japanese characters will show up as garbled junk in C++. After importing in the model, I used MMD-Tools again to attach the VMD file onto the model. Then, after some additional modifications, I exported it as an FBX file with Blender. Originally, I tried exporting it as a Collada (.dae) file, however those files did not want to cooperate with Assimp, even with the Better Collada Exporter Plugin. So, I moved onto FBX, which I didn't even know Assimp supported since it wasn't anywhere in the documentation that I was looking at, but it easily loaded in FBX files. Figures.
The hardest part of the program was actually getting Assimp to read in the model. Every other program that could read it normally has the entire file loaded, but for me, Assimp kept loading in this mess. After days of figuring it out, I learned it had to do with the sizes of my bone transform matrices. The Mario model has well over 90 bones, and the matrix was so small that it kept overwriting past bone transforms and led to this creepy mess.
With a little help from the stock Winmm.lib file, I was able to play my .wav file - specialist.wav - without much trouble. I only had to play 1 song throughout the animation, so I was okay with using Winmm, which will only play the current file in the buffer. Unfortunately, I couldn't get the eyes to work. They wouldn't load in for some reason. If I had extra time, I would have thrown on sunglasses onto Mario to hide his missing eyes. However, hopefully people think that the final product is entertaining enough to make up for the missing eyes.
Technologies Used
- Assimp Library. Allows for importing more than just .obj files, including animation.
- Winmm Library. Allows for the music to play.
- Blender & MMD-Tools. Imports the MMD and VMD models.
- Game camera. Allows the user to look around the model and observe the transforms.
- Bone transforms. The program uses a mix of Matrix Transforms and Quaternions to do the movement and rotation, respectively.
- Timer. Use GetTickCount64() to grab the animation data.
- Skybox. Used skybox technology on the cube.obj file.
- tiny-obj-loader. Used to import the "Stage".