基于Qt的OpenGL可编程管线学习(17)-差值、反差值、排除
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 = abs(vec4(blendColor.rgb - baseColor.rgb, 1.0));
}效果图

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(vec3(1.0) - abs(vec3(blendColor.rgb - baseColor.rgb)), 1.0);
}效果图

3、排除
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(blendColor.rgb + baseColor.rgb - 2.0 * blendColor.rgb * baseColor.rgb, 1.0);
}效果图

当前标题:基于Qt的OpenGL可编程管线学习(17)-差值、反差值、排除
标题URL:http://www.jxjierui.cn/article/jeidep.html


咨询
建站咨询
