Engine makes the decision about blending per-shape.
If you use glTF model format, this always has explicit information (never acAuto
) whether to use alpha testing, blending, or treat shape as opaque.
If you use Blender, you can explicitly specify alpha treatment at Blender material. It will be correctly exported to glTF.
The engine looks at material transparency
field, and the texture’s alpha channel. If transparency
is > 0, or if the texture has non-trivial alpha channel (this is detected by analyzing alpha contents, see TEncodedImage.AlphaChannel
description), then we use blending.
Note
|
This auto-detection cannot be always right.
For example, the alpha channel detection at the image (TEncodedImage.AlphaChannel ) is a heuristic, with some alpha tolerance. And what happens when multiple textures are used, with different alpha channel? Or if you use GLSL shader code to set/modify alpha value (the engine never parses your GLSL code, so it doesn’t know about it)?
The engine essentially makes an educated guess about the author’s intentions.
To be clear what happens, we advise to always specify the alpha treatment explicitly. One easy way to do this is just to use glTF (in this format, alpha treatment is always specified explicitly). Or set TAppearanceNode.AlphaChannel from Pascal.
|