zoukankan      html  css  js  c++  java
  • unity, 最简单的additive shader


    Shader "Custom/myAdditive" {
        Properties {
            
            _MainTex ("Albedo (RGB)", 2D) = "white" {}

        }
        SubShader {
               Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }

            Pass {
               ZWrite Off
                Blend SrcAlpha One//use (SrcAlpha,One), not (One,One)
                CGPROGRAM

                #pragma vertex vert
                #pragma fragment frag
                #pragma target 3.0

                #include "UnityCG.cginc"
                
                sampler2D _MainTex;
                
                struct myV2F{
                    float4 pos:SV_POSITION;//http://wiki.unity3d.com/index.php?title=Shader_Code
                    float2 uv    : TEXCOORD0;
                };
                
                myV2F vert(appdata_base v)  {
                    myV2F v2f;
                    v2f.pos=mul (UNITY_MATRIX_MVP, v.vertex);
                    v2f.uv=v.texcoord;
                    return v2f;
                }

                
                fixed4 frag(myV2F v2f) : COLOR {
                    fixed4 c = tex2D (_MainTex, v2f.uv) ;
                    
                    return c;
                }

                ENDCG
            }
        }
    }

  • 相关阅读:
    用Photoshop制作一寸照片
    每天只问孩子这4句话,胜过百般疼爱
    机场也有打折季,你知道吗?请收好这份扫货指南
    这8个习惯会让孩子越来越笨,甚至抑郁!父母赶紧收手
    读后感该怎么写
    vue-cli 4058错误
    bootstrap img自适应
    移动端高清、多屏适配方案
    去掉页面滚动条
    js 404页面跳转
  • 原文地址:https://www.cnblogs.com/wantnon/p/4457058.html
Copyright © 2011-2022 走看看