Game Development Reference
In-Depth Information
This sample can be done without using pixel shaders. However, it is
easy and straightforward to implement this application, and it allows us
to demonstrate how to write, create, and use pixel shaders without get-
ting distracted by the algorithm of some special effect.
Although we are only using three textures at once in this sample, it
is worthwhile to go over the number of sampler objects that can be
used with each pixel shader version. In other words, how many tex-
tures we can use at once depends on the pixel shader version that we
use.
Pixel shader versions ps_1_1 to ps_1_3 support up to four texture
samples.
Pixel shader version ps_1_4 supports up to six texture samples.
Pixel shader versions ps_2_0 to ps_3_0 support up to 16 texture
samples.
The pixel shader for multitexturing with two textures is implemented
as follows:
//
// File: ps_multitex.txt
//
// Desc: Pixel shader that does multitexturing.
//
//
// Globals
//
sampler BaseTex;
sampler SpotLightTex;
sampler StringTex;
//
// Structures
//
struct PS_INPUT
{
float2 base : TEXCOORD0;
float2 spotlight : TEXCOORD1;
float2 text
: TEXCOORD2;
};
struct PS_OUTPUT
{
vector diffuse : COLOR0;
};
//
// Main
//
Search WWH ::




Custom Search