O'Reilly logo

Lua Game Development Cookbook by Mário Kašuba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing a fragment (pixel) shader

Fragment shader operates on pixel fragments from the rasterization process. The rasterizer transforms the whole graphical scene into a set of values that form fragments. A set of values that are related to one graphical primitive is called a fragment. These values may contain colors, alpha transparency, depth values, or even user supplied data. The fragment shader program might even decide whether to discard certain pixels from being drawn into the frame buffer.

Fragment shaders are often used in two-pass postprocessing. In the first pass, the whole scene is rendered into the texture or a buffer by using the first fragment shader. This shader renders primitives without postprocessing effects. In the second pass, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required