Fun with shaders visibility
Posted: 4/1/2024 11:17:44 AM
Recently I started to learn how to make shaders for my new game. Seph remade a few shaders for our Anodyne Fan Remake, but for me learning how to do it always felt daunting. It's very much a new programming language that doesn't have a good way of debugging it. I got so used to just plopping down breakpoints instead of hoping for the best. But I did manage to get a sepia filter to work on my own!
The sepia filter doing it's job.
For my new game I needed a shader that allows me to replace sprite colors on the fly (kind of how a gameboy or nes would do it!). Of course, Seph helped me with this. I had to change how my framework draws and next to having post processing effects, I now had to add a main effect that applies to every single sprite that gets drawn.
The shader gets a texture that has every single palette that the game uses. We ended up deciding that the red color channel of a sprite decides what palette index to use (so we don't have to write a custom sprite drawer, which would be a lot of work). If you turn the shader off, everything looks red and kind of silly.
#NoFilter
I already managed to add "difficulty levels" to my slime enemy. Green takes 3 hits, red takes 4 hits and blue takes 5. This is very much what I wanted from the start. I also got the idea of making a setting or cheat code that makes the game look like an old original gameboy game, in all its ugly green glory!
Three different slimes.
Hopefully with my new shading knowledge I will be able to work on my game even faster from now on!
The sepia filter doing it's job.
For my new game I needed a shader that allows me to replace sprite colors on the fly (kind of how a gameboy or nes would do it!). Of course, Seph helped me with this. I had to change how my framework draws and next to having post processing effects, I now had to add a main effect that applies to every single sprite that gets drawn.
The shader gets a texture that has every single palette that the game uses. We ended up deciding that the red color channel of a sprite decides what palette index to use (so we don't have to write a custom sprite drawer, which would be a lot of work). If you turn the shader off, everything looks red and kind of silly.
#NoFilter
I already managed to add "difficulty levels" to my slime enemy. Green takes 3 hits, red takes 4 hits and blue takes 5. This is very much what I wanted from the start. I also got the idea of making a setting or cheat code that makes the game look like an old original gameboy game, in all its ugly green glory!
Three different slimes.
Hopefully with my new shading knowledge I will be able to work on my game even faster from now on!