zoukankan      html  css  js  c++  java
  • 草摆动shader

    Shader "Custom/Grass" {  
        Properties {  
            _MainTex ("Grass Texture", 2D) = "white" {}  
            _TimeScale ("Time Scale", float) = 0.2  
        }  
      
        SubShader{  
            Tags{"Queue"="Transparent" "RenderType"="Opaque" "IgnoreProject"="True"}  
            Pass{  
                Tags{"LightMode"="ForwardBase"}  
      
                ZWrite Off  
                Blend SrcAlpha OneMinusSrcAlpha  
                Cull Off  
      
                CGPROGRAM  
                #pragma vertex vert  
                #pragma fragment frag  
                #include "UnityCG.cginc"   
      
                sampler2D _MainTex;  
                half _TimeScale;  
      
                struct a2v {  
                    float4 vertex : POSITION;  
                    float4 texcoord : TEXCOORD0;  
                };  
                  
                struct v2f {  
                    float4 pos : SV_POSITION;  
                    float2 uv : TEXCOORD0;  
                };  
      
      
                v2f vert(a2v v){  
                    v2f o;  
                    float4 offset = float4(0,0,0,0);  
                    offset.z = sin(3.1415 * _Time.y * clamp(v.texcoord.y-0.5, 0, 1))  * _TimeScale;  
                    o.pos = UnityObjectToClipPos(v.vertex + offset);  
                    o.uv = v.texcoord.xy;  
                    return o;  
                }  
      
                fixed4 frag(v2f i) : SV_Target{  
                    return tex2D(_MainTex, i.uv);  
                }  
      
                ENDCG  
            }  
        }  
        FallBack Off  
    } 

    效果:

  • 相关阅读:
    ftp服务器架设
    samba服务器架设
    apache安装
    yum及prm安装
    redis安装与使用
    memcached安装与使用
    mysql主从服务器
    nginx负载均衡服务器搭建
    lnmp环境搭建
    linux笔记
  • 原文地址:https://www.cnblogs.com/louissong/p/7510687.html
Copyright © 2011-2022 走看看