I finally updated my original Blender addon for exporting 3D models to GameMaker, with a complete re-write for Blender 2.93. It can now export straight to vertex buffers, which can be loaded natively into GameMaker Studio 2, and without the hassle of including a bunch of giant, unwieldy scripts in your project!
Features:
- gamemaker-3d-io is an easy way to get objects from Blender to GameMaker Studio 2, using GameMaker’s native buffer format for importing
- Objects can alternatively be exported to a GML script for importing/debugging
- Exports models with normals, vertex colors, and UV coordinates included – with a number of export options to suit your project’s needs
- Supports any model which can be broken into triangle lists – support for line lists and point lists is planned for the future
Download
Instead of doing version-tracking here, I’ve opted to use Github for the project. You can download the latest release, grab the source code and more with the following links:
- Get the Blender addon here: https://github.com/massivecatapult/gamemaker-3d-io/releases/
- Get the example files here: https://github.com/massivecatapult/gamemaker-3d-io/tree/main/example
- View the rest of the project (including the source for both the addon and example) at Github, here: https://github.com/massivecatapult/gamemaker-3d-io
- You can discuss the addon on this page, or at the official GameMaker Community page, here: https://forum.yoyogames.com/index.php?threads/gamemaker-3d-io-blender-addon-for-exporting-3d-models-to-gamemaker-free.87011/
How to use:
- For instructions on installing/using the Blender addon, please refer to the Github page.
- Export an object from Blender to the default *.buf format
- Load in in your game with the following code…
Create a global vertex format for exported models:
vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_normal();
vertex_format_add_color();
vertex_format_add_texcoord();
global.vtf = vertex_format_end();
Add the model to your project as an included datafile (or use an external path/folder), and load it like this:
var b = buffer_load("modelname.buf");
model = vertex_create_buffer_from_buffer(b, global.vtf);
buffer_delete(b);
Finally, draw the model like this (in the Draw Event):
vertex_submit(model, pr_trianglelist, -1);
Or alternatively, you can use it with a shader!
I will be adding features to this project over time. I hope it is as useful to others as the previous script was. If you have any suggestions, please let me know!