What is a shader?

What is a shader, discussed here: http://www.gamedev.net/community/forums/topic.asp?topic_id=169710

I’v read it but it is too high level for me

What parameters does shader include, like struct? How does it relate to Material, what parameters does material include?

Thanks for anyone saying it in understandable way

this gamedev.net-topic is much more on than simply “implementing shader”;
but to answer your question, in the general realtime computer graphics jargon “a shader” is simply a kind of program that run’s directly on the graphic board itself and modifies either fragment- (~pixel) or vertex- (~geometry) data.
the term “shader” is a little bit confusing description, so the ARB decided to name the both opengl “shaders” are simply “program”; hence the names of the extensions “…fragment_program” and “…vertex_program”.

the gamedev.net-topic mentioned by you is on the very hot issue, on how to implement this features in a good way in a 3D engine, because this can end in several problems, if your application is going to be bigger and bigger.
the wise use and implementation of “shaders”, no matter if GL or D3D, is a very important point in big applications, because your whole rendering-system has to integrate the “shaders” in a kind of “central role” between the textures, materials and mesh/geometry data.
yes, in small programs this would be no big issue - but if your scene rendering gets more and more complex, you will stuck into some problems, if your integration of these techniques is not good. (think on ton’s of state-,texture-,material- and shader-program-changes, which are possibly done)

[This message has been edited by DJSnow (edited 08-29-2003).]

Thank snow dude!

Did I get it right that the shader they are talkin’ there is an object than contains the vertex/fragment program with some extra goodies (info about required streams, …)?

  • little dude

>>Did I get it right that the shader they
>>are talkin’ there is an object than
>>contains the vertex/fragment program

yes. the guys are talking over implementing a kind of shader: they include into the shader the essential information, in their case this would be the shadercode itself (independently from a specific API, this meands GL or D3D) and some other stuff, things like states or matrices, for fragment or vertex manipulation, and the streams which are needed by each shader to render it - BUT then the people are combining these shaders to “effects”, because a specific optical effect on a peace of geometry consits, usually, of more than only one shader, may this be a vertex or fragment shader. in most cases there are combined one vertex and one pixel shader, mostly.