OFFICIAL TechBlog: DYNAMIC RENDERING MASKS

Mike

nobody important
GMC Elder
https://www.yoyogames.com/blog/430/dynamic-rendering-masks



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......
 

Filipp_BSG

Member
That's a very nice feature, but it's a pity to read:
This is also a very cheap effect, and will work on just about every platform - barring HTML5 Canvas mode (although there are other ways to do it in canvas mode).
Do you suppose that a way do do it in canvas mode uses surfaces? If so, it seems more heavy...
 

Hyomoto

Member
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!)
 

kupo15

Member
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!
 

TrunX

Member
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)
 

Mike

nobody important
GMC Elder
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)
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.
 
Top