Where can I find documentation on UNITY_SAMPLE_1CHANNEL and other Unity internal shader stuff?
Also what is the difference between
fixed4 col = tex2D(_MainTex, i.texcoord);
fixed4 col = UNITY_SAMPLE_1CHANNEL(_MainTex, i.texcoord);
Where can I find documentation on UNITY_SAMPLE_1CHANNEL and other Unity internal shader stuff?
Also what is the difference between
fixed4 col = tex2D(_MainTex, i.texcoord);
fixed4 col = UNITY_SAMPLE_1CHANNEL(_MainTex, i.texcoord);
I do not know where to get the documentation, but you may look how it works here:
DRIVE: \ UnityFOLDER \ Editor \ Data \ CGIncludes.
The only references to it are found in HLSLSupport.cginc
#if defined(SHADER_API_D3D11_9X)
#define UNITY_SAMPLE_1CHANNEL(x,y) tex2D(x,y).r
#define UNITY_ALPHA_CHANNEL r
#else
#define UNITY_SAMPLE_1CHANNEL(x,y) tex2D(x,y).a
#define UNITY_ALPHA_CHANNEL a
#endif
So with D3D11 it gets the alpha from the red channel otherwise it gets it from the Alpha?
Why does Unity get Alpha from Red with D3D11 using this function?