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.
- [GameMaker Tutorial] How to setup a simple slot machine reward system
- [GameMaker Tutorial] Drawing custom health bars with sprite parts
- GameMaker Studio 2 Annouces official Mac version in newly released 2.1 milestone
- GameMaker Studio 2 adding C# region type syntax code folding soon
- Cook, Serve, Delicious! 2!! firms up release date to September 13th