Using shader files with 2D games

Started by
4 comments, last by IcedCrow 12 years, 10 months ago
Greetings all

I am new to the shader world and am working on a 2D game. As of now I have not needed any special effects, but now I am getting into some flame effects, lightning, etc... and I have been running tutorials and the like and am implementing a particle system.

The thing is, a lot of the particle systems I'm looking at are all 3D. I know I can get rid of the Z axis by just hardcoding a 0 but is this neccessary?

Also on shader files... all of the examples of shader files I'm seeing are 3D related. Is there much of a point in using shader files in a 2D game?

Thanks in advance.

EDIT: I am developing using C# and XNA in Visual Studio 2010.
For more on my wargaming title check out my dev blog at http://baelsoubliette.wordpress.com/
Advertisement
Shader files are there to allow you to customise the rendering path to include special effects, fancy lighting or whatever else you can dream up.

They certainly aren't limited to 3D. I've seen some 2D platformers that make extensive use of shaders to achieve funky per-pixel lighting effects.

Here's a gamedev topic I found from June 2009 that you may find useful: http://www.gamedev.n...s-for-2d-games/
[size="2"]Currently working on an open world survival RPG - For info check out my Development blog:[size="2"] ByteWrangler
http://xna-uk.net/blogs/randomchaos/archive/2008/03/28/2d-particle-tutorial-iv.aspx

Particle systems Dont have to be 3D. Just think of it as a Point, which emits sprites. The link above is a 2D particle engine and also shows how you use a Shader to help you :)

-Alex
Thanks guys you are awesome! I kind of figured that was the case, I just couldn't seem to find a good launch point as everything I am seeing tutorial wise is 3D using Vector3 objects and matrices for camera view, etc... which has me a bit off on 2D.

I appreciate the responses.
For more on my wargaming title check out my dev blog at http://baelsoubliette.wordpress.com/
When you think about it, 2D is really just 3D but with everything having the same constant Z. Otherwise the very same principles can apply.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


When you think about it, 2D is really just 3D but with everything having the same constant Z. Otherwise the very same principles can apply.


Yeah. I get that, I set all of my Z coordinates to 0. I guess the biggest cause of confusion for me is the need to have view camera matrices in 2D (since you really don't). All of the examples and tutorials involve setting those and I dont have those in my game.
For more on my wargaming title check out my dev blog at http://baelsoubliette.wordpress.com/

This topic is closed to new replies.

Advertisement