I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Difference between revisions of "Legacy:Color Blending"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m (moved anchor)
m (even more anchors, wikified)
 
Line 7: Line 7:
 
;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.
 
;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.
  
;<span id="masked">Masked</span>: The first pixel in the [[Legacy:Palette|palette]] is 100% transparent; all others are 100% opaque.
+
;<span id="masked">Masked</span>: The first pixel in the [[Legacy:Palette|palette]] is 100% transparent; all others are 100% opaque.<br />There is a utility called "[[Legacy:Bright|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.<br />In UT2003 this will only work with 8bit textures.
 
+
;<span id="translucent">Translucent</span>: The brightness of the color determines it's opacity. i.e.  
 
+
There is a utility called "[[Legacy:Bright|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
 
;* white is 100% opaque
 
;* a middle bright colour such as grey or medium yellow is partially transparent
 
;* a middle bright colour such as grey or medium yellow is partially transparent
 
;* black is 100% translucent
 
;* black is 100% translucent
 
;:This doesn't work well in some configurations (possibly MacOS + Glide) unless the <tt>#EXEC IMPORT</tt> also has <tt>FLAGS=2</tt>. If you plan to draw <tt>STY_Translucent</tt>, always use <tt>FLAGS=2</tt>.
 
;:This doesn't work well in some configurations (possibly MacOS + Glide) unless the <tt>#EXEC IMPORT</tt> also has <tt>FLAGS=2</tt>. If you plan to draw <tt>STY_Translucent</tt>, always use <tt>FLAGS=2</tt>.
 
+
;<span id="modulated">Modulated</span>: Multiplies the destination pixels by the source if the source is darker than 127,127,127. Screens the destination pixels if the source is brighter than 127,127,127. (like the Photoshop "Overlay" mode).  This results in:
;Modulated: Multiplies the destination pixels by the source if the source is darker than 127,127,127. Screens the destination pixels if the source is brighter than 127,127,127. (like the Photoshop "Overlay" mode).  This results in:
+
 
;* color 0,0,0 = darken whatever is behind it
 
;* color 0,0,0 = darken whatever is behind it
 
;* color 127,127,127 = no change
 
;* color 127,127,127 = no change
 
;* color 255, 255, 255 = brighten whatever is behind it
 
;* color 255, 255, 255 = brighten whatever is behind it
  
Additional modes in new engine versions (e.g. UT2003):
+
=== Additional modes in new engine versions (e.g. UT2003) ===
  
 
;Alpha: Uses an [[Legacy:Alpha Channel|alpha channel]] to determine the translucency of the texture's pixels.
 
;Alpha: Uses an [[Legacy:Alpha Channel|alpha channel]] to determine the translucency of the texture's pixels.

Latest revision as of 16:11, 12 August 2016

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[edit]

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 destination pixels by the source if the source is darker than 127,127,127. Screens the destination pixels if the source is brighter than 127,127,127. (like the Photoshop "Overlay" 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)[edit]

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[edit]

These rendering modes can apply to:

Canvas[edit]

In UnrealScript, set Canvas.Style.

Actor[edit]

For Actors, use Display -> Style

Styles[edit]

Declared as an enum in the Actor class.

UT[edit]

// Style for rendering sprites, meshes.
 
var(Display) enum ERenderStyle
{
     STY_None,
     STY_Normal,
     STY_Masked,
     STY_Translucent,
     STY_Modulated,
} Style;

UT2003[edit]

// 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[edit]