Part I

Vertex Shader Reference

A vertex shader is made up of a set of instructions that operate on data for a single vertex. The shader is executed once for each vertex in a render primitive. A vertex shader will have one vertex input provided to it and will be expected to have one vertex output.

QUICK OVERVIEW

A vertex shader must do at least one thing: place the vertex’s position in clip-space coordinates in the output position register. That is, the vertex position must be transformed by the current model/world/view transformation matrix. Now if your world, model, and projection matrix were identity, then you could just pass in the value that is fed to the shader, but usually you’d be getting the vertex position in world coordinates, and ...

Get Real-Time Shader Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.