This topic is now archived and is closed to further replies.

vertex shaders

This topic is 5814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Nope. You''ll also find them called "vertex programs" in some OpenGL extensions.

Traditionally the transformation & lighting part of the pipeline exposed by APIs like D3D has had fixed functionality - it transforms vertices in a certain fixed way, applies lights in a fixed way, and transforms texture coordinates in a fixed way. The FVF code allowed you to turn parts of this functionality on or off and nothing else.

A vertex shader is a small program written in a "shader language" which totally replaces the part of the pipeline between just after the vertex is fetched to just before the clipping takes place. The beauty is that you get to write the shader program and therefore get complete control over how the transform and light works - all the times with the FVF system you thought "if only I could just do xxx to the vertex".

The shader language gets translated into on-chip microcode by the driver for capable hardware (e.g. GeForce3). On older style hardware under D3D, the program gets translated/"compiled" into CPU specific code so is only marginally slower than the fixed function pipe.

You write the program in a specialised assembly language where every register is a 4 component vector of 32bit IEEE floats. The instruction set is geared towards transformation & lighting so is almost all maths operations (dot product, multiplies, lighting fragments etc). There is currently no branching, subroutines, or access to any other vertices (its a "stream" model, designed to be easily translated to SIMD/parallel type processing hardware).

Take a look on the nVidia, ATI and MSDN websites for more info.

Simon O''''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites