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

  • 相关阅读:
    结对编程总结
    《构建之法》第4章读后感
    复利计算程序单元测试(C语言)
    命令解释程序的编写实验报告
    《软件工程》前三章读后感
    复利计算的总结
    复利单利计算的功能解释
    构建之法:1、2、3章阅读后感
    复利计算4.0
    复利计算3.0 以及总结
  • 原文地址:https://www.cnblogs.com/wantnon/p/4457058.html
Copyright © 2011-2022 走看看