From: Chris R. <ch...@th...> - 2015-11-23 12:45:39
|
Thanks Timo - it's nearly working but comes out as a multiply blend for me vec4 crate = texture2D(crateSampler, fragTexCoord); vec4 text = texture2D(textSampler, fragTexCoord); gl_FragColor = crate + text.rgb * text.a; I suspect I need something like: gl_FragColor = (crate * 1-text.a) + (text.rgb * text.a); But I'm not sure how to do it.. [image: theguild] <http://www.theguild.tv> Chris Ratcliffe / Animation / Graphics / Creative Code 44 (0) 7973 299 138 / ch...@th... THE GUILD TV LTD / http://www.theguild.tv On 23 November 2015 at 10:50, Sturm, Timo <tim...@ig...> wrote: > Something like that should work: > > vec4 crate = texture2D(crateSampler, fragTexCoord); > vec4 text = texture2D(textSampler, fragTexCoord); > gl_FragColor = crate + text.rgb * text.a; > > Regards > Timo > > Am 23.11.2015 um 11:01 schrieb Chris Ratcliffe: > > Hi, > Apologies for asking what may seem an obvious question: > > I would like to layer two textures using multitexture: > > I can BLEND two textures using this command: > > vec4 texCol0 = texture2D(Picture0, fragTexCoord); > vec4 texCol1 = texture2D(Picture1, fragTexCoord); > gl_FragColor = texCol0 * 0.5 + texCol1 * 0.5; > > How can I layer a top texture over the bottom using an alpha channel? > > For example - say I had a crate texture and I want to stencil some letters > over the top > of the crate as if the top layer had an alpha channel to reveal only the > letters? > > Thanks for any advice > > > ------------------------------------------------------------------------------ > Go from Idea to Many App Stores Faster with Intel(R) XDK > Give your users amazing mobile app experiences with Intel(R) XDK. > Use one codebase in this all-in-one HTML5 development environment. > Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 > > > > _______________________________________________ > X3dom-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/x3dom-users > > > > > ------------------------------------------------------------------------------ > Go from Idea to Many App Stores Faster with Intel(R) XDK > Give your users amazing mobile app experiences with Intel(R) XDK. > Use one codebase in this all-in-one HTML5 development environment. > Design, debug & build mobile apps & 2D/3D high-impact games for multiple > OSs. > http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 > _______________________________________________ > X3dom-users mailing list > X3d...@li... > https://lists.sourceforge.net/lists/listinfo/x3dom-users > > |