© Kyle Halladay 2019
Kyle HalladayPractical Shader Developmenthttps://doi.org/10.1007/978-1-4842-4457-9_4

4. Translucency and Depth

Kyle Halladay1 
Bristol, UK

We know from Chapter 1 that colors in computer graphics commonly are made up of red, green, blue, and alpha channels. We’ve mostly focused on ways that we can work with the red, green and blue channels, and we’ve mostly ignored the alpha channel. This chapter is going to remedy that. We’re going to use the alpha channel to draw an entire scene’s worth of differently shaped objects, render everything from aliens to sun beams, and wrap up by animating a character. How exciting!

We’re going to start off by using the alpha channel of a texture to render something that isn’t rectangular on a ...

Get Practical Shader Development: Vertex and Fragment Shaders for Game Developers now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.