Unity3DUGUI实现翻书特效-创新互联
本文实例为大家分享了Unity3D UGUI翻书展示的具体代码,供大家参考,具体内容如下
10年积累的成都做网站、网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先做网站设计后付款的网站建设流程,更有绥宁免费网站建设让你可以放心的选择与我们合作。参考大佬的,链接找不到了,找到了再加在这。
下边是Shader代码:
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' Shader "Personal/PageTurning" { Properties { _Color ("Color", Color) = (1,1,1,1) _MainTex("MainTex",2D)="White"{} _SecTex("SecTex",2D)="White"{} _Angle("Angle",Range(0,180))=0 _Warp("Warp",Range(0,10))=0 _WarpPos("WarpPos",Range(0,1))=0 _Downward("Downward",Range(0,1))=0 } SubShader { pass { Cull Back CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct v2f { float4 pos : POSITION; float2 uv : TEXCOORD0; }; fixed4 _Color; float _Angle; float _Warp; float _Downward; float _WarpPos; sampler2D _MainTex; float4 _MainTex_ST; v2f vert(appdata_base v) { v2f o; v.vertex += float4(5,0,0,0); float s; float c; sincos(radians(-_Angle),s,c); float4x4 rotate={ c,s,0,0, -s,c,0,0, 0,0,1,0, 0,0,0,1}; float rangeF=saturate(1 - abs(90-_Angle)/90); v.vertex.y += -_Warp*sin(v.vertex.x*0.4-_WarpPos* v.vertex.x)*rangeF; v.vertex.x -= rangeF * v.vertex.x*_Downward; v.vertex = mul(rotate,v.vertex); v.vertex += float4(-5,0,0,0); o.pos = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.texcoord,_MainTex); return o; } fixed4 frag(v2f i):COLOR { fixed4 color = tex2D(_MainTex,-i.uv); return _Color * color; } ENDCG } pass { Cull Front CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct v2f { float4 pos : POSITION; float2 uv : TEXCOORD0; }; fixed4 _Color; float _Angle; float _Warp; float _Downward; float _WarpPos; sampler2D _SecTex; float4 _MainTex_ST; v2f vert(appdata_base v) { v2f o; v.vertex += float4(5,0,0,0); float s; float c; sincos(radians(-_Angle),s,c); float4x4 rotate={ c,s,0,0, -s,c,0,0, 0,0,1,0, 0,0,0,1}; float rangeF=saturate(1 - abs(90-_Angle)/90); v.vertex.y += -_Warp*sin(v.vertex.x*0.4-_WarpPos* v.vertex.x)*rangeF; v.vertex.x -= rangeF * v.vertex.x*_Downward; v.vertex = mul(rotate,v.vertex); v.vertex += float4(-5,0,0,0); o.pos = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.texcoord,_MainTex); return o; } fixed4 frag(v2f i):COLOR { float2 uv = i.uv; uv.x = -uv.x; fixed4 color = tex2D(_SecTex,-uv); return _Color * color; } ENDCG } } }
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网页名称:Unity3DUGUI实现翻书特效-创新互联
本文来源:http://scyanting.com/article/dgdjcs.html