Graphics Reference
In-Depth Information
use that color for any further texture processing, including multitexturing or
managing the texture mode. This is described fully in the chapter on texture
mapping.
Other Data
In the previous chapter, we saw that an application can create atribute data
for each vertex, and that a vertex shader can take this atribute data and cre-
ate variables for the tessellation and geometry shaders that eventually pass
them on to be used in creating colors. Later in this chapter, we will see some
examples showing how this can be done. This is a particularly important capa-
bility for visualization that will be discussed in more detail in the visualization
chapter.
Coordinate Systems
If you will be using geometric information that has been passed into the frag-
ment shader as in variables, as we discussed in the last chapter, you will get
different effects, depending on the coordinate system that is used to develop
the geometric information for your fragment shader's use. In the next few sec-
tions, we will talk about how some of these coordinate systems affect your
images.
Model Coordinates
Model coordinates are directly available to the vertex shader from the per-ver-
tex variable we called aVertex (or gl_Vertex in compatibility mode), but must
be moved into output variables in the vertex shader before they can be passed
along to the tessellation or geometry shader and finally used in a fragment
shader. Similarly, the model-coordinate normal is available from the atribute
variable we called aNormal (or gl_Normal ) but must be moved into an output
variable by a vertex shader before it can be used in a fragment shader.
You are most likely going to want to use model coordinates for develop-
ing an appearance for your objects when you want that appearance to depend
on the object itself, and not on the location or orientation of the object in space.
For example, this could be the basis for a procedural texture that moved with
the object, as we will discuss later in this chapter. Another example of model-
coordinate textures could come from building a rectangular space with the
same dimensions as a 3D data texture and using slices of the space to view the
data in the texture, yielding a kind of volume visualization. Another example
of the use of model coordinates could be to create an object-linear one-dimen-
sional texture. This is discussed in the stripes example later in this chapter.
Search WWH ::




Custom Search