Shaders: Realtime Effects in a 2D Eviroment?
Hello. My little game engine uses OpenGL to render 2D graphics. It doesn't support any sort of 3D enviroment at all, but I'm curious about shaders. :-) Is it possible to apply shaders in a 2D enviroment to produce some kind of realtime effects?
I'm not too familiar with shaders or how to code them. I think it would be very interesting to apply them in a 2D game somehow. Could this work?
If so, does anyone have any useful links where I can learn more about the basics of shaders?
Thanks! :-)
It is certainly possible and practical. For OpenGL, you'd be writing shaders in either the GLSL or Cg languages. Googling those terms should lead you to a wealth of information.
Sure! There's a certain class of effects which are generally known as "postprocessing". These are effects which are applied to the image after it is rendered. Since they don't care about the geometry, they'll work just fine for 2D. These effects include bloom, motion blur, lens flare, rippling, and so on.
Quote:Original post by Sneftel
These effects include bloom, motion blur, lens flare, rippling, and so on.
All the motion blur effects I've seen recently (ie. non-brute-force ones) have relied on being able to extrude geometry to generate the input to the 2d post processing. Have I missed a method that doesn't use this method?
Quote:Original post by OrangyTang
All the motion blur effects I've seen recently (ie. non-brute-force ones) have relied on being able to extrude geometry to generate the input to the 2d post processing. Have I missed a method that doesn't use this method?
The brute force ones, basically. Which have become much more reasonable with the increased pixel bandwidth of recent cards, and would be perfect for a situation where rasterization is very lightweight--such as, say, a 2D game.
Quote:Original post by Sneftel
The brute force ones, basically. Which have become much more reasonable with the increased pixel bandwidth of recent cards, and would be perfect for a situation where rasterization is very lightweight--such as, say, a 2D game.
Dang, I thought I might have missed something. :( IMHO the brute force methods don't give very good quality unless you got to ridiculous amounts of passes. I'm sure a hybrid approach should be possible, I just havn't figured it out yet. [grin]
OP: If you're using OpenGL, then the orange book is a good introduction to shaders.
Thanks for the help. :-)
I'm having trouble getting started though. I'm programming on Windows, so I don't believe I have access to OpenGL 2.0. :-( How do I get the proper extensions working? It seems that I need the GL_ARB_fragment_shader and GL_ARB_vertex_shader extensions. How do I get them and install them?
As suggested by the article I was directed to, I've downloaded the GLEW library to help.
Thanks again.
I'm having trouble getting started though. I'm programming on Windows, so I don't believe I have access to OpenGL 2.0. :-( How do I get the proper extensions working? It seems that I need the GL_ARB_fragment_shader and GL_ARB_vertex_shader extensions. How do I get them and install them?
As suggested by the article I was directed to, I've downloaded the GLEW library to help.
Thanks again.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement