1、正片叠底
shader
//正片叠底uniformsampler2DU_MainTexture;uniformsampler2DU_SubTexture;varyingvec2M_coord;voidmain(){vec4blendColor=texture2D(U_SubTexture,M_coord);vec4baseColor=texture2D(U_MainTexture,M_coord);gl_FragColor=blendColor*baseColor;}
效果图
2、逆正片叠底
shader
//逆正片叠底uniformsampler2DU_MainTexture;uniformsampler2DU_SubTexture;varyingvec2M_coord;voidmain(){vec4blendColor=texture2D(U_SubTexture,M_coord);vec4baseColor=texture2D(U_MainTexture,M_coord);gl_FragColor=vec4(1.0)-(vec4(1.0)-blendColor)*(vec4(1.0)-baseColor);}
效果图