150 likes | 252 Views
A brief on Pre-computed Particle system. By Zhang Jian. Demo. What’s special?. The demo video: Massive Particles (8000) Real Physics(Multiple bounces). CPU free, very low cost Traditional system Why we can’t have it in traditional system CPU!!!. Pre-computed Particle system.
E N D
A brief on Pre-computed Particle system By Zhang Jian
What’s special? • The demo video: • Massive Particles (8000) • Real Physics(Multiple bounces). • CPU free, very low cost • Traditional system • Why we can’t have it in traditional system • CPU!!!
Pre-computed Particle system • Pre-compute… • Simulating particle behavior • position/velocity/size/color/lighting/rotation….. • Recording • Static Vertex buffer • Playback
The good • 1000…X CPU power (if you have time) • FX Artist • Physics(rigid body collision, fluid…) • Complex lighting • Interactive between sprite and sprite • Thousands of particles and complex effects. • Design without considering CPU performance. • Programmer • Pool system nightmare: one memory block for any number instances • Static Vertex buffer!!! • CPU performance
Simulating • Based on artist tuning. • Based on physics behavior ( collision, fluid, environment lighting…) • Unreal cascade style particle system • Iteration particles on all modules.
The Core:Recording • Position 1s 1.8s 2.0s
Recording: The Curve M0 M1 P0 P1
Cubic Hermite Spline P(t) = C1*t3 + C2*t2 + C3*t+ C4 The values we need in vertex shader: C1 = 2*P0 + M0 +T1 -2*P1; C2 = -3*P0 – 2*M0 -T1 +3*P1; C3 = M0; C4 = P0;
Compression • Don’t waste memory • Position -> Cubic curve • Color/Size/Rot… ->Linear Lerp • Use Short or byte • Local Bounding box can help
Playback • Update the time: like play movie • Avoiding vertex overhead • Looping (endless effect)
Condition • It’s not an alternative solution • Less interactive: There are some effects we can’t do, like rocket trail. • Memory and iteration time. • Constant memory, Streaming • Several seconds should be fine ( from ms to seconds)
Condition • When you want massive particles • When you want high quality effect • When you script an Wow effect • Bullet go through a smoke • When you have pool instance problem
Progress • It’s still in progress…….…. • Done • Framework and basic functions. • Physics collision • Secondary impact • Atlas animation • To-do • More physics effects • Lighting (internal and environment) • More complex modules(eg.spawn along mesh surface) • Editor
Q&A • More video is coming • Welcome ideas.