/Utilities/Graphics/BlendMode.cs
C# | 69 lines | 12 code | 5 blank | 52 comment | 0 complexity | 43884dd020614a974376748411bd24bd MD5 | raw file
Possible License(s): Apache-2.0
- namespace Delta.Utilities.Graphics
- {
- /// <summary>
- /// Blending presets are used for setting alpha blending operations of
- /// various types for producing different effects. Now set directly
- /// in materials because we want to sort them by blend mode too :)
- /// Note: Needed in Content modules already because atlas textures
- /// need to know about the blend modes!
- /// </summary>
- public enum BlendMode
- {
- /// <summary>
- /// The default preset is opaque, which is the fastest blending type
- /// because it uses no blending obviously. Also works with AlphaTesting,
- /// which is decided once a material is created (then an AlphaTest shader
- /// will be chosen). This blend state is the default for all materials
- /// that have no alpha channel in the diffuseMap!
- /// </summary>
- Opaque,
-
- /// <summary>
- /// Same as opaque, but use AlphaTest to discard any pixel below 0.66f
- /// in the alpha channel. Rendering this is faster than Translucency
- /// because we need no sorting and we can skip lots of pixels, which
- /// makes the pixel shader go faster. This is however not always true for
- /// mobile GPUs as discard is sometimes as expensive as actual rendering!
- /// Still this is a useful feature to not write to the depth buffer for
- /// transparent pixels thus helping with sorting.
- /// </summary>
- AlphaTest,
-
- /// <summary>
- /// Subtractive rendering mode is pretty much the opposite of additive
- /// blending. Instead of always adding more brightness to the target
- /// screen pixels, this one subtracts brightness. It is usually and
- /// mostly only used for fake shadowing effects (blob shadows) and
- /// sometimes in clever combinations of particle effects.
- /// </summary>
- Subtractive,
-
- /// <summary>
- /// Additive blending is used to accumulate the color we already got
- /// on screen plus the diffuseMap * AmbientColor. This makes the result
- /// image brighter and should be used with care. Has the advantage that
- /// we do not need to sort, we can just render this out in any order
- /// on top of the Opaque materials and it will always look the same.
- /// This blend state usually has to be set by hand to a material!
- /// </summary>
- Additive,
-
- /// <summary>
- /// The normal version of alpha blending, which uses ambientColor.A *
- /// diffuseMap alpha and blends that with SrcAlpha InvDestColor (default
- /// alpha blending technique). This blend mode is the default for
- /// all materials that have an alpha channel in diffuseMap!
- /// Note: Only translucent images with alpha should use this blend mode.
- /// </summary>
- Translucency,
-
- /// <summary>
- /// LightEffect, which is using a special blend mode of DestColor+One,
- /// which will maybe change later a bit. Basically used for light effects
- /// (similar to lightmap shader, but just using a lightmap, no diffuse
- /// texture). Needs to set by hand for lightmap materials, only a couple
- /// of materials even need to use this, e.g. glow, light and flare effects.
- /// </summary>
- LightEffect,
- }
- }