赞
踩
CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; float4 normal: NORMAL; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; // float4 worldNormal : TEXCOORD1; // float4 worldNormal : COLOR; // float4 worldNormal : TEXCOORD11; float4 worldNormal : TANGENT; }; sampler2D _MainTex; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); o.worldNormal = mul(unity_ObjectToWorld,v.normal); return o; } fixed4 frag (v2f i) : SV_Target { return fixed4(i.worldNormal.xyz, 1); fixed4 col = tex2D(_MainTex, i.uv); return col; } ENDCG
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。