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

  • 相关阅读:
    帮助理解Docker,生动装逼介绍Docker
    Java 最常见 200+ 面试题 + 全解析
    CentOS7.0 yum安装 docker
    集合总结
    C#复习笔记
    match方法的使用
    偏函数
    通用装饰器
    装饰器修饰带参数的功能函数
    多个装饰器的使用
  • 原文地址:https://www.cnblogs.com/wantnon/p/4457058.html
Copyright © 2011-2022 走看看