标签:
Shader "Sbin/vf36" { SubShader { pass{ CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct v2f{ float4 pos : POSITION; float4 col : COLOR; }; v2f vert(appdata_base v){ //v.vertex.y += sin(-length(v.vertex.xz)+_Time.y)/2; v.vertex.y +=sin((v.vertex.x+v.vertex.z)+_Time.y)/2; v.vertex.y +=sin((v.vertex.x-v.vertex.z)+_Time.y)/2; v2f o; o.pos = mul(UNITY_MATRIX_MVP,v.vertex); o.col = fixed4(0,v.vertex.y,1,1); return o; } fixed4 frag(v2f v):COLOR { return v.col; } ENDCG } } }
石头丢进水里效果:xz方向水波纹效果:
Cg入门15:Vertex Shader - 几何变换 —波
标签:
原文地址:http://blog.csdn.net/aa4790139/article/details/50964307