Sign in to follow this  

Effects in 2D

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

Hi, I'm wondering about how to implement effects such as blur in a 2D game using textured quads. I've no idea where to start really, I think it might be something to do with texture shaders but I'm not sure. Can anyone offer any help? Thanks!

Share this post


Link to post
Share on other sites
Thanks for the article. However I should probably elaborate, I want to be able to perform hardware-accelerated effects such as gaussian blur. Any tips or hints about how to go about coding this in DX9 would be greatly appreciated (that article didn't really give any code).

Share this post


Link to post
Share on other sites
You definitely need to be looking into pixel shaders. Depending on your hardware restrictions you'd probably want to be using ps_2_0 as a minimum - preferably ps_3_0...

I'd recommend you check out the PostProcess SDK sample. It's applied to a 3D scene/model, but the basic principles and implementation would be the same for 2D-based...

hth
Jack

Share this post


Link to post
Share on other sites
You'll have to learn how to setup direct3d and load a texture into a texture object (d3dx is very nice for this!), after you do that then its just a matter of setting the right render-states.
Here is a simple example of setting the min mag filters for a texture:
d3d9device -> SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR)
d3d9device -> D3DSetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR)
This removes the jaggies from the texture when stretched small or large.
The directx SDK will tell you MUCH more you need to know about filters.
You can also try the D3DXSprite interface, but I don't have much experience with this.

Share this post


Link to post
Share on other sites

This topic is 4302 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.

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