Transparent Diffuse
Reference Manual > Built-in Shader Guide > Transparent Shader Family > Transparent Diffuse

Transparent Diffuse

Transparent Properties

This shader can make mesh geometry partially or fully transparent by reading the alpha channel of the main texture. In the alpha, 0 (black) is completely transparent while 255 (white) is completely opaque. If your main texture does not have an alpha channel, the object will appear completely opaque.

Using transparent objects in your game can be tricky, as there are traditional graphical programming problems that can present sorting issues in your game. For example, if you see odd results when looking through two windows at once, you're experiencing the classical problem with using transparency. The general rule is to be aware that there are some cases in which one transparent object may be drawn in front of another in an unusual way, especially if the objects are intersecting, enclose each other or are of very different sizes. For this reason, you should use transparent objects if you need them, and try not to let them become excessive. You should also make your designer(s) aware that such sorting problems can occur, and have them prepare to change some design to work around these issues.

Diffuse Properties

This shader is a Pixel-Lit shader, which is more expensive than Vertex-Lit. Pixel lighting is expensive mostly because each object has to be drawn multiple times for each pixel light that shines on it. Vertex lights don't affect the shader in this way. Pixel lights support cookies, bumpmapping, and shadows while vertex lights do not. Pixel lights are also much less sensitive to tesselation of the models - if you have a cube using this shader, you can put point light very close to its surface and it will have nice round highlight. This effect cannot be achieved with Vertex lighting.

Diffuse computes a simple (Lambertian) lighting model. The lighting on the surface decreases as the angle between it and the light decreases. The lighting depends only on the this angle, and does not change as the camera moves or rotates around.

Performance

Generally, this shader is cheap to render. For more details, please view the Shader Peformance page.