这里的POSITION是变量Position的语义,告诉寄存器,此变量的保存位置,通常语义用于着色器的输入和输出,以冒号":"的方式进一步说明此变量,COLOR也类似
还有什么语义呢?
HLSL核心函数:
float3 Pixels = Texture2DSample(Tex, TexSampler, myUV);
for(int i = 0; i < n; i++) {
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(offset, 0));
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(-offset, 0));
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(0, offset));
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(0, -offset));
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(offset, -offset));
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(-offset, offset));
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(offset, offset));
Pixels += Texture2DSample(Tex, TexSampler, myUV + float2(-offset, -offset));
}
Pixels /= 8 + 1;
return Pixels;
模糊
float2 myUV = floor(uv * 20) / 20;
float3 Pixels = Texture2DSample(Tex, TexSampler, myUV);
return Pixels;
像素化