chenynCV / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

Addition of early version of GPU support for cloth/softbody simulation. #390

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is largely the current softbody simulation algorithm, with some tweaks to 
support GPU batching. The implementation is in DirectCompute and OpenCL.

This changes the current soft body in a number of ways:
1) Adding the beginnings of distinct softbody solver classes so that the soft 
body solvers can be added in the pipeline the way that the rigid body solvers 
are currently. These solvers are parameterised by the device they will solve on.
2) Addition of a collidables list for the soft body through an 
addCollisionObject method on the soft body object itself. This allows us to 
construct a limited set of collision objects to collide against on the 
accelerator, without having to copy across every collision object in the scene.
3) Addition of moveToSolver and moveFromSolver methods on the soft body. This 
means that a btSoftBody can be constructed as it is currently and then moved 
such that its data is contained within a clearly defined solver instance 
sitting on a given accelerator device or to move it back into the current 
softbody data structures.
4) Addition of an "optimize" method on the softbody. This is useful for the GPU 
accelerated code because it allows us to construct necessary batching and tree 
objects on the device, and also copy data across to the device, at a 
predictable point in time rather than doing it on the first simulation step. It 
doesn't hurt to have the function there to support optimisations we might wish 
to perform on CPU-side soft bodies, too, though it would do nothing for now.
5) Providing the ability to set a vertex data output. This means that the 
simulation will directly generate a vertex buffer for rendering by having 
vertex buffer descriptor passed to it. This descriptor might be a CPU-side 
vertex buffer or, more usefully, a DX11 vertex buffer allowing the simulation 
to integrate directly into the graphics pipeline with high efficiency.

Clearly these changes will not provide full support for all the features in the 
current soft body implementation but should push us in the right direction to 
have accelerated cloth and later a solver-centric design to match the rigid 
body pipeline.

Any thoughts? Most of the code is ready, I'm currently adapting it to the above 
design and to match Bullet coding standards after direct discussions with Erwin.

Original issue reported on code.google.com by lee.ho...@amd.com on 9 Jun 2010 at 9:38

GoogleCodeExporter commented 9 years ago
Here's a test example using the current version of the library.

This built against the DX February 2010 SDK. It runs fine on Win7 64 with the 
ATI Radeon driver version 8.732 on a 5870 GPU.

Original comment by lee.ho...@amd.com on 16 Jun 2010 at 9:54

Attachments:

GoogleCodeExporter commented 9 years ago
Nice demo! From looking at the shaders, it looks like this is just doing the 
basic integration and solver. Are you planning on implementing collision 
detection in DirectCompute also?

The demo seems to crash on exit, btw.

Original comment by simesgr...@gmail.com on 21 Jun 2010 at 4:17

GoogleCodeExporter commented 9 years ago
Erwin has been doing some work on GPU-accelerated rigid body. Certainly I plan 
to do basic collision detection for the soft body on the GPU - quite how to 
cleanly integrate that with the rigid body solver is going to take some time to 
evolve. The work I've put into the code structure up to now has really been 
more in terms of structuring and integrating with bullet than adding features.

The crash in the demo is thanks to some issues that were introduced with 
cleaning up the DX structures. Since solved.

Original comment by lee.ho...@amd.com on 21 Jun 2010 at 4:26

GoogleCodeExporter commented 9 years ago

Created a branch for the GPU cloth, and will do some cleanup work in that 
branch.

http://code.google.com/p/bullet/source/detail?r=2105

After that, we can merge parts into the trunk.

Original comment by erwin.coumans on 25 Jun 2010 at 7:11

GoogleCodeExporter commented 9 years ago
An initial version of the DX11ClothDemo and DX11/OpenCL solver has been checked 
into trunk:

http://code.google.com/p/bullet/source/detail?r=2127

Original comment by erwin.coumans on 20 Jul 2010 at 4:23

GoogleCodeExporter commented 9 years ago

Original comment by erwin.coumans on 31 Aug 2010 at 1:29