NiAlphaProperty

From GECK
Jump to: navigation, search

NiAlphaProperty tells the engine how to render a NiGeometry's alpha and supports two modes as well as options for both as to how the final alpha effect is resolved.

A typical example of a NiAlphaProperty.

Modes

Alpha in Fallout 3 and Fallout: New Vegas comes in two types. Test, where alpha is a binary value (the alpha'd pixel is either drawn or isn't), and Blend, where alpha can be a gradient that goes from transparent to opaque. Test alpha has smoothed pixel edges and has a configurable threshold to finetune coverage, whereas Blend is only as smooth as dense as texel density allows and has multiple options for how colors are blended. They are not mutually exclusive, and can be combined if desired.

The fields are as follows:

  • Name: A name field, recommended for animation.
  • Num Extra Data List: Total number of Extra Data blocks.
  • Extra Data List: A NiExtraData block can be added here.
  • Controller: Seemingly not used, use NiAlphaController to manipulate the Alpha value of NiMaterialProperty instead.
  • Flags: Configures how the alpha operation is performed, see the tables below for specifics.
  • Threshold: Used for Test alpha, sets the minimum value for the pixel to not be discarded.

Configuration

Common blend settings.
  • Enable Blending: Enables Blend alpha, requires a texture with either DXT3, DXT5, or uncompressed DDS to take full advantage.
  • Source Blend Mode: How this object's (the "foreground") color is determined.
  • Destination Blend Mode: How the color of background objects is determined.
  • Enable Testing: Enables Test alpha, can use DXT1, DXT3, DXT5, or uncompressed DDS.
  • Alpha Test Function: Determines how the threshold works.
  • Alpha Test Threshold: 0-255 threshold range for Test alpha.
  • No Sorter: Unused, Gamebryo specific sorting flag.

Source/Destination Modes

Flag Description
One Multiply by 1 (no modification)
Zero Multiply by 0
Src Color Multiply by Source color value
Inv Src Color Multiply by inverse Source color value
Dst Color Multiply by Destination color value
Inv Dst Color Multiply by inverse Destination color value
Src Alpha Multiply by Source Alpha channels (diffuse & vertex colors)
Inv Src Alpha Multiply by inverse Source alpha channels (diffuse & vertex colors)
Dst Alpha Multiply by Destination Alpha channels (diffuse & vertex colors)
Inv Dst Alpha Multiply by inverse Destination Alpha channels (diffuse & vertex colors)
Src Alpha Saturate Determines the color based on the smallest value compared between source alpha or One minus destination alpha

Test Modes

Flag Description
Always All pixels are drawn
Less Pixels are displayed when below this value
Equal Pixels are displayed only when at this value
Less or Equal Pixels are displayed when at this value or below
Greater Pixels are displayed when greater than this value
Not Equal Pixels are displayed when not at this value
Greater or Equal Pixels are displayed when at or above this value
Never Disables the threshold

Notes

AlphaBlendingExample.png
  • For objects to blend correctly, they require either the tris of the mesh or the blocks in the NIF to be ordered correctly. Lower tri numbers cannot blend with tris at a higher number than them and can only blend with tris at an even lower number. For objects, replace the tri number with the index of the block.
  • Blend alpha forces the object to be in single-pass mode, and can cause lighting issues if multiple lights are illuminating the object. Test alpha does not have this issue.

See Also