I will leave a (dd/mm/yy) formatted date here, so you know when this guide was last updated: 19/10/20

  • Added some info about texturing
  • Moved the post to my website
  • tested with the latest version of GMS2, changed FPS to 60
  • added info about transparency and 3D
  • Added more correct info about the negative aspect ratios and up-vectors
  • (Main content was last updated 16/04/18)

I’ll also update the guide if there a better methods that I haven’t thought of/found out about yet.

GM Version: IDE: 2.2.4.451, RUNTIME: 2.2.4.357

Target Platform: ALL

Download: Built Project

Summary:

So, you want to get started in 3D with GMS2? Well, here’s a few things you should know first:

  • I will be referring to “GameMaker Studio 2” as “GMS2” throughout the guide, because I am too lazy to keep writing it in full.
  • This guide is written with beginners to 3D in mind. If I’m explaining something and you think you already know all about it, just skip it. Alternatively, if something I’ve written is confusing, don’t be afraid to ask and I’ll try to be more clear!
  • I will be referencing matrix/matrices a lot. They are necessary to do almost anything in 3D, but you don’t necessarily have to know how they work. A lot of matrices are autogenerated and assigned in the code without ever needing to know how they work. However, knowing how they work can help a lot.
  • GMS2, much like GM:S 1.X, is NOT a 3D engine. It is primarily designed for 2D, so 3D games require a LOT of manual work to set up.
  • You will need to know how to use GML. I don’t know if any D&D functions have been added for 3D (I don’t believe so anyway), but this guide will be GML based anyway.
  • This guide may be easier if you ever used the “d3d_*” functions, however, they no longer exist. This guide is written with beginners of 3D in mind anyway.
  • You can no longer import models using “d3d_model_load” (well, you CAN, but that uses compatibility scripts and is not recommended), so it’s a good idea to write your own model importer/exporter. I’ve already written an exporter for Blender that creates a buffer file that can be loaded with buffer_load – check the extension here: https://marketplace.yoyogames.com/assets/5839/export-3d-blendertogm
  • The new tiles do work in a 3D environment, and their z-coordinate is directly taken from layer depth.
  • I’ll not be covering HUD set up, as that works the same as it has since 1.X (draw GUI), and there are already guides and help available.
  • Remember to use the manual! It answers a LOT of the questions you may have, and can give you more information about a function.
  • If the manual doesn’t help you, you can ask a question here, and I will try to help!

Now that that’s out of the way, here’s a list of what I’ll be covering:

  1. Setting up 3D requirements and a 3D projection with the new camera
  2. Using a vertex buffer to build a model and render it
  3. Transforming models with the new matrix functionality
  4. Other useful d3d_* functions that have been replaced (texture repeat, texture interpolation, backface culling, etc.)
  5. Other odds-n-ends I think I should talk about (batching, layer depth)
  6. Why Can’t I See Things Behind My Transparent/Translucent Model??

If you go through the guide from start to finish, this is pretty much what you’ll see:

Not super impressive, but it covers the basics.

Relevant Documentation Links:

So, lets get started then!

Tutorial:

 

 

 

 

 

Okay, I think that covers the basics! I will be adding to this, especially when shaders are public. If you have any questions or corrections, let me know!