Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "VFX/MatrixTest"
- {
- Properties
- {
- _MainTex ("Texture", 2D) = "white" {}
- }
- SubShader
- {
- Tags { "RenderType"="Opaque" }
- Cull Off
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #include "UnityCG.cginc"
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- float4 color : COLOR;
- };
- struct v2f
- {
- float4 vertex : SV_POSITION;
- float2 uv : TEXCOORD0;
- float4 color : COLOR;
- };
- sampler2D _MainTex;
- float4 _MainTex_ST;
- v2f vert (appdata v)
- {
- v2f o;
- // o.vertex = UnityObjectToClipPos(v.vertex);
- float4 vertexPos = v.vertex; //LocalPos;
- vertexPos = mul(unity_ObjectToWorld, vertexPos); //WorldPos;
- vertexPos = mul(UNITY_MATRIX_V, vertexPos); //ViewPos;
- vertexPos = mul(UNITY_MATRIX_P, float4(vertexPos.xyz,1)); //ClipSpacePos;
- vertexPos = mul(unity_CameraInvProjection, vertexPos); //WorldPos;
- vertexPos = mul(UNITY_MATRIX_VP, vertexPos); //ClipSpacePos;
- o.vertex = vertexPos; //NDC
- o.uv = TRANSFORM_TEX(v.uv, _MainTex);
- o.color = v.color;
- return o;
- }
- fixed4 frag (v2f i) : SV_Target
- {
- return 1;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement