xna - How to use shaders in MonoGame? -
can tell me, how use shaders in monogame?
i have error: https://gamedev.stackexchange.com/questions/46994/has-anyone-got-the-krypton-lighting-engine-working-in-monogame-for-windows-8
i tried use 2mgfx, tool reports: effect must contain @ least 1 technique , pass. can see myshader.fx file, does.
here shader code:
sampler texturesampler : register(s0); float _valuealpha = 1; float _valuergb = 1; float4 main(float4 color : color0, float2 texcoord : texcoord0) : color0 { // texture color. float4 tex = tex2d(texturesampler, texcoord); // convert greyscale. constants 0.3, 0.59, , 0.11 because // human eye more sensitive green light, , less blue. float greyscale = dot(tex.rgb, float3(0.3, 0.59, 0.11)); // 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(); } }
i tried changing technique technique
, , pass pass
, still throws "the effect must contain @ least 1 technique , pass"
i got work! :)
first of used 2mgfx tool. loaded effect this:
binaryreader reader = new binaryreader(file.open(@"content\\myshader.mgfxo", filemode.open)); myshader = new effect(graphicsdevice, reader.readbytes((int)reader.basestream.length));
hope else too! :)
thanks!
Comments
Post a Comment