FNA 的 HLSL Shader 编译的方法
一、步骤
- fxc.exe 下载: https://github.com/prime31/Nez/tree/master/DefaultContentSource/FNAShaderCompiler
fxc.exe /T fx_2_0 MyEffect.fx /Fo MyEffect.fxb
二、示例 fx 文件
sampler s0;
float4 PixelShaderFunction( float2 texCoord:TEXCOORD0 ) : COLOR0
{
float4 tex = tex2D( s0, texCoord );
// convert it to greyscale. The constants 0.3, 0.59, and 0.11 are because the human eye is more sensitive to green light, and less to blue.
float grayScale = dot( tex.rgb, float3( 0.3, 0.59, 0.11 ) );
tex.rgb = grayScale;
return tex;
}
technique Technique1
{
pass Pass1
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}