Chapter 7: Vertex Functions
The term shader originates from the fact that C for Graphics (Cg) has been mainly used to simulate realistic lighting conditions (shadows) on three-dimensional (3D) models. Despite this, shaders are now much more than that. They not only define the way objects are going to look, but they can also redefine their shapes entirely. If you want to learn how to manipulate the geometry of a 3D object via shaders, this is the chapter for you.
In Chapter 2, Creating Your First Shader, we explained that 3D models are not just a collection of triangles. Each vertex can contain data that is essential to render the model itself correctly. This chapter will explore how to access this information in order to use it in a shader. We will also explore in detail how the geometry of an object can be deformed simply by using Cg code.
In this chapter, you will learn the following recipes:
- Accessing a vertex color in a Surface Shader
- Animating vertices in a Surface...