Game Development Reference
In-Depth Information
Figure 15.1
Different effects created by pixel and vertex shaders.
You can compile shaders ahead of time for all the different shader versions and test
them against your video cards, and this is definitely recommended for a commercial
environment. Compiling at runtime is how most programmers develop shaders. In
the example you are about to see, the shader will be loaded and compiled at
runtime.
Compiling Shaders == Lunchtime
I worked at Slipgate on an unannounced MMO. This was a triple-A game with
tonsof shaders in it. It took close to an hour to recompile every single shader
for all platforms. Fortunately, this was a very rare occurrence; usually shaders
were modified in small batches, so it wasn
t too bad. There were a few times
during development, however, where we were forced to do this massive
recompile. When that happened, productivity ground to a complete halt. We
just went to lunch.
'
This chapter will present you with an example of a vertex shader written in HLSL,
the C++ code you need to access it within your game, and the same for a pixel
shader. There are other types of shaders, such as geometry shaders and compute
 
Search WWH ::




Custom Search