1 / 60

A Complete XBox 360 GPU Particle System: Tech & Pipeline

A Complete XBox 360 GPU Particle System: Tech & Pipeline. Sebastian Sylvan & Dr Simon Scarle Rare MGS. A Complete XBox 360 GPU Particle System: Tech & Pipeline. Sebastian Sylvan & Dr Simon Scarle Rare MGS. A Note on Applicability. What is a Particle System?. Tech overview.

jaeger
Download Presentation

A Complete XBox 360 GPU Particle System: Tech & Pipeline

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Complete XBox 360 GPU Particle System: Tech & Pipeline Sebastian Sylvan & Dr Simon Scarle Rare MGS

  2. A Complete XBox 360 GPU Particle System: Tech & Pipeline Sebastian Sylvan & Dr Simon Scarle Rare MGS

  3. A Note on Applicability

  4. What is a Particle System?

  5. Tech overview • Why on the GPU? • Some background • Simulation • Sorting • Rendering

  6. Why on the GPU?

  7. Why on the GPU? No Synchronisation Headaches

  8. Why on the GPU? Performance

  9. Why on the GPU? Code Specialisation

  10. Background : The Xbox 360

  11. Background: The Xbox 360 • VS_OUTPUT vs_main( int ix : INDEX ) • { • int index = (ix+0.5)/a_const.x; • float4 pos; • float2uv; • asm • { • vfetch pos, index, position0; • vfetchuv, index, texcoord0; • }; • /* .... snip .... */ • } Flexible fetching

  12. Background: The Xbox 360 Memory Export Main Memory DIP ME ME

  13. Simulation • voidsimulation_shader( int ix : INDEX ) • { • Particlep = • decompress(fetch_particle(ix)); • Particle newp = • simulate( p, ix, delta_time ); • write_particle( ix, compress(newp) ); • }

  14. Simulation Newtonian motion // a = (sum of forces) / mass newp.vel = p.vel + dt*a; newp.pos = p.pos + p.vel*dt;

  15. Simulation Turbulence : Position-dependent random force Per-system scale/bias Scale/bias position into “turbulence space” a += f(tex3D(turb_tex, g(p.pos)));

  16. Simulation Turbulence:Holy Cache Thrashing, Batman!

  17. Simulation Alleviating Cache Thrashing • Use small texture • Use “thin” format (e.g. 10:11:11) • Sort the particles

  18. Simulation Collision detection (spheres, planes, height fields)

  19. Simulation Emission float4rnd; float x = (ix+rnd_offset)% rnd_size; asm{ tfetch1D rnd, x, rnd_tex, UnnormalizedTextureCoords=true }; Particle newp = create_particle(rnd); rnd = ix > half_N ? rnd.xyzw : rnd.wzyx;

  20. Sorting

  21. Sorting Why sort? • Cache coherency • Non-commutative rendering

  22. Sorting Why sort?

  23. Sorting Need parallel sort for parallel hardware Parallelize standard algorithms? Sorting networks?

  24. Sorting Sorting Networks (Bitonic merge sort, odd-even merge sort)

  25. Sorting Merge the two halves of the array s Odd-Even merge merge(s) { n = size(s) if ( n == 2 ) { return CAS(s(0),s(1)) } else { odds = s(1,3,..,n-1) evens = s(0,2,..,n-2) result = interleave( merge(evens), merge(odds)) for ( i = (1,3,..,n-2) ) { (x,y) = CAS(result(i), result(i+1)) result(i)= x result(i+i)= y } } }

  26. Sorting Odd-Even merge 2 3 8 12 1 6 7 10 2 8 1 7 3 12 6 10 2 1 7 3 6 12 10 8 1 7 2 8 3 10 6 12 1 3 2 6 7 10 8 12

  27. Sorting Odd-Even merge sort

  28. Sorting Odd-Even merge sort Nested algorithm, needs manual flattening for parallelism: Instant Insanity!

  29. Sorting Advice for staying sane • Write “twin” version in GPPL • Debugging: step through PIX and your “twin” simultaneously

  30. Sorting Or, just copy my stuff! Google: “Particle System Simulation and Rendering on the Xbox 360 GPU“

  31. Sorting Sorting for cache coherency

  32. Sorting Sorting performance

  33. Sorting When incremental sorting fails Whenever there the position changes too quickly Prime example: Respawns Solution: Delay simulation/rendering of newly spawned particle for a few frames for sorting

  34. Rendering

  35. Rendering Point sprites

  36. Rendering Geometry Amplification Produce N vertices for each particle ... Index Buffer ... ParticleBuffer

  37. Results

  38. Results

  39. Results

  40. Results

  41. A Complete XBox 360 GPU Particle System: Tech & Pipeline Sebastian Sylvan & Dr Simon Scarle Rare MGS

  42. A Complete XBox 360 GPU Particle System: Tech & Pipeline Sebastian Sylvan & Dr Simon Scarle Rare MGS

  43. almost ^ An Complete XBox 360 GPU Particle System: Tech & Pipeline Sebastian Sylvan & Dr Simon Scarle Rare MGS

  44. Old System • Artist wants a new particle system • Artist talks to Programmer • Programmer implements code/shaders to produce the effect • Artist looks at particles and wants it exactly the same only completely different • Goto 2 : Rinse & Repeat

  45. New System • Rare usually takes an Art Driven approach • Creation of particle effects via art tool • Sebastian's Tech demos implemented in our pipeline with this in mind • highly customisable • efficiency

  46. Overview Artist Input Interim Build Format Runtime Asset

  47. Artist Input • Particle.mb produced by Maya • Main art package at Rare • Use Maya particle options as base • Extend • custom attributes on particle nodes • Random Scaling/orientation • Soft Particles • Timing

  48. Interim Build Format • Parse particle data from artist input • Rparticle • Currently undergoing a de-Maya-ification process • i.e. add another rparticle producer • rparticle objects produced in WorldBuilder/Viewer

  49. Rparticle • Collection of arrays of custom data storage classes • RparticleObject • RparticleEmitter • RparticleField • RparticleRamp • And a couple of R1 data classes • RmodelShader • RmodelNurbsCurve

More Related