nuclide/Documentation/Materials/commands/alphafunc.md

30 lines
1.1 KiB
Markdown
Raw Normal View History

2022-10-02 17:10:54 -07:00
# Materials: Commands {#mat_commands}
## alphafunc
### Syntax {#syntax}
**alphaFunc <func>**
### Overview {#overview}
Determines the alpha test function used when rendering this surface.
Valid values are **GT0**, **LT128**, and **GE128**. These correspond to
**"GREATER THAN 0"**, **"LESS THAN 128"**, and **"GREATER THAN OR EQUAL
TO 128"**.
This function is used when determining if a pixel should be written to
the frame-buffer. For example, if **GT0** is specified, the only the
portions of the texture map with corresponding alpha values greater than
zero will be written to the framebuffer. **By default alpha testing is
disabled.**
Both alpha testing and normal [alpha
blending](blendFunc) can be used to get
textures that have see-through parts. The difference is that
**alphaFunc** is an all-or-nothing test, while blending smoothly blends
between opaque and translucent at pixel edges.
Alpha test can also be used with
[depthWrite](depthWrite), allowing other
effects to be conditionally layered on top of just the opaque pixels by
setting [depthFunc](depthFunc) to equal.