Синтаксис:
Используется glsl
Shader "sheidor" {
Properties {
_MainTex ("Texture", 2D) = "white" { }
_Mask ("Texture", 2D) = "white" { }
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
sampler2D _Mask;
sampler2D _MainTex_ST;
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert (appdata_base v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = TRANSFORM_TEX (v.texcoord, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 texcol = tex2D (_MainTex, i.uv);
return texcol;
}
ENDCG
}
}
}
Properties {
_MainTex ("Texture", 2D) = "white" { }
_Mask ("Texture", 2D) = "white" { }
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
sampler2D _Mask;
sampler2D _MainTex_ST;
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert (appdata_base v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = TRANSFORM_TEX (v.texcoord, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 texcol = tex2D (_MainTex, i.uv);
return texcol;
}
ENDCG
}
}
}
Матюкается на строку
Синтаксис:
Используется glsl
o.uv = TRANSFORM_TEX (v.texcoord, _MainTex);
Грит
Shader error in 'sheidor': invalid subscript 'xy' at line 28 (on d3d11)
Чому так? У меня ж там вообще никаких xy нету.