Page 2 of 2
Re: Shaders
Posted: Sat Mar 14, 2015 3:49 am
by Syd
I've noticed since this change some shaders have a 0.0 alpha set. This doesn't effect magic, but you can trip you up if you're syphoning out etc.
example:
https://www.shadertoy.com/view/MlsGRS
Re: Shaders
Posted: Sat Mar 14, 2015 7:52 pm
by Magic
Yeah that's because of premultiplied alpha (a common theme recently it seems:
http://magicmusicvisuals.com/forums/vie ... ?f=2&t=355).
Magic handles alpha the same way Shadertoy does, but other apps handle it incorrectly (er, differently).
For the technically-inclined, the difference in OpenGL is:
Code: Select all
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
instead of
Code: Select all
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
See
http://blogs.msdn.com/b/shawnhar/archiv ... alpha.aspx for more info. The key issue is the proper handling of alpha cutouts and image composition (last sections of that article).
Also
http://home.comcast.net/~tom_forsyth/bl ... lpha%5D%5D is a good one, especially the section "Compositing translucent layers".