CHAPTER 5 ■ GETTING THE MOST OUT OF VERTICES
498
In this effect, your pixel shader will need to know the 3D position as well, so you pass the
3D world position to the pixel shader (because the Output.Position is not accessible in the
pixel shader).
Pixel Shader: Simplest
With your vertex shader altering the 3D position of each vertex, this simple pixel shader
assigns the same color to each pixel and renders them to the screen:
OWPixelToFrame OWPixelShader(OWVertexToPixel PSIn) : COLOR0
{
OWPixelToFrame Output = (OWPixelToFrame)0;
float4 waterColor = float4(0,0.1,0.3,1);
Output.Color = waterColor;
return Output;
}
Technique Definition
Adding the technique definition makes your effect usable as it is. If you update the xTime vari-
able each frame, ...