Archived

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

Rocket05

vertex shaders

Recommended Posts

ever since d3d8 came out, ill ive heard about are these vertex shaders. what are they exactly? are they just microsoft''s new term for their flexible vertex format?

Share this post


Link to post
Share on other sites
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
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Sweet !
I`ve got to get my hands on DX8

the bugle4D engine;
a new dimension in graphics...
[link]http://members.tripod.com/thefivelions/bugle4d/[/link]

Share this post


Link to post
Share on other sites