基于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));
}

效果图

基于Qt的OpenGL可编程管线学习(17)- 差值、反差值、排除

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);
}

效果图

基于Qt的OpenGL可编程管线学习(17)- 差值、反差值、排除

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)- 差值、反差值、排除


当前文章:基于Qt的OpenGL可编程管线学习(17)-差值、反差值、排除
分享路径:http://www.hxwzsj.com/article/jeidep.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 成都营销网站制作 攀枝花网站设计 定制网站建设多少钱 成都网站制作 网站建设开发 重庆网站建设 专业网站设计 成都网站设计 外贸网站设计方案 品牌网站建设 网站建设 网站建设推广 成都网站设计 古蔺网站建设 手机网站制作 app网站建设 成都网站建设 重庆外贸网站建设 专业网站建设 营销网站建设 网站制作 公司网站建设