The GameMaker Studio shader system was introduced in version 1.2 and allows for powerful visual effects in both 2D and 3D games. If you haven’t used shaders before you’ll find there is a bit of a learning curve.
Fortunately, whether you understand shaders at a basic level or not, you can implement them in your game with ease.
When you create a shader within GameMaker Studio, an editor will appear. It resembles the GML editor window, except it has two tabs; vertex and fragment. Any code used here will be executed through the GPU.
A vertex shader operates on vertices of shapes and visuals, and is used to handle data related to graphical aspects like texcoords. For example, it could be used to help create a ghostly glow around a 3D model. It helps define shape, and can set up information used by the fragment shader.
A fragment shader (more commonly known as a pixel shader) modifies graphics on a pixel-by-pixel basis. This shader is used for altering lighting, depth, colour, and creating complex shadows.
To put it simply, if a vertex shader has four points that form a box, a fragment shader will draw the pixels within.
Create Your Own Shaders
If you are interested in learning how to develop shaders, there are resources online that can help you get started.
Too Much Effort?
If you aren’t interested in learning how to create your own shaders from scratch, there are other options.
The GameMaker Community has a sub-forum dedicated to the development and sharing of shaders. You can download shader demos, then copy the vertex and fragment shader code into your own projects. By doing this you can easily implement stunning visual effects into your GameMaker projects with hardly any effort.
Don’t Be Intimidated
Regardless of your experience with GameMaker, don’t be afraid to try shaders. If you want to add simple weather effects, or place a glowing sun in the sky, or even create television static for your main menu, then shaders can help you out.
Beyond special effects, practical uses for shaders have also been discovered. A shader could be used to smooth out blurry graphics, which helps low-resolution games achieve a natural look at higher resolutions. It is this type of functionality that hints at the potential of GameMaker Studio’s shader system.
- [Post of the Month] End of an Era: GameMaker 1.X Sunset coming at end of July 2018
- [Made In GameMaker] PurpleBit Surfing Cow by Heavy Sheep Games
- [Indie Interview] Heavy Sheep Games with Luiz Gustavo
- [Made in GameMaker] GameDevDan vs Life Launches on Steam
- [Made in GameMaker] Bounce Rescue by Bitecore Studios