SMARTSHADER, The Basics :
I'm sure you've all seen pre-rendered
scenes that play out at the start of games and wondered
why the game itself couldn't match that quality. Getting
realistic effects into games is not so much the challenge,
it's getting them there in real time and in a way that
the user can interact with them that was the prime objective.
Past graphics cards lacked raw power and had to rely
heavily on optimisations that allowed them to perform
certain effects quickly while leaving the CPU with its
infinitely more flexible and programmable architecture
to deal with routines that weren't hardwaired into the
graphics chip. This delicate partnership often meant
major sacrifices in framerate and quality until such
a time as the next graphics card came along which, with
any luck, would have these new features built in.
The whole idea of pixel shaders
is to give the graphics pipeline the same programmability
that was once the edict of the CPU. Graphics chips are
now sufficiently powerful and flexible to allow for
specialised routines to be run within the graphics core
and this of course opens up a whole new world to the
games coder who can now see his new effects run on current
hardware at blistering framerates without having to
wait for the next generation of card to come along,
assuming the next generation card has support for his
exciting new effects that is.

The Old Way Of Implementing New Graphics Techniques
and Effects

The New Way, Simple, Direct and Efficient
It's easy to leave
the subject at that, but what differentiates one shader
from another? SMARTSHADER was developed with a couple
of primary aims, those being to create fast, flexible
hardware accelerated pipelines and to do it with a strong
focus on eliminating some of the major architecture
bottlenecks, the main one being memory bandwidth. Although
the shader technology introduced in DirectX 8 was a
welcome addition, it was noted that the limitations
were too great for full implementation and so ATi in
consultation with leading developers and with Microsoft
themselves added new and improves features to the original
set, features that we'll see fully exploited with the
release of DirectX 8.1.
The Feature Set
:
- Support for up to six textures
in a single rendering pass, allowing more complex
effects to be achieved without the heavy memory bandwidth
requirements and severe performance impact of multi-pass
rendering
- A simplified yet more powerful
instruction set that lets developers design a much
wider ranger of graphical effects with fewer operations
- Pixel shaders up to 22 instructions
in length (compared to 12 instructions in DirectX
® 8.0 Pixel Shaders) allow more accurate simulation
of the visual properties of materials
- Ability to perform mathematical
operations on texture addresses as well as color values,
enabling new types and combinations of lighting and
texturing effects that were previously impossible
Types of Shader :
The seemingly simple act of displaying
a 3D image is actually the result of a pretty complex
set of steps. In T&L (Transform and Lighting) such
as the Radeon or GeForce, geometry processing takes
place within the GPU, relieving the CPU of this burden.
The result of these calculations is that the raw vertex
data fed to the GPU is often modified or changed completely
leading to a whole new set of vertices that need working
with. There are two ways this data can then be dealt
with, the first is by using the fixed function T&L
unit for simple calculations, or the programmable vertex
shader if specific routines need to be carried out on
the individual vertices. There is a third way of course
which is to allow the CPU to handle these functions
which must be done on older cards that have no support
for these features, but this leads to a major performance
hit.

Next it's on to
the rendering stage where the 3D vertex information
must be "flattened" and rendered ready to
be passed to the frame buffer prior to being displayed.
This "flattening" operation is of course far
more than just converting the 3D data to a 2D image,
it is here that colour information is used to calculate
how each pixel must be displayed in the final image
to give the desired result. Again this can be handled
by fixed function texturing, filtering and blending
instructions, or for more advanced techniques where
individual pixels need to have additional data added,
a programmable pixel shader is used to perform the task.
Once in the frame buffer, the data is then either displayed
on screen or sent through the pipeline again for additional
effects to be added. It should therefor be obvious that
the more a GPU can do as the vertex data is passing
though the 3D pipeline, the less the likelihood it will
need to go through for a second "pass" and
the greater the performance.
Now we know where
the vertex and pixel shaders fit into the 3D pipeline.
Let's look at each one individually.
Page
3 - The Vertex Shader