转载自:http://renderingpipeline.com/2012/06/photoshop-blendmodi-glsl/

I once wrote a texturing tool in which you could paint on a 3D model on multiple layers. These layers were composing the final texture just as you know it from photoshop, complete with alpha, opacity slider and: blend modes. these blend modes are quite simple to implement and it can be useful to use the exact same modes as they are familiar to artists and it’s possible to prototype the final effects in PS (or even write importers and exporters to psd files). The hardest part actually was collecting all the formulas, so this is why I’m collecting them here once again:

I’m assuming the ‘lower’ color is stored in base and the ‘upper’ color is stored in blend.

  • multiply:

    result = base * blend;

  • screen:
    result = vec4(1.0) - ((vec4(1.0) - blend) * (vec4(1.0) - base));

  • darken:
    result = min( blend, base );

  • lighten:
    result = max( blend, base );

  • difference:
    result = abs( base - blend );

  • negation:
    result = vec4(1.0) - abs( vec4(1.0) - base - blend );

  • exclusion:
    result = base + blend - (2.0*base*blend);

  • overlay:
    # per channel:
    if (base < 0.5) {result = 2.0 * base * blend;
    } else {result = vec4(1.0) - 2.0 * (vec4(1.0) - blend) * (vec4(1.0) - base);
    }

  • hard light:
    # per channel:
    if (blend < 0.5) {result = 2.0 * base * blend;
    } else {result = vec4(1.0) - 2.0 * (vec4(1.0) - blend) * (vec4(1.0) - base);
    }

  • soft light:
    # per channel:
    if (blend < 0.5) {result = 2.0 * base * blend + base*base - 2.0 * base*base*blend;
    } else {result = 2.0 * sqrt(base) * blend - sqrt(base) + 2.0 * base - 2.0 * base*blend;
    }

  • dodge:
    result = base / (vec4(1.0) - blend);

  • burn:
    result = vec4(1.0) - (vec4(1.0) - base) / blend;

Blending, Code, Fragment Shader, Shader, Tutorial

转载于:https://www.cnblogs.com/java20130723/archive/2012/07/18/3212247.html

Photoshop Blendmodi in GLSL相关推荐

  1. Direct3D提高篇:HLSL编程实现PhotoShop滤镜效果(1)

    现在学习Direct3d/HLSL的人非常多,教程也非常多.因为硬件的水平在进步,所以可编程管道的处理能力也在不断的提高.从Direct3D 8开始,Direct3D中引入了可编程管道(Program ...

  2. [推荐]HLSL编程实现PhotoShop滤镜效果

    本文原创版权归 潘李亮所有,如有转载,请按如下方式于明显位置标明原创作者及出处,以示尊重!! ===================================================== ...

  3. HLSL编程实现PhotoShop滤镜效果

    文章为it168稿件.地址为 http://tech.it168.com/n/2007-03-29/200703291522292.shtml Direct3D提高篇之:HLSL编程实现PhotoSh ...

  4. Photoshop抠图、污点处理等常用功能及快捷键

    Photoshop抠图.污点处理等常用功能及快捷键 局部图片获取 图片污点修护 各种乱七八糟的常用东西 常用快捷键 常用功能的查看与设置 局部图片获取 a.钢笔工具创建路径后改为选区 b.选区工具3连 ...

  5. 如何安装蓝湖插件支持Photoshop CC 2017

    蓝湖 - 高效的产品设计协作平台蓝湖是一款产品文档和设计图的共享平台,帮助互联网团队更好地管理文档和设计图.蓝湖可以在线展示Axure,自动生成设计图标注,与团队共享设计图,展示页面之间的跳转关系.蓝 ...

  6. Photoshop创造氛围照片合成视频教程含素材

    数百个高分辨率工具和9个完整项目! 这个包包含开始创建史诗大气合成所需的一切-超过四个小时的基于项目的深入教程和超过400个合成工具. 大小解压后:10.7G 含课程素材文件 1920X1080 mp ...

  7. 从头开始学习Adobe Photoshop CC图像编辑

    完整课程,涵盖所有关于Adobe Photoshop CC的基本课程 你会学到什么 课程获取:从头开始学习Adobe Photoshop CC图像编辑-云桥网 Photoshop用户界面之旅 转型导论 ...

  8. C4D+ PS打造城市场景 Create a Cityscape with Cinema 4D + Photoshop

    初级到中级课程,包括创建真实的城市景观可视化的步骤 你会学到: 建筑三维建模所涉及的创造性和技术性步骤. 使用变形器和MoGraph克隆器创建建筑变体,以更改每个建筑的形状. 创建城市街区,添加环境和 ...

  9. c4d+ps打造抽象NFT加密艺术 Create Abstract NFT Crypto Art with Cinema 4D + Photoshop

    c4d+ps打造抽象NFT加密艺术 Create Abstract NFT Crypto Art with C4D + PS c4d+ps打造抽象NFT加密艺术 Create Abstract NFT ...

最新文章

  1. LINUX 触摸屏驱动
  2. webservice 出现No service was found
  3. Docker 实战教程之从入门到提高 (四)
  4. mysql存储过程数组字符串_Mysql通过存储过程分割字符串为数组
  5. hadoop---Java 网络IO编程总结BIO、NIO、AIO
  6. VK Cup 2016 - Round 1 (Div. 2 Edition) A. Bear and Reverse Radewoosh 水题
  7. Java Script 基本知识点
  8. 江小白包装设计原型_江小白的跨界营销,系列设计很“牛啤”!
  9. 基于微信小程序的比赛报名系统
  10. 十个前端UI优秀框架
  11. html页面涂鸦,HTML5 | Canvas画笔小应用(涂鸦板)
  12. 经典算法——韩信点兵问题的简单算法
  13. STM32配置读取BMP280气压传感器数据
  14. C#中Listbox、Textbox、Richtextbox三者之间的区别 ?
  15. echart图片库_附录:ECharts图属性介绍-统计图
  16. 从 Paxos 到 Raft,分布式一致性算法解析
  17. Frp内网穿透实现远程桌面连接
  18. liunx查看ftp服务器文件目录,linux查看ftp服务器目录
  19. Echarts实战案例代码(5):liquidFill水球组件利用svg path定制你自己的个性化图标动态图
  20. 红帽子认证辅导教程(转)

热门文章

  1. 简单的文件上传功能实现(java)
  2. 寒武纪找到了引领中国AI芯片走向世界的路
  3. 一份从 0 到 1 的 Java 项目实践清单
  4. 远程管理服务器的具体操作方法
  5. HAproxy + Keepalive实现LDAP代理服务
  6. python面试题总结(2)--编码规范
  7. 路由到另外一个页面_Nextjs使用解读一(项目搭建与路由系统)
  8. 时序图 分支_UML用例图
  9. 为什么shell脚本第一行要#!/bin/sh
  10. 快速入门Matplotlib