• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

pix elated shift/fuzz shader for gamemaker?

NightFrost

Member
The base effect itself appears pretty simple, just an x-offset, though one that works at pixel increments. Since it is for the entire screen, you'd apply the shader at post-draw event when app surface is drawn to display. You'd disable automatic draw and do it yourself with the shader. The bigger problem I think would be to make it look good. The offset is not just some random noise, if it was it would look bad and unplayable. The offset might be sine wave base with some small randomness added. Could even be a precalculated array that is looped through. Although, it also could be 1D Perlin noise combined at several amplitudes and frequencies.
 

NightFrost

Member
Some added thoughts: since this is a full-screen effect that affects everything, you'd apply this to application surface draw, meaning you'll need to turn off automatic draw and do it manually while applying the shader. Easiest by making a separate controller object for this operation. Put the object into your first room and make it persistent. In its Create event issue application_surface_draw_enable(false) to turn off automatic drawing. Then add some code to Post Draw event. That event is used because in Post Draw, GMS sets the default draw target to your display, so when we take app surface and do a draw, it becomes visible. This normally happens automatically, but we turned it off so we can apply a shader to the operation. Simply set the shader (and any uniforms it may need), perform draw_surface(application_surface, 0, 0) and then reset the shader. You should try this without the shader first so you can confirm your code is correctly performing the manual draw operation.
 
Top