On occasion I’ve had a need for previewing 3D models in GameMaker: Studio prior to actually dropping them into my games, and so I’ve created a simple model viewer program that can do just this. The viewer mimics Blender’s 3D environment and allows for some viewing options, like toggling lighting, culling, etc.
Here is the most up-to-date version of this app (last updated July 16, 2017): Model Viewer 1.0.2
I’ve included a sample GameMaker model and texture, as well as the Blender file I used to make them, with the app.
Using Model Viewer is easy, as the controls are simple and most options should be pretty self-explanatory. Still, following is a brief explanation of how to use it.
Orienting the view
Once open, you’ll be presented with a simple 3D view. This includes a unit grid, some HUD elements that show the camera orientation and 3D axis relative to the view, and a few buttons. You can move the view around the origin point by holding down the middle mouse button and dragging the mouse around. You can also zoom in and out by scrolling the mouse wheel.
Loading models and textures
Using the buttons on the right side of the screen, you can load models and textures to view. Models need to be in GameMaker’s built-in model format, which you can get by either saving from another project using the d3d_model_save() function, or by exporting from Blender using my GameMaker export addon.
Model Viewer comes with a default texture to apply if you haven’t loaded one up yet, which appears as a white and pink checkerboard. You will not see a texture on your model unless you toggle textures on by clicking the Texture button and ticking the box. Textures always need to be sized with dimensions in powers of 2.
Finally, due to some errors I encountered when building this app (when trying to unload models and sprites), models and textures in Model Viewer are added to the program and stay in the program’s memory until it is unloaded. If you attempt to load a file or texture with the same path and name as a file that was previously loaded in that instance of the app, it will always default to the version that was loaded first. You can see (an approximate) amount of memory the app is using at the top of the window.
Underneath the model and texture loading buttons, there are a handful of options that let you view your model in different ways. Here is what they all do:
Toggles textures on and off. If you haven’t loaded a custom texture, the default texture will be used.
Toggles lighting on and off. If Demo Mode is off, the light will always project straight from the camera’s origin (the view) at the object. If Demo Mode is on, the light becomes fixed in the direction where it was when Demo Mode was first enabled. The light direction will snap back to the camera’s origin when Demo Mode is disabled again.
Toggles backface culling on and off, which will make the faces of your object only draw if their normals face the camera.
Toggles Demo Mode on and off. Demo Mode will lock the lighting direction in its current position and spin the object on the Z axis so you can see it interact with lighting better.
Currently, I have no plans to develop this app further, outside of eventually adding support for GameMaker Studio 2 and vertex buffers. I am not against adding more functionality to it. I hope some people might find it useful in its current state!
If you have any feature requests or bugs to report, please contact me and let me know.
- Initial release