Sign in to follow this  
IcedCrow

Using shader files with 2D games

Recommended Posts

IcedCrow    267
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.

Share this post


Link to post
Share on other sites
Postie    1559
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: [url="http://www.gamedev.net/topic/537928-pixel-shader-effects-for-2d-games/"]http://www.gamedev.n...s-for-2d-games/[/url]

Share this post


Link to post
Share on other sites
Andy474    694
[url="http://xna-uk.net/blogs/randomchaos/archive/2008/03/28/2d-particle-tutorial-iv.aspx"]http://xna-uk.net/blogs/randomchaos/archive/2008/03/28/2d-particle-tutorial-iv.aspx[/url]

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

Share this post


Link to post
Share on other sites
IcedCrow    267
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.

Share this post


Link to post
Share on other sites
IcedCrow    267
[quote name='mhagain' timestamp='1307366074' post='4820062']
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.
[/quote]

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this