unity-unity与ps效果

在 unity 中演示 ps 中的效果


前篇

  • sss

rgb通道单独显示

  1. 首先将ps中的通道修改为显示彩色.

    执行下列操作之一:

    • 在 Windows 中,选择“编辑”>“首选项”>“界面”。
    • 在 Mac OS 中,选择“Photoshop”>“首选项”>“界面”。

  2. ps 中显色 r 通道

  3. unity 中显示 r 通道

    1
    2
    fixed4 col = tex2D(_MainTex, i.texcoord);
    return fixed4(col.r, 0, 0, 1);


显示其中两个通道

比如 显示 g b 通道

  • ps中效果

  • unity中的shader 及 效果

    1
    2
    3
    4
    5
    fixed4 frag (v2f i) : SV_Target
    {
    fixed4 col = tex2D(_MainTex, i.texcoord);
    return fixed4(0, col.g, col.b, 1); // 把要显示的两个通道对应上, 剩余的一个通道置为0
    }


混合模式

参考 : 一篇文章彻底搞清PS混合模式的原理 - https://zhuanlan.zhihu.com/p/23905865

实测用 unity shader 实现了一遍, 几乎都符合