Jump to content
  • Advertisement

Recommended Posts

Hello!

I recently added a new Diligent Engine tutorial that demonstrates the usage of compute shaders and may be useful on its own. The example app implements a simple GPU particle system that consists of a number of spherical particles moving in random directions and encountering elastic collisions. The simulation and collision detection is performed on the GPU by compute shaders. To accelerate collision detection, the shader subdivides the screen into bins and for every bin creates a list of particles residing in the bin. The number of bins is the same as the number of particles and the bins are distributed evenly on the screen, thus every bin on average contains one particle. The size of the particle does not exceed the bin size, so a particle should only be tested for collision against particles residing in its own or eight neighboring bins, resulting in O(1) algorithmic complexity.

The full description of the implementation of the method is here.

Animation_Large.gif

Share this post


Link to post
Share on other sites
Advertisement

O(1) algorithmic complexity would mean the execution time is invariant to the number of particles - that would be a groundbreaking discovery!

Share this post


Link to post
Share on other sites

Yeah, a good remark. But what DilligentDev meant is that inside of a bin it is constant (O(1)). Not in overall :) Still a very nice implementation and a tutorial for everyone.

Share this post


Link to post
Share on other sites
37 minutes ago, pcmaster said:

Yeah, a good remark. But what DilligentDev meant is that inside of a bin it is constant (O(1)). Not in overall :) Still a very nice implementation and a tutorial for everyone.

It read like a summary statement of the entire algorithm rather than just the last part of the process, but I can see that it could be interpreted both ways.

To @DiligentDev is there any reason you don't use SV_DispatchThreadID and instead choose to calculate it manually?

Share this post


Link to post
Share on other sites

Sorry about the confusion with complexity. Overall complexity is of course O(n) (fixed this in the description). What I meant was of course the complexity of testing one particle.

2 hours ago, Adam Miles said:

To @DiligentDev is there any reason you don't use SV_DispatchThreadID and instead choose to calculate it manually?

No, not really. SV_DispatchThreadID can be totally used instead.

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

  • 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!