////////////////////////////////////////////////////////////////////////////
// Default Technique
technique10 DefaultTechnique
{
pass Pass0
{
SetBlendState( AlphaBlendingStateOn, float4( 0.0f, 0.0f, 0.0f, 0.0f ),
0xFFFFFFFF );
SetGeometryShader(NULL);
SetVertexShader(CompileShader(vs_4_0, DefaultVS()));
SetPixelShader(CompileShader(ps_4_0, DefaultPS()));
}
}
Check this out in the following figure, which shows a 50% transparent rab
-
bit over a red surface. It creates a kind of weird orange result, although it
appears to be a nice shade of gray in the book! I achieved this by forcing
the alpha value from the pixel shader to be 0.5.
Texture Mapping 101Texture Mapping 101
It’s kind of hard to think of texture mapping qualifying as advanced
Direct3D material. Just about every 3D game that has come out in the last
few years has used it, so it can’t be terribly complex. When drawing your
3D objects with only a solid color (or even a solid color per vertex that is
Gouraud shaded across the triangle pixels), they look rather bland and
uninteresting. Objects in the real world have detail all over them, from the
rings in woodgrain to the red and white pattern on a brick wall.
Chapter 9: Advanced Direct3D n 423
Figure 9.1: Alpha blending

Get Advanced 3D Game Programming with DirectX 10.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.