0
点赞
收藏
分享

微信扫一扫

Nodejs web服务器之GET、POST请求初次体验

环境:

unity2021.3.x

效果:

实现核心思路(shader):

 fixed4 frag (v2f i) : SV_Target {
     fixed4 col = tex2D(_MainTex, i.uv);
    
     // 调整相似度
     bool isRedMatch = abs(col.r - _TargetColor.r) < 0.15;
     bool isGreenMatch = abs(col.g - _TargetColor.g) < 0.15;
     bool isBlueMatch = abs(col.b - _TargetColor.b) < 0.15;
     bool isAlphaMatch = abs(col.a - _TargetColor.a) < 0.15;
    
     // 判断是否相似
     bool isColorMatch = isRedMatch && isGreenMatch && isBlueMatch && isAlphaMatch;
    
     // 如果是相似的颜色就返回,否则返回白色。
     if (isColorMatch) {
         return col;
     } else {
         //如果要透明就去掉下面的注释
         //discard; 
         return fixed4(1, 1, 1, 1); 
     }
 }

github地址:UnitySketchStyle GitHub地址

举报

相关推荐

0 条评论