Shader Model 3.0 Feature OverviewLet's take a look at some of the features made available by Shader Model 3.0 indicate some of the possibilities they bring. Common Features of VS 3.0 and PS3.0:Flexible Input and Output Declarations - The 3.0 Shader Model requires Shaders to declare their input and output registers before usage. This declaration allows inputs/outputs to be packed and unpacked with little effort, hence saving memory bandwidth and instructions (manual pack/unpack). It also increases the actual number of inputs/outputs available while writing a shader. Static (constant based) Flow Control - Static Flow Control allows sections of a program to be skipped (static “constant based†branching) or repeated (static “constant based†looping). The main usage of this functionality is to allow one large program to be used for multiple purposes, e.g. a single vertex shader program can support multiple light types and multiple light counts, and this avoids costly state changes. Nesting of both branches and loops is supported up to 4 levels deep. Dynamic (temporary registers based) Flow Control - Dynamic Flow Control allows sections of a program to be skipped or repeated based on a value calculated within the shader, and this value and hence the code path executed can be different from one vertex/pixels to another vertex/pixels.Arbitrary Swizzle Support - The 2.0 shader model supports only a very small and limited subset of swizzles, which means that very often move instructions are required to copy data into the correct locations. All these overhead move instructions can be removed thanks to full swizzle support which is available on 3.0 shader. Vertex Shader:Vertex Texturing - Vertex Texturing is the capability of supporting texture access from within the vertex shader. Typical usage of this is simulation of physics effects where the physics model is run on the pixel shader and the results are shown on screen by reading back this result and displaying it as geometry. For example, particle effects and cloth animation can be achieved using this principle. Displacement Mapping is also possible and this is especially interesting when combined with higher order surfaces or tessellation. Vertex Stream Frequency / Geometry Instancing - The Vertex shader reads its input data from streams, and in the 3.0 model these input streams can run at different rates. This allows advanced effects such as geometry compression where the low rate (slow) stream contains rough vertex positions and the high rate (fast) stream contains very small perturbations relative to the rough vertex positions. These perturbations can be encoded with very few bits and hence a form of compression is achieved since the rough base vertex position is only read for every X vertices. Another feature is the possibility to loop a number of times over the same vertex buffer, and this allows you to create multiple instances of the same object without driver overhead. For example, a forest can be created by supplying the base tree position in the slow stream, the fast stream contains the actual tree model and is looped through for each element of the slow stream. Pixel Shader:Pixel Shader Non Restricted Texture Instructions - The 3.0 model requires the number of texture instructions to be unrestricted unlike the limit of 32 in model 2.0 and the dependent chain limit of 4. This allows for more complicated effects to be implemented. |
|