Color Blending
Color blending modes (or rendering modes) specify how the color of an individual texture pixel is merged with the color of the corresponding background pixel it is going to be drawn on.
Color Blending Modes
- None
- Graphics are not drawn.
- Normal
- Every pixel is 100% opaque. If you #EXEC IMPORT it with FLAGS=2, then every pixel that uses the first entry in the pallette will be 100% transparent and the rest will be 100% opaque.
- Masked
- The first pixel in the palette is 100% transparent; all others are 100% opaque.
There is a utility called "Bright" distributed by Epic, that helps with this. It has a command line option "-pinkmask" that makes all pink pixels (R=255, G=0, B=255) transparent, and all others opaque.
In UT2003 this will only work with 8bit textures.
- Translucent
- The brightness of the color determines it's opacity. i.e.
- white is 100% opaque
- a middle bright colour such as grey or medium yellow is partially transparent
- black is 100% translucent
This doesn't work well in some configurations (possibly MacOS + Glide) unless the #EXEC IMPORT also has FLAGS=2. If you plan to draw STY_Translucent, always use FLAGS=2.
- Modulated
- Multiplies the source and destination pixels by 2 (like the Photoshop "Multiply" mode). This results in:
- color 0,0,0 = darken whatever is behind it
- color 127,127,127 = no change
- color 255, 255, 255 = brighten whatever is behind it
Additional modes in new engine versions (e.g. UT2003):
- Alpha
- Uses an alpha channel to determine the translucency of the texture's pixels.
- Additive
- Adds the color in the source pixels to the background. A red pixel painted onto a blue background will result in a purple pixel being shown. Additive differs from translucent in that translucent actors will can stack up on the screen and become more opaque, where additive actors will not. For example, if you had 100 red translucent clouds in a row, they would stack up and you would see just red if you looked through all of them at once. If it were additive clouds, they would add their red to the background but stop adding when the red was maxed out (R=255) so you could still see what was behind.
- Subtractive
- This is essentially the same as additive, but the source pixels color is subtracted from the background. This is not that useful of a drawtype, but it does have a strong application in making smoke (bluish-white particles set to subtractive make a nice brownish-black color.)
- Particle
- only used for Emitters. This causes the Emitter to draw its particles.
- AlphaZ
- what does this do?
Opaque is the opposite of translucent; you can't see through something opaque. If it's 75% opaque (or 25% translucent), it's slightly transparent; you can see through it a slightly. 0% opaque is 100% translucent; it's invisible and not drawn.
#EXEC IMPORT with FLAGS=2 is the same as having the texture property flag bTranslucent set within Ued/2. This makes first colour in the palette 100% transparent.
Usage
These rendering modes can apply to:
Surfaces
In UnrealEd, open the surface properties window and check the appropriate checkboxes. See Texture Effects for more details.
Canvas
In UnrealScript, set Canvas.Style.
Actor
For Actors, use Display → Style
Styles
Declared as an enum in the Actor class.
UT
// Style for rendering sprites, meshes. var(Display) enum ERenderStyle { STY_None, STY_Normal, STY_Masked, STY_Translucent, STY_Modulated, } Style;
UT2003
// Style for rendering sprites, meshes. var(Display) enum ERenderStyle { STY_None, STY_Normal, STY_Masked, STY_Translucent, STY_Modulated, STY_Alpha, STY_Additive, STY_Subtractive, STY_Particle, STY_AlphaZ, } Style;
Related Topics
- See Unreal Coding FAQ for more information