Created
September 16, 2015 14:31
-
-
Save EsProgram/70e2bf1a127ccbaf4c38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shader "Custom/DynamicVF" { | |
| Properties{ | |
| _MainTex("Texture", 2D) = "white"{} | |
| } | |
| SubShader{ | |
| Pass{ | |
| CGPROGRAM | |
| #pragma vertex vert | |
| #pragma fragment frag | |
| #include "UnityCG.cginc" | |
| struct appdata_t | |
| { | |
| float4 vertex:POSITION; | |
| float4 texcoord:TEXCOORD0; | |
| float3 normal:NORMAL; | |
| }; | |
| struct v2f | |
| { | |
| float4 pos:POSITION; | |
| float2 uv:TEXCOORD0; | |
| }; | |
| sampler2D _MainTex; | |
| float4 _MainTex_ST; | |
| v2f vert(appdata_t v) | |
| { | |
| v2f o; | |
| o.pos = mul(UNITY_MATRIX_MVP, v.vertex); | |
| o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); | |
| o.pos.xyz += _SinTime.w*normalize(v.normal); | |
| return o; | |
| } | |
| float4 frag(v2f i) :COLOR{ | |
| return tex2D(_MainTex, i.uv); | |
| } | |
| ENDCG | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment