Jump to content
  • Advertisement
Sign in to follow this  
donjonson

I have made a rather basic particle engine but....

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

I have seen some whare the paritcles are either blurred out or seem to glow. Can someone point me in the right direction to learn this technique. I think it must have somethign to do with shaders but I done know the first thing about shaders. Is there a resource on the web somewhare aimed at the absolute beginner(in reference to shadders) like me?

Share this post


Link to post
Share on other sites
Advertisement
Additive blending would probably give you that glow effect.

For blur, try rendering to a texture and blending that texture with the existing background. A simple fullscreen motion blur effect.

Share this post


Link to post
Share on other sites
Additive blending basically just means you take what has already been drawn to the screen and add the value of the new color to that. This will give the appearance of glow (although you will want to have nice looking particle textures too) -- the nice thing is that DX will do this for you -- but you will have to look into "Alpha Blending".
As for blurring, you can get a very nice motion blur with the accumulation method. That is, take one frame and alpha blend it with last. The trick is, however, you when I say the "last frame" I mean the blurred result of the last frame. This will mean that you accumulate "old" frames over a period of time. I do think with shaders, which is a good place to do it. The "motion blur" sample that comes with ATI rendermonkey does exactly this, so you might want to look into that.
NOTE: this is a full-screen blur -- it looks really nice, but it will blur everything, so you might want to only enable it when you need to have it. There is also a per-object method, but that's slightly more difficult and uses floating point textures to track the motion of the pixels of an object. MSDN has an example of this.

Oh, and what language are you using?

Share this post


Link to post
Share on other sites
If you use effect files then:
SrcBlend = One;
DestBlend = One;

If you're using MDX then:
m_Device.SetRenderState(RenderStates.SourceBlend, (int)Blend.One);
m_Device.SetRenderState(RenderStates.DestinationBlend, (int)Blend.One);
or
m_Device.RenderState.SourceBlend = Blend.One;
m_Device.RenderState.DestinationBlend = Blend.One;

and C++ is probably something along the lines of
m_Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
m_Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

The C++ example is probably wrong actually, but really you just need to work out how to set the destination and source blend to one.

The blends define how the final colour is computed, source/destination blend is basically saying:
new colour = old colour + particle colour

Hope that helps

-Andrew

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!