Shader Macros - GameMaker Tutorial

Опубликовано: 26 Январь 2025
на канале: DragoniteSpam
486
24

You can define macros in shaders, the same way you can in GML. In fact, you can do quite a lot with macros in shader languages! If you've ever messed with preprocessor directives in the C languages, you'll know exactly what to do with these. Bonus content: how to create a color inversion shader.

I did this demo in GLSL ES, but shader functions work the same way in HLSL. In general, both languages are very C-like.

I should repeat that even though you're allowed to do all of this with macros and the preprocessor in shader languages, it doesn't necessarily mean you should. Going overboard with macro functions and other preprocessor directives can make it VERY hard to read your code.

A similar video on shader functions:
   • Shader Functions - GameMaker Tutorial  

The code:
https://github.com/DragoniteSpam-Game...

Shader playlist:
   • Shader Stuff - GameMaker Studio 2  
GameMaker 3D playlist:
   • 3D in Game Maker Studio 2  
GameMaker Studio 2 playlist:
   • Game Maker Studio 2 - General Tutorials  

#GameMaker
#GameMakerShaders
#GameMakerShaderMacros
- - - -
I've now made that Patreon:
  / wizardragon  
That promised social media link spam.
  / dragonitespam  
Transition / idle music is by my old friend Kamex:
   / greatgabite  

Rate, comment, subscribe, watch more, enjoy!