1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

OFFICIAL TechBlog: DYNAMIC RENDERING MASKS

Discussion in 'Announcements' started by Mike, Sep 13, 2017.

  1. Mike

    Mike nobody important GMC Elder

    Joined:
    Apr 12, 2016
    Posts:
    2,412
    https://www.yoyogames.com/blog/430/dynamic-rendering-masks

    [​IMG]

    So this is a quick one, but incredibly cool and valuable. When drawing to the screen (or a surface), most people only think about the colour, that is the red,green and blue channels, but actually there's also an alpha channel. Now it has a whole heap of issues if you're going to start using it to build sprites or generate screens or whatever, but one thing that's its REALLY good at, is being a mask......
     
  2. True Valhalla

    True Valhalla Full-Time Developer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    321
    Cool effect, thanks for the write-up!
     
    Last edited: Sep 30, 2019
    SilentxxBunny likes this.
  3. hogwater

    hogwater Member

    Joined:
    Jun 22, 2017
    Posts:
    635
    Very cool. I've been thinking about how to implement some basic platformer player shadows, and this seems like a good way to do it.
     
    SilentxxBunny likes this.
  4. Wayfarer

    Wayfarer Member

    Joined:
    Jan 3, 2017
    Posts:
    191
    This is awesome!! I was doing something similar with shaders, but this seems waaay more efficient. Really appreciate these write-ups.
     
    SilentxxBunny likes this.
  5. Filipp_BSG

    Filipp_BSG Member

    Joined:
    Jun 21, 2016
    Posts:
    28
    That's a very nice feature, but it's a pity to read:
    Do you suppose that a way do do it in canvas mode uses surfaces? If so, it seems more heavy...
     
    SilentxxBunny likes this.
  6. Hyomoto

    Hyomoto Member

    Joined:
    Jul 7, 2016
    Posts:
    1,078
    Hmm, I'll have to dig into this eventually. It sounds like it could be used to speed up certain rendering tasks though I'll admit, on the initial read I wasn't quite sure exactly what you were doing. More specifically I wasn't sure why what you were doing was producing the expected result :p I love your tech blogs, gives me stuff to think about and try! (Your page on binary is something that changed, quite fundamentally, how I code!)
     
    SilentxxBunny likes this.
  7. jackquake

    jackquake Member

    Joined:
    Aug 17, 2016
    Posts:
    87
    Very cool indeed!
     
    SilentxxBunny likes this.
  8. kupo15

    kupo15 Member

    Joined:
    Jun 20, 2016
    Posts:
    795
    Amazing, will have to reread it to understand it more but something very useful to know and I will definitely use it. Thanks for another fantastic tech blog!
     
    SilentxxBunny likes this.
  9. RichHopefulComposer

    RichHopefulComposer Member

    Joined:
    Jun 20, 2016
    Posts:
    1,388
    Cool effect. Thanks for the write up, Mike.
     
    SilentxxBunny likes this.
  10. Mike

    Mike nobody important GMC Elder

    Joined:
    Apr 12, 2016
    Posts:
    2,412
    SilentxxBunny and 8BitWarrior like this.
  11. TrunX

    TrunX Member

    Joined:
    Jun 30, 2016
    Posts:
    143
    Can somebody explain why this method doesn't work if you use application_surface_draw_enable(false); to draw the application_surface by hand?
    (the rectangle you draw to clear the alpha channel makes the whole screen black, so in the end only the masked part is visible)
     
  12. Mike

    Mike nobody important GMC Elder

    Joined:
    Apr 12, 2016
    Posts:
    2,412
    You have to disable alpha blending when drawing the application_surface.... then it should work fine. Otherwise, yes... it'll use the alpha "mask" as the alpha channel for the whole thing.
     

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