While making Silent Bill, to give it a creepier feel I wanted to add some effects. I spent some time looking at options using various shaders, but I came up with a much better solution, simply overlay a texture!
All you need is a film grain texture; there’s plenty available royalty free. I found one on DeviantArt by Shepherd Cartography (CC 3.0).
Import your texture as a sprite, I called it spr_filmGrain, then make sure the texture is approximately the same size as your GUI.
Once you have your texture imported and ready, you just need to overlay it in the Draw GUI event. I use Draw GUI end, to make sure the entire screen had the effect applied. In the event add the following code:
var guiWidth=display_get_gui_width(); var guiHeight=display_get_gui_height(); gpu_set_blendmode(bm_subtract); var xx=irandom(guiWidth); var yy=irandom(guiHeight); draw_sprite_tiled(spr_filmGrain,0,xx,yy); gpu_set_blendmode(bm_normal);
Using bm_subtract will darken the screen where the texture is bright. I.e. pure white (rgb: (255,255,255)) will make the screen black and pure black (rgb: (0,0,0)) will have no effect on the screen.
As the texture I used makes the screen quite dark, you may want to fine tune the effect to a degree by brightening and darkening the texture. I was quite happy with the darkness, so I decided to leave it. You could also have multiple textures overlayed to give different effects.
I have a few examples below:
Any code is free to use for however you see fit. Credit not needed but is appreciated. Feel free to send me your projects if you do make use of it!