I'm very newbie at unity shader programming. And I've tried some lines of Shader codes. But I couldn't understand the result of it.
Here's my shader codes.
Shader "Test/MyShader"{
Properties
{}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct vertInput
{
float4 vertex : POSITION;
};
struct fragInput
{
float4 vertex : SV_POSITION;
};
fragInput vert (vertInput IN)
{
fragInput o;
o.vertex = UnityObjectToClipPos(IN.vertex);
return o;
}
fixed4 frag (fragInput IN) : SV_Target
{
return fixed4(IN.vertex);
}
ENDCG
}
}
}
I applied this shader code to the normal Plane. I expected the result to be seemed like spectrums. But what I've got is very different from what I've expected.
Usefull links:
- Unity shaders predefined variables where you can read about
_ScreenParams
- Unity shaders predefined methods where you can read about
UnityObjectToClipPos(...)