Alpha masking

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
 
Line 7: Line 7:
  
 
=Control of alpha masking via texture.txt file=
 
=Control of alpha masking via texture.txt file=
[[texture.txt file]]s may be created with masked alpha, either by using a perfectly black and white (as opposed to grayscale) alpha channel, or by forcing alpha masking using the appropriate tags. This controls the contents of the texture file, but does NOT affect the behavior of the material. The appropriate [[Material Types|material type]] must be used to achieve the desired outcome.
+
[[texture.txt file]]s may be created with masked alpha, either by using a perfectly black and white (as opposed to grayscale) alpha channel, or by forcing alpha masking using the appropriate tags. This controls the contents of the texture file, but does not affect the behavior of the material (except for certain auto-switching legacy materials). The appropriate [[Material Types|material type]] must be used to achieve the desired outcome.
  
 
''TBD: alpha masking vs mip mapping''
 
''TBD: alpha masking vs mip mapping''

Latest revision as of 20:33, 24 October 2017

Alpha masking refers to a special case of alpha blending where all pixels are rendered as either fully opaque (100% alpha) or fully transparent (0% alpha) with no partial transparency. This can be treated as a special case because it does not require alpha sorting in order to produce visually correct results. On most hardware, this provides a significant performance win over an equivalent alpha sorted material. On some hardware, this is substantially slower than an opaque material. This technique also guarantees correct visual outcomes, whereas alpha sorting is inevitably an approximation which will show incorrect results in certain edge cases.

[edit] Materials which support alpha masking

The following materials support alpha masking:

  • m.pbrmetalmasked
  • TBD: legacy materials which optionally support alpha masking.

[edit] Control of alpha masking via texture.txt file

texture.txt files may be created with masked alpha, either by using a perfectly black and white (as opposed to grayscale) alpha channel, or by forcing alpha masking using the appropriate tags. This controls the contents of the texture file, but does not affect the behavior of the material (except for certain auto-switching legacy materials). The appropriate material type must be used to achieve the desired outcome.

TBD: alpha masking vs mip mapping

[edit] TBD

TBD: Image of alpha mask and the in-game result, versus alpha blending.

TBD: Discussion of using alpha testing without a b&w texture.

TBD: Overdraw concerns

Personal tools