pix elated shift/fuzz shader for gamemaker?

Discussion in 'Programming' started by Shadowblitz16, Oct 7, 2019.

Tags:
  1. Shadowblitz16

    Shadowblitz16 Member

    Joined:
    Jun 23, 2016
    Posts:
    601
    can someone tell me how to do a shader like this?
    [​IMG]
    I like the game style and might do something like this..
     
  2. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,964
    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.
     
  3. Shadowblitz16

    Shadowblitz16 Member

    Joined:
    Jun 23, 2016
    Posts:
    601
    ok thankyou I will try making a shader for it
     
  4. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,964
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice