谁能告诉我,如何在单人游戏中使用着色器?
我尝试使用 2MGFX,但工具报告:效果必须包含至少一种技术并通过。从我从 myshader.fx 文件中可以看到,确实如此。
这是我的着色器代码:
sampler TextureSampler : register(s0);
float _valueAlpha = 1;
float _valueRGB = 1;
float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
// Look up the texture color.
float4 tex = tex2D(TextureSampler, 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 greyscale = dot(tex.rgb, float3(0.3, 0.59, 0.11));
// The input color alpha controls saturation level.
tex.rgb = lerp(greyscale, tex.rgb *_valueRGB, color.a *_valueAlpha);
return tex;
}
technique Technique1
{
pass Pass1
{
PixelShader = compile ps_3_0 main();
}
}
我尝试将技术更改为Technique
,并将传递更改为Pass
,但它仍然抛出“效果必须包含至少一种技术并传递”