Archived

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

ehmdjii

pixelshader vs vertexshader

Recommended Posts

ehmdjii    238
hi whats the key difference between a pixelshader and a vertexshader? yes, i can assume that the one shades pixels and the other vertices... but what does "shade" mean in this case? coloring? if so, how are the pixels colored between two vertices when using a vertexshader only? and when doing a cel-shader... would you do this with a pixel- or vertexshader? thanks!

Share this post


Link to post
Share on other sites
Raloth    379
"Shader" refers to a series of operations to perform on the given data. So, a "pixel shader" applies the operations to a pixel and a "vertex shader" applies the operations to the vertex. Cel-shading is usually done in a vertex shader.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
''shader'' is a seriously bad name for them, think of
them as ''programs'' instead, it makes slightly more sense


The root of the term comes from RenderMan''s (or REYES'') shade trees first developped by Robert L Cook of Pixar in 1984, who coined the term ''shader'' we still use today. Most if not all of the ''shader'' stuff we use nowadays has its root in RenderMan in one way or another.

Share this post


Link to post
Share on other sites
Raloth    379
The operations include things like addition, multiplication, subtraction, matrix math, dot products, etc. Yes, you can do both per-vertex and per-pixel lighting with shaders.

Share this post


Link to post
Share on other sites
ehmdjii    238
ok thanks.

maybe now i ask a little bit much but how would the lightning of sphere look like in pixelshader/vertexshader code?

thanks.

Share this post


Link to post
Share on other sites
dmounty    122
If you look up the reference articles on OpenGL pixel/vertex shaders (on the sgi site) they have an examples. Basically... vertex shaders REPLACE the normal T&L bit of the pipeline. ie no lighting/transformation etc is done. The basic method to light a general object (as T&L does) it outlined in the article... This is a waste of time, as the T&L pipeline would do the same... but it is well worth looking at to get more used to the way it all works. As for pixel shaders... They work in a similar way, but per pixel. This means you can do all sorts of trickery... look up phong shading for a simple example (essentially the OGL light model extended to per pixel). Once you understand those two.. you''ll be well on your way, and can look up more info... or try doing some stuff for yourself.

Share this post


Link to post
Share on other sites