Alpha masking

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
 
(2 intermediate revisions by one user not shown)
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.
  
When an alpha masked texture is recognized, Trainz will also compress [[texture file]]s using DXT1a compression rather than the DXT3 required for normal alpha blending. This provides a 50% reduction in texture memory usage.
+
= Materials which support alpha masking =
 +
The following materials support alpha masking:
 +
* [[m.pbrmetalmasked]]
 +
* TBD: legacy materials which optionally support alpha masking.
  
''TBD: Materials which support alpha masking.''
+
=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 (except for certain auto-switching legacy materials). The appropriate [[Material Types|material type]] must be used to achieve the desired outcome.
  
''TBD: Control of alpha masking via texture.txt file''
+
''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.''
  
 
''TBD: Discussion of using alpha testing without a b&w texture.''
 
''TBD: Discussion of using alpha testing without a b&w texture.''
 +
 +
''TBD: Overdraw concerns''
  
 
[[Category:Texture mapping]]
 
[[Category:Texture 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