Jump to content
  • Advertisement
Sign in to follow this  
Ainokea

OpenGL What exactly are shaders?

This topic is 4875 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

Advertisement
Lots and lots.

(For more specific answers, please give more specific questions.)

Per pixel lighting, for example, is not easily done without pixel shaders. Per vertex computations are done far more efficiently on the GPU.

Share this post


Link to post
Share on other sites
Shader basics lecture given in #graphicsdev earlier today.

Shaders allow you to compute quantities on a per vertex or per pixel basis efficiently on the GPU. Vertex shaders can be done (more slowly) on the CPU; pixel shaders can't be done without a software renderer (not counting hardware support, obviously).

Basically, this ability gives you a lot of power and flexibility in terms of what you do. Compare Doom 3 to Quake 3. That's the difference shaders make.

Share this post


Link to post
Share on other sites
The 'old' Fixed Function Pipeline is very limited. It can handle T&L Vertex calculations and some more functions, but not the fancy stuff for example Cartoon Shading. With Shaders, you actually replace the Fixed Function Pipeline with your own calculations.

In case you don't know what I'm talking about: see Pipeline as the thing that all your data goes through to end up correctly on the screen. E.g. 3D Vertex ->Pipeline-> 2D Pixel.
So with shaders you can do anything with the Pipeline.

Share this post


Link to post
Share on other sites
Before shaders, graphics hardware processed data in One Way. You could customize things a little bit by turning states on and off, controlling the way different aspects of that One Way behaved, but at the end of the day the One Way was all there was. You couldn't add new bits to it, create entirely new states to change the One Way in some particular manner, and so on. That One Way is better known as the 'Fixed Function Pipeline.'

Shaders simply allow you to replace that One Way with your Own Way. Want to do fog which changes colour with height? The fixed function pipeline had no provision for doing that, but you could write a shader to do it. Want to do dot3 lighting but subtract the redness of the result from the green and blue? Fixed function can't do it. Shaders can.

Share this post


Link to post
Share on other sites
A shader is a program that is on the graphics card.

Because it is on the graphics card and modifies resources on the graphics card it is much faster than computing values on the main cpu and sending to the graphics card. Technically you can do everything on the cpu that you can do with shaders, only much much slower.

Shaders are compiled to a low level assembly-like language and sent to the gpu at runtime.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks. I get the idea now.


BTW:I'm Ainokea, I'm at a school computer so I can't log in.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!