Jump to content
  • Advertisement
Sign in to follow this  
Cirno

Initializing particles in a particle system

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

I am working on a particle system with HLSL on XNA Framework. The properties of the particles are stored in several textures. Now I find it hard to initialize a particle(set its property at the beginning or reset its property when it is added to the stage again). It is not easy to get a random number in HLSL and setting the color of a single pixel(to reset the property of a new-added particle) in a texture is inconvenient.So are there any other good solutions?

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

The random number can be obtained by having a 'random' texture and applying an offset to the texture coordinates used to look it up based on time.  So over time the random value supplied to each pixel will change.  You can then determine what size of texture works best for you, and how fast the offset should wrap around.

 

As long as you are capable to get a draw call that can be used to select the appropriate pixels to get executed in the pixel shader, you should be able to use this technique to add or reinitialize particles.

Share this post


Link to post
Share on other sites

 applying an offset to the texture coordinates used to look it up based on time

This is the point. I thought that a 'random' texture can only give one pixel a particular 'random' value, but with the offset we can 'generate' some random values for a pixel.

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!