FNA 的 Shader 编译命令行

FNA 的 HLSL Shader 编译的方法

一、步骤

  1. fxc.exe 下载: https://github.com/prime31/Nez/tree/master/DefaultContentSource/FNAShaderCompiler
  2. 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();
    }
}
posted @ 2025-06-26 22:29  fanbal  阅读(19)  评论(0)    收藏  举报