I have a very simple shader:
Shader "MAGIC/AtlasTransfer"
{
Properties
{
_Cube ("Cubemap", CUBE) = "" {}
}
SubShader
{
Pass
{
CGPROGRAM
#include "UnityCustomRenderTexture.cginc"
#pragma vertex CustomRenderTextureVertexShader
#pragma fragment frag
samplerCUBE _Cube;
float3 UnpackNormalFromOct(float2 f)
{
float3 n = float3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y));
float t = max(-n.z, 0.0);
n.xy += n.xy >= 0.0 ? -t.xx : t.xx;
return normalize(n);
}
fixed4 frag (v2f_customrendertexture i) : COLOR
{
float3 normal = UnpackNormalFromOct(i.localTexcoord.uv);
return texCUBE(_Cube, normal);
}
ENDCG
}
}
}
But it throw me that error:
at that line:
float3 normal = UnpackNormalFromOct(i.localTexcoord.uv);
I’m not sure why … I don’t know, maybe I’m dumb because I really don’t see what’s the issue … I have checked that passing i.localTexcoord.xyz works to be sure it’s the correct syntax, beyond that I think I forgot about something … Obviously I can just use the content of the function without wrapping it, but then I’ll just delay the problem for another shader …