Alpha masking

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
[[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. This provides a significant performance win over an equivalent alpha sorted material.  
+
[[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.
  
''TBD: Materials which support alpha masking.''
+
= Materials which support alpha masking =
 +
The following materials support alpha masking:
 +
* [[m.pbrmetalmasked]]
 +
* TBD: legacy materials which optionally support alpha masking.
  
''TBD: 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.
 +
 
 +
''TBD: alpha masking vs mip mapping''
 +
 
 +
=TBD=
  
 
''TBD: Image of alpha mask and the in-game result, versus alpha blending.''
 
''TBD: Image of alpha mask and the in-game result, versus alpha blending.''
Line 10: Line 18:
  
 
''TBD: Overdraw concerns''
 
''TBD: Overdraw concerns''
 
''TBD: alpha masking vs mip mapping''
 
  
 
[[Category:Texture mapping]]
 
[[Category:Texture mapping]]

Revision as of 20:23, 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.

Materials which support alpha masking

The following materials support alpha masking:

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

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. The appropriate material type must be used to achieve the desired outcome.

TBD: alpha masking vs mip mapping

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