1、正片叠底
shader
// 正片叠底 uniform sampler2D U_MainTexture; uniform sampler2D U_SubTexture; varying vec2 M_coord; void main() { vec4 blendColor = texture2D(U_SubTexture, M_coord); vec4 baseColor = texture2D(U_MainTexture, M_coord); gl_FragColor = blendColor * baseColor; }
效果图
2、逆正片叠底
shader
// 逆正片叠底 uniform sampler2D U_MainTexture; uniform sampler2D U_SubTexture; varying vec2 M_coord; void main() { vec4 blendColor = texture2D(U_SubTexture, M_coord); vec4 baseColor = texture2D(U_MainTexture, M_coord); gl_FragColor = vec4(1.0) - (vec4(1.0) - blendColor) * (vec4(1.0) - baseColor); }
效果图
时间: 2024-10-02 07:54:38