110 likes | 227 Views
XSPH Fluid Plugin. F070370 1 50703790 14 潘哲融. Goals And Achievements. Design a fluid plugin fit for both game and research 。 Reach Real-time performance on average hardware 。 Fully utilize Programmable Pipeline and Cuda on modern hardware 。 No cpu participation , no gpu-cpu data transfer 。
E N D
XSPH Fluid Plugin F0703701 5070379014 潘哲融
Goals And Achievements Design a fluid plugin fit for both game and research。 Reach Real-time performance on average hardware。 Fully utilize Programmable Pipeline and Cuda on modern hardware。 No cpu participation,no gpu-cpu data transfer。 Convenient OGL/D3D integration。 No overhead integrating OGL/D3D。 Dynamic fluid/boundary addition/deletion。 Boundary throw mesh file voxelization。 Very fast voxelization schema utilizing GPU rasterization and Cuda。 On time vertex process in most cases。 Both CPU/GPU version fully optimized。 Stable Simulation by implementing various adjustment on simulation algorithm。 Lightening fast collision detection while still memory friendly。
Outline • The System Structure • Collision Detection Algorithm • Hardware Data Structure And Stream • Fluid Simulation • Voxelization Schema
Collision Detection • Limitation And Assumption: • Only limited world size。 • Not continuous collision detection。 • Naïve Implementation: • Use a grid and every particle put in it on one frame • √:fastest in distribution and search。 • ×:memory intensive O(n*m)where n is particle count and m is grid count。
Collision Detection • A Simple Improvement: • Use a linked-list to represent particles。 • √:Much more memory friendly。 • ×:Not Suitable For Simd Architecture Or Cuda Process。 • Our Method: • Memory consumption same as above。 • A little slower than first implementation。
Collision Detection • Our Method: • First tag particle 1~n。 • Calculate grid for every particle and the hash val。 • Perform Key-Value bucket radix-sort which is very fast on cuda。 • Find for each hash the particles in it。 • After simulation frame update,resort particle to 1~n • Only overhead is radix-sort,we have been confirmed that for one billion data,a GTX 480 can handle in less than a second。
Data Structure And Data Stream • Data are mainly particle attribute structure。 • We design the structure by the following principle: • Particle position as the first member so that the continuous memory space can be used as opengl vbo or d3d vertex stream。 • The whole structure and every member is 128bit aligned for cuda and sse。 • Every data memory has its gpu/cpu version and they work separatly unless user reset。
Data Structure And Data Stream • We consider the data stream in gpu case when voxelization is involved。 • On every frame in opengl case: • First voxel data is read from mesh。 • Voxelizer parse the mesh and voxel into gl texture。 • For every texture a PBO is created and mapped to cuda memory。 • Cuda output to another cuda memory as particle cache。 • The above memory cache is mapped to opengl vbo and rendered afterwards。
Fluid Simulation • Basic Algor On: • PDF - Predictive-Corrective Incompressible SPH • Implement Pressure Correction On: • Simulating Free Surface Flows with SPH • Implement Sound Correction On: • Load Balanced Parallel Simulation of Particle-Fluid DEM-SPH ... • Leapfrog Schema For Updation。
Voxelization Schema • Our Method: • Shader Based Skinned Mesh Updation。 • Shader Pass Voxelization Using Slicemap: • Fast Scene Voxelisation. • Cuda pass voxelization filling: • Every Cuda process manage a fragment in slice map。traversal throw every bit,for a bit inside the model,add a boundery particle in particle cache。 • Use Logic-Op to handle the case when start and end of a segment falls into the same grid。 • Watertight required in this schema。