Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

A MonoGame Effect controls how graphics are rendered: it can transform vertices, sample textures, calculate lighting, and determine pixel color. Use BasicEffect for ordinary 3D rendering; for a custom visual such as grayscale sprites, add an .fx file to your content build, load it with Content.Load<Effect>(), set its parameters, and pass it to SpriteBatch.Begin. For manually drawn 3D geometry, apply each effect pass before issuing the draw call.

This guide follows MonoGame 3.8.x. MonoGame announced version 3.8.5 on July 15, 2026; that release adds a code-centric Content Builder alongside the established MGCB workflow. The examples below use MGCB Editor because it is documented for effect creation; exact templates and tooling can vary by version and target. MonoGame 3.8.5 release notes.

What is an effect in MonoGame?

An Effect is a GPU rendering program. It contains one or more techniques; each technique contains one or more passes. A pass applies shader work—typically a vertex shader and a pixel shader—to graphics submitted through the GraphicsDevice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Vertex shader: processes vertices, commonly transforming positions into screen clip space and passing data such as colors and texture coordinates onward.
  • Pixel shader: determines the color or visibility of pixels, often by sampling textures and combining them with other inputs.
  • Technique: a rendering strategy containing its passes. CurrentTechnique identifies the active one.
  • Pass: a stage of that strategy. Call pass.Apply() before drawing the geometry for that pass.
  • Parameters: values such as matrices, time, colors, and textures that C# supplies to the shader.

Effects are not limited to image filters. They can transform geometry, calculate lighting, sample or combine textures, discard pixels, or render a mesh in multiple passes. MonoGame’s Effect API exposes its technique and parameter collection.

#1 Best Overall
Acer Predator Helios Neo 18 AI Gaming Laptop | Intel Core Ultra 9 Processor 275HX | NVIDIA GeForce RTX 5070 Ti | 18" WQXGA 240Hz G-SYNC | 32GB DDR5 | 2TB Gen 4 SSD | Killer Wi-Fi 6E | PHN18-72-9474
  • Desktop-Level Performance, Anywhere: Get legendary gaming performance with the Intel Core Ultra 9 275HX processor, delivering ultra-smooth gameplay and future-ready AI (Up to 13 NPU TOPS). Offload tasks like background removal and audio optimization to the NPU for seamless streaming and gaming, while Intel Application Optimization enhances performance on classic titles.
  • Game-Changing Realism: Powered by NVIDIA Blackwell architecture, GeForce RTX 5070 Ti Laptop GPU unlocks the game changing realism of full ray tracing. Equipped with a massive level of 992 AI TOPS horsepower, the RTX 50 Series enables new experiences and next-level graphics fidelity. Experience cinematic quality visuals at unprecedented speed with fourth-gen RT Cores and breakthrough neural rendering technologies accelerated with fifth-gen Tensor Cores.
  • Supreme Speed. Superior Visuals. Powered by AI: DLSS is a revolutionary suite of neural rendering technologies that uses AI to boost FPS, reduce latency, and improve image quality. DLSS 4 brings a new Multi Frame Generation and enhanced Ray Reconstruction and Super Resolution, powered by GeForce RTX 50 Series GPUs and fifth-generation Tensor Cores.
  • The Ultimate in Ray Tracing and AI: NVIDIA RTX is the most advanced platform for full ray tracing and neural rendering technologies that are revolutionizing the ways we play and create. Over 700 games and applications use RTX to deliver realistic graphics and incredibly fast performance with cutting-edge AI features like DLSS Multi Frame Generation.
  • Immersive Depth and Detail: At 18 inches with a 16:10 aspect ratio, the pristine WQXGA screen offering vibrant colors with up to 100% DCI-P3 operates at a fast 240Hz refresh and 3ms overdrive response time. Alongside the suite of features from NVIDIA G-SYNC and NVIDIA Advanced Optimus, you're guaranteed that whatever's on-screen is a distinct viewing delight.

Choose a built-in effect or write a custom one

Use BasicEffect for straightforward 3D

BasicEffect supports optional texturing, vertex colors, fog, and lighting. It is usually the simplest choice for ordinary 3D geometry when those features meet the need; a custom shader adds work and maintenance without automatically improving performance. See the BasicEffect API.

private BasicEffect _basicEffect;

protected override void LoadContent()
{
    _basicEffect = new BasicEffect(GraphicsDevice)
    {
        TextureEnabled = true,
        VertexColorEnabled = true,
        LightingEnabled = false
    };
}

private void DrawGeometry(Matrix world, Matrix view, Matrix projection)
{
    _basicEffect.World = world;
    _basicEffect.View = view;
    _basicEffect.Projection = projection;

    foreach (EffectPass pass in _basicEffect.CurrentTechnique.Passes)
    {
        pass.Apply();
        GraphicsDevice.DrawUserPrimitives(
            PrimitiveType.TriangleList,
            _vertices,
            0,
            _vertices.Length / 3);
    }
}

Enable or configure the features your geometry needs, and supply suitable vertex data and textures. The example disables lighting; if lighting is required, configure the effect’s lighting and directional-light properties as well.

Use the default sprite effect for ordinary 2D drawing

SpriteBatch uses MonoGame’s SpriteEffect by default. For ordinary sprites, use SpriteBatch without a custom effect. Add a custom sprite effect when you need an operation such as grayscale, color replacement, distortion, dissolve, palette manipulation, pixelation, or custom movement of sprite vertices. MonoGame documents SpriteEffect as the default effect for SpriteBatch.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Know the other built-ins

MonoGame’s current custom-effects documentation lists these built-in effects as supported on current platforms:

  • AlphaTestEffect for alpha-tested rendering.
  • DualTextureEffect for rendering with two textures.
  • EnvironmentMapEffect for environment or reflection mapping.
  • SkinnedEffect for skinned meshes.

They serve particular rendering needs; they are not universal replacements for custom shaders. See the MonoGame custom-effects documentation.

Create and compile a custom effect

In the traditional workflow, an .fx file is processed as a content asset before the game loads it. In MGCB Editor, open the content project, add the shader file, choose a Sprite Effect template for a sprite shader when available (or a general Effect template), save the content project, and build it. The official MonoGame shader tutorial demonstrates creating a Sprite Effect and editing its generated file. Template contents can differ between MonoGame versions and target platforms.

MonoGame 3.8.5 also introduced a code-centric Content Builder. The MGCB steps here describe the established pipeline rather than claiming that every 3.8.5 project must use the editor. Consult the 3.8.5 release announcement for that release’s tooling context.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Lenovo Legion 5 15IRX10 15.1" WQXGA OLED, Gaming Laptop, Intel Core i9 14th Gen 14900HX 1.6GHz; NVIDIA GeForce RTX 5070 8GB GDDR7; 32GB DDR5 RAM; 1TB NVMe M.2 SSD; Gigabit LAN, 2x2 WiFi 7
  • Intel Core i9 14th Gen 14900HX 1.6GHz Processor, NVIDIA GeForce RTX 5070 8GB GDDR7, 32GB DDR5-5600 RAM
  • 1TB PCIe Gen4 x4 NVMe M.2 SSD
  • 15.1" WQXGA OLED Glossy Display
  • Gigabit LAN, 2x2 WiFi 7 (802.11be), Bluetooth 5.4
  • 4.19 lbs. (1.90 kg),Windows 11 Home

Here is an illustrative pixel-shader effect that desaturates a sprite. It follows a cross-platform profile pattern, but it is not a promise that every MGCB-generated template is textually identical:

#if OPENGL
    #define VS_SHADERMODEL vs_3_0
    #define PS_SHADERMODEL ps_3_0
#else
    #define VS_SHADERMODEL vs_4_0_level_9_1
    #define PS_SHADERMODEL ps_4_0_level_9_1
#endif

float Saturation = 1.0f;

struct VertexShaderOutput
{
    float4 Position : SV_POSITION;
    float4 Color    : COLOR0;
    float2 TexCoord : TEXCOORD0;
};

Texture2D SpriteTexture;
sampler2D SpriteTextureSampler = sampler_state
{
    Texture = <SpriteTexture>;
};

VertexShaderOutput SpriteVertexShader(
    float4 position : POSITION0,
    float4 color    : COLOR0,
    float2 texCoord : TEXCOORD0)
{
    VertexShaderOutput output;
    output.Position = position;
    output.Color = color;
    output.TexCoord = texCoord;
    return output;
}

float4 SpritePixelShader(VertexShaderOutput input) : COLOR0
{
    float4 color = tex2D(SpriteTextureSampler, input.TexCoord) * input.Color;
    float luminance = dot(color.rgb, float3(0.299f, 0.587f, 0.114f));
    color.rgb = lerp(luminance.xxx, color.rgb, Saturation);
    return color;
}

technique SpriteTechnique
{
    pass Pass1
    {
        VertexShader = compile VS_SHADERMODEL SpriteVertexShader();
        PixelShader  = compile PS_SHADERMODEL SpritePixelShader();
    }
}

Saturation interpolates between grayscale luminance at zero and the original color at one. The sampler reads the sprite texture, then multiplies by the incoming vertex color. A sprite vertex shader must handle the inputs supplied by SpriteBatch—position, color, and texture coordinates—and produce usable clip-space output. The advanced sprite-vertex tutorial explains those input semantics and coordinate requirements.

Load an effect and set its parameters

Load the built content asset once, normally in LoadContent, and keep the instance for rendering. The asset must be in the content project and successfully built; merely adding an .fx file to the C# project does not make it a loadable content asset.

private Effect _grayscaleEffect;

protected override void LoadContent()
{
    _grayscaleEffect = Content.Load<Effect>("Effects/Grayscale");
}

The name is relative to the content root and normally omits the .fx extension. Rebuild content after shader edits. The usual approach is the Effect content processor and ContentManager; the official documentation also describes compiling with MGFXC and loading a compiled effect manually. The pipeline route is the recommended general workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set parameters before the draw operation that consumes them:

_grayscaleEffect.Parameters["Saturation"]?.SetValue(0.0f);
_effect.Parameters["World"]?.SetValue(worldMatrix);
_effect.Parameters["View"]?.SetValue(viewMatrix);
_effect.Parameters["Projection"]?.SetValue(projectionMatrix);
_effect.Parameters["Time"]?.SetValue((float)gameTime.TotalGameTime.TotalSeconds);
_effect.Parameters["TintColor"]?.SetValue(Color.Red.ToVector4());
_effect.Parameters["NoiseTexture"]?.SetValue(noiseTexture);

Names are examples, not built-in conventions: the name and data type must match the parameters retained in your compiled effect. A compiler can remove a declared parameter if the shader never uses it. The null-conditional operator prevents an exception when a name is missing, but it can also hide a typo. During development, validate required parameters explicitly:

private static EffectParameter RequireParameter(Effect effect, string name)
{
    EffectParameter? parameter = effect.Parameters[name];

    if (parameter == null)
        throw new InvalidOperationException(
            $"Effect parameter '{name}' was not found.");

    return parameter;
}

MonoGame’s documentation warns that declared default parameter values may not behave as expected on OpenGL targets. Set required values from code, or use compile-time constants when appropriate.

Rank #3
Sale
Light Gaming Laptop, ΑΜD Ryzen 7430U (Up to 4.3GHz), 16GB RAM 512GB SSD
  • 【EFFICIENT PERFORMANCE】KAIGERR light gaming laptop featuring the latest AMD Ryzen R2544 Processor (boasting 3.7GHz high-frequency). Outperforming the Celeron N5095/N100/N97/N95, it delivers robust multitasking capabilities. The laptop computer has an integrated UHD graphics card clocked at up to 1200MHz for stronger graphics processing performance. KAIGERR laptop is designed to elevate your computing experience.
  • Huge Capacity Storage: KAIGERR laptop comes with 16GB SODIMM DDR4 RAM, advantages of large operating memory capacity both can reduce read latency of memory data and improve CPU utilization for seamless multitasking, paired with a 512GB M.2 NVMe SSD that ensures lightning-fast boot speeds, rapid application loading, and ample storage space for all your files.
  • Brilliant Display & Integrated Graphics: The KAIGERR Light gaming laptop features a brilliant FHD display with an innovative thin-bezel design that maximizes screen space for a truly immersive viewing experience, while the integrated AMD Radeon Graphics deliver smooth and detailed image processing for enjoying computer games and tackling photo editing projects with ease.
  • Rich Interfaces & Wireless Connectivity: KAIGERR traditional laptop offers a variety of connectivity options, including HDMI, Type-C, 3.5mm TRRS Jack, Memory Card Slot and USB3.2 ports. You can easily connect to various devices and peripherals to expand your capabilities. Mini laptop computers equipped with WiFi6 & Bluetooth 5.2 which offer strong wireless signal, fast wireless connections, and reliable transmission speed
  • Portable Design & Durable: KAIGERR laptop compact design makes it easy to carry with you wherever you go. Also, you can enjoy the benefits of a powerful computer without the bulk of a traditional desktop. KAIGERR laptop computers are built with high-quality components and designed to handle heavy workloads and deliver consistent performance and longevity. If you encounter any problems, please contact us and we will help you solve the problem within 12 hours

Apply a custom effect to sprites

Pass the effect to SpriteBatch.Begin. Every sprite drawn before the matching End uses that batch’s effect:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
_grayscaleEffect.Parameters["Saturation"]?.SetValue(0.0f);

_spriteBatch.Begin(
    sortMode: SpriteSortMode.Deferred,
    blendState: BlendState.AlphaBlend,
    samplerState: SamplerState.PointClamp,
    effect: _grayscaleEffect);

_spriteBatch.Draw(_texture, destinationRectangle, Color.White);
_spriteBatch.End();

For example, draw a background in grayscale and a player sprite normally by using separate batches:

_grayscaleEffect.Parameters["Saturation"]?.SetValue(0.0f);
_spriteBatch.Begin(effect: _grayscaleEffect);
_spriteBatch.Draw(background, Vector2.Zero, Color.White);
_spriteBatch.End();

_spriteBatch.Begin();
_spriteBatch.Draw(player, playerPosition, Color.White);
_spriteBatch.End();

One effect is selected for each Begin/End block. If a sprite should not receive it, end that batch and draw the sprite in another. MonoGame’s shader tutorial covers supplying an effect to Begin and the consequences of deferred batching.

Different parameter values per sprite

With the usual SpriteSortMode.Deferred, sprite draws are processed later. Changing an effect parameter between Draw calls does not snapshot its value for each sprite; the final value may be used across the batch. Choose an approach that matches the rendering need:

  • Use separate Begin/End blocks when only a few groups need different values.
  • Use SpriteSortMode.Immediate when immediate application suits the draw path, setting parameters at the correct time. It can reduce batching efficiency and does not automatically make every parameter change behave as a per-sprite value.
  • Encode varying data in supported per-sprite inputs, such as vertex color, if the shader can interpret it.
  • Use a specialized rendering path or separate render targets when the effect requires data that ordinary sprite inputs cannot carry.

Apply an effect to 3D geometry

A general 3D effect is applied while submitting vertex or index data, rather than passed to SpriteBatch. Set the matrices and other inputs, choose a technique if needed, apply each pass, and draw the geometry:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
_effect.Parameters["World"]?.SetValue(world);
_effect.Parameters["View"]?.SetValue(view);
_effect.Parameters["Projection"]?.SetValue(projection);
_effect.Parameters["DiffuseTexture"]?.SetValue(texture);

foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
{
    pass.Apply();
    GraphicsDevice.DrawIndexedPrimitives(
        PrimitiveType.TriangleList,
        0,
        0,
        vertexCount,
        0,
        primitiveCount);
}
  1. Set matrices, textures, and any other parameters the shader requires.
  2. Select the desired technique if the effect has more than one.
  3. Iterate the active technique’s passes and call Apply().
  4. Issue the corresponding geometry draw call for each pass.

For a named technique, set it before drawing:

_effect.CurrentTechnique = _effect.Techniques["SkinnedTechnique"];

The technique and parameter names must exist in the compiled effect. A technique may contain multiple passes, and geometry usually needs to be submitted for every pass. MonoGame’s Effect API documents CurrentTechnique and the effect collections.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use an effect with a model

Model mesh parts hold effects. You can assign a custom one to each part:

Rank #4
KAIGERR Gaming Laptop, 24GB DDR5 512GB NVMe SSD Laptop Computer with AMD Ryzen 7 H255(8C/16T, Up to 4.9GHz), 16.0 inch Windows 11 Laptop, Radeon RX Vega 8 Graphics,WiFi 6, Backlit KB
  • 【ENGINEERED FOR SPEED】The KAIGERR 2026 RX16 laptop is equipped with the powerful AMD Ryzen 7 H255 processor (8C/16T, up to 4.9GHz), delivering superior performance and responsiveness. This upgraded hardware ensures a smooth experience, fast loading times, and high-quality visuals. It provides an immersive, lag-free experience. Its performance is far moere than 30% better than AMD R7 5700U/5800U/5825U/6600HX/7735HS.
  • 【Advanced Dual-Fan Cooling】KAIGERR’s dual-fan system expels heat faster than standard designs, drastically reducing thermal buildup during intense gaming or work. Optimized airflow keeps components cool, prevents throttling, and maintains smooth, sustained performance—all while staying quiet. Stay cool, play longer.
  • 【INSPIRE YOUR POSSIBILITIES】 The laptop on sale comes with 16GB DDR5 memory and a 512GB M.2 NVMe SSD for faster response times and ample storage. Dual-channel DDR5 memory supports upgrades to 64GB (2x32GB), and NVMe/NGFF SSD can be upgraded to 4TB, providing plenty of space for all your favorite videos/files.
  • 【Vivid 16.0" IPS Display】Featuring a wide color gamut and high refresh rate, the 16.1" IPS screen delivers smoother motion, richer colors, and exceptional detail—surpassing standard displays in both accuracy and immersion. Whether gaming, streaming, or creating, every frame appears lifelike and dynamic for a truly engaging visual experience.
  • 【KAIGERR: Quality Laptops, Exceptional Support.】Enjoy peace of mind with unlimited technical support and 12 months of repair for all customers, with our team always ready to help. If you have any questions or concerns, feel free to reach out to us—we’re here to help.
foreach (ModelMesh mesh in model.Meshes)
{
    foreach (ModelMeshPart part in mesh.MeshParts)
    {
        part.Effect = _effect;
    }
}

Replacing a model’s original effects transfers responsibility for the data and behavior they supplied. Depending on the model, that may include material textures and colors, lighting, fog, normal data, or bone transforms for skinning. A custom effect must implement the model’s required inputs, and the game must set them before drawing. For a modest visual change, adapting an existing effect is often less error-prone than replacing all of its material or animation behavior.

Keep shader profiles and backends in view

MonoGame processes FX shaders for different graphics backends; HLSL syntax in an .fx file does not mean the same compiled shader runs unchanged everywhere. The official custom-effects documentation lists DirectX profiles including vs_4_0_level_9_1/ps_4_0_level_9_1, vs_4_0_level_9_3/ps_4_0_level_9_3, vs_4_0/ps_4_0, vs_4_1/ps_4_1, and vs_5_0/ps_5_0. Higher profiles require the HiDef graphics profile at runtime where applicable. For OpenGL, the documentation lists vs_2_0/ps_2_0 and vs_3_0/ps_3_0 feature levels. Availability depends on the target and graphics profile; do not assume one profile is suitable for every build.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Conditional compilation lets a shader choose profiles by backend, as in the sample above. The documented compiler symbols include 2MGFX, HLSL and SM4 for DirectX, and OpenGL and GLSL for OpenGL. MonoGame’s documentation says OpenGL FX shaders are translated to GLSL through MojoShader and notes platform differences, including default effect-parameter behavior. Test the shader on the actual backends and profiles you intend to ship.

When replacing a sprite vertex shader, preserve the inputs expected from SpriteBatch—POSITION0, COLOR0, and TEXCOORD0—and ensure the vertex shader emits clip-space positions and outputs that agree with the pixel shader’s inputs. Mismatched semantics or signatures can cause compilation errors or invalid rendering.

Diagnose common effect problems

Content.Load<Effect>() cannot find the asset

  • Confirm the .fx file is included in the content project and processed by the effect content processor.
  • Check that the load name is relative to the content root and matches the asset path; the usual load name omits .fx.
  • Rebuild content and check that built output is copied where the game can load it.
  • Check compatibility between the game and content pipeline’s MonoGame versions.

The shader does not compile

  • Check that the selected shader model is supported by the target profile.
  • Verify FX syntax, platform conditionals, and the compiler symbols actually available in the build.
  • Check that vertex and pixel shader inputs and outputs agree, including semantics such as POSITION0, COLOR0, and TEXCOORD0.
  • Review texture and sampler declarations and avoid features the target compiler does not support, including unsupported preshaders noted in MonoGame’s documentation.

The effect produces black or invisible output

  • Confirm the pixel shader returns a valid color and that the intended texture is bound to its sampler.
  • For a custom vertex shader, verify it outputs clip-space coordinates.
  • Check that required matrices and other parameters are set, alpha is not zero, and the active technique has a usable pass.
  • Check for parameters removed because they are unused or misspelled, and inspect blend, depth, and culling state for conflicts.

It works on DirectX but not OpenGL

Check the profile conditionals, unsupported shader constructs, explicit parameter assignments, vertex/pixel interface, and texture/sampler declarations. Also confirm the target’s graphics profile and backend capabilities; MonoGame documents translation and default-value differences for OpenGL rather than promising identical behavior across backends.

The effect does not change individual sprites

In deferred mode, parameter values are not automatically captured separately for each draw. Split sprites into batches, use immediate mode with deliberate parameter timing, or move the varying value into supported per-sprite data.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A model loses its original appearance

Check which inputs its previous effects supplied—such as textures, material colors, lighting, and bone transforms—and make sure the replacement effect and game code provide the equivalent behavior needed by that model.

Balance shader flexibility against rendering cost

Effects execute on the GPU, but complex shader instructions still consume GPU time. Multiple passes repeat work; changing techniques, blend states, samplers, or render targets can add state changes. Splitting many sprites into separate batches may also reduce batching efficiency, while immediate sprite mode can make parameter timing easier at the cost of batching. A general-purpose effect is not inherently faster than a built-in one; specialize only when the visual requirements or measured behavior justify the added maintenance. Any performance comparison needs to be measured on the relevant GPU, backend, resolution, and MonoGame version.

Quick choice guide

Need Approach
Ordinary textured 3D geometry BasicEffect, configured for the required features
Normal 2D sprite drawing Default SpriteBatch effect
Grayscale, tint, dissolve, or another custom sprite operation Custom sprite .fx effect passed to SpriteBatch.Begin
Custom 3D lighting or vertex behavior Custom effect applied to geometry passes
More than one rendering stage Technique with the necessary passes
Different shader values for individual sprites Separate batches, immediate rendering with deliberate timing, or per-sprite input data
Cross-platform deployment Conservative profiles, conditional compilation, and testing on target backends

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.