RSS< Twitter< etc
Krakatoa Collision Test

Krakatoa Collision Test Operator

 Available in Krakatoa v1.5.0 and higher
 WARNING: 
 This Operator is DISABLED in Evaluation Mode and requires a License to be used!

Introduction

  • The Krakatoa Collision Test is a HIGH PERFORMANCE collision operator meant to be used with the particle quantities typical for Krakatoa scenes.
  • In particular, it is over three orders of magnitude faster than the 3ds Max Collision / UDeflector counterpart when using 100K particles and heavy geometry.

User Interface Controls

Select Geometry Node pickbutton

  • Use this button to pick the geometry object to be used for collisions.
 Note that other than the built-in Collision Test, this operator uses the geometry object 
 directly and does not require or support an intermediate Deflector Space Warp.

Remove

  • Press this button to remove the picked Geometry Node.

Animated Geometry

  • Check this option when the geometry is animated and you want to rebuild the acceleration structures once per frame.
    • It is checked by default, but if the geometry is not animated, it will not update on every frame.
    • Uncheck it if the geometry is animated but you don't want to take that into account.

Test For Collisions With

  • This set of radio buttons controls the collision behavior of meshes - single sided vs. double-sided collisions:
  • Front Faces - this option will consider only the facing side of the geometry (the side of the face normal) for collisions. Particles hitting the geometry from the back will pass through.
  • Back Faces - this option will consider only backfaces for collisions, particles hitting from the side of the face normal will pass through.
  • Both -this option will perform collisions on both sides of the mesh regardless of face normal direction.

Options group of controls

Collision Offset (frames)

  • This value controls the number of frames ahead of time to perform the collision.
  • The default is 0 which means the collision will happen at the time the particle actually hits the mesh.
  • Higher values will cause the collision to happen earlier, thus offsetting the collision point away from the mesh.
  • For example, Collision Offset 0 frames:

  • Collision Offset 3 frames:

 Tip:
 Setting the Collision Offset value to about the same as the Integration step can help with avoiding particle "leaking"
 when colliding with very complex and very fast changing geometry, like an object with an animated Noise Modifier.
 For example, if you have fast moving particles hitting a fast animated surface with integration step of 1 frame,
 setting the Collision Offset to 1.0 will eliminate any leaking particles by performing the collision a frame earlier
 when the particle is still a bit away from the surface. If you change the Integration Step to 1/2 frame, you can
 change the Collision Offset to 0.5 and the particles will bounce off perfectly without leaking, but the offset
 to the surface won't be apparent.

Max.Number Of Collisions

  • When the first collision is detected, the velocity vector is modified, but depending on the topology of the mesh it could lead to another collision within the integration interval.
  • This value controls how many consecutive collisions within the integration interval should be handled.
  • Higher numbers will improve precision especially with complex and highly uneven meshes at cost of performance.
  • Only increase this value if you see particles leaking through the mesh.

Random Seed:

  • This value controls the uniqueness of the random operations (Chaos and Variation) below.

Reflect group of controls

Reflect Probability %

  • This value controls the probability for a particle to be reflected as opposed to passing through.
  • Default is 100% which reflects all particles.
    • For example, Probability of 50%:

Magnitude %

  • This value controls the energy preservation vs. energy absorption and is equivalent to the Bounce factor in 3ds Max Deflectors.
  • It does not affect the passing through particles, only the reflected ones.
  • Default is 100% which means that the incoming and outgoing velocity magnitudes will be the same.
  • A value of 50% will absorb half of the velocity of the incoming particles, so it will leave the collision with half the velocity.

Elasticity %

  • This value controls the Elasticity of the collision.
  • Default is 100% which results in a fully elastic collision where the incoming angle and the outgoing angle are the equal.
  • As the value goes towards 0%, the normal portion of the reflected vector will be removed until the particles lose the normal component completely and start sliding perpendicular to the normal (or if they are coincident to the normal, stop completely).

Variation %

  • This value controls the variation of the Magnitude value.
  • For example, with Magnitude of 20 and Variation of 0, the particles are 5 times slower when they are reflected,

  • but with Variation of 100%, they can be up to twice as fast as with Variation of 0.

Chaos %

  • This value introduces a chaotic component to the outgoing velocity.
  • Default is 0 which means no chaos.
  • As the value increases, a random component will be added to the velocity to vary its direction.
  • At 100%, the direction of the reflected particle can be anywhere in the hemisphere centered at the collision point:
  • Chaos of 20%:

  • Chaos of 50%:

  • Chaos of 100%:

Additional Info

  • The Krakatoa Collision Test supports object transformations with motion transfer - animating the position of the geometry will move the particles when they collide.
  • Deforming meshes will NOT move particles when they collide, but sub-frame collisions will be solved correctly based on the Max.Number Of Collisions parameter, thus avoiding leakage and making it unnecessary to increase the Integration Step of Particle Flow.
  • The current version uses the face normals stored in the kd-tree, thus it does not use the smoothed normals based on smoothing groups of the original mesh as the UDeflector. Given that it works well with very high polygon counts, adding TurboSmooth might be a good solution until support for smoothed normals is added.

Benchmarks

Test Setup

  • Here is a simple test of a Standard Particle Flow system set to collide with a Plane primitive using Krakatoa Collision Test and 3ds Max Collision with UDeflector.
  • The PFlow was set to emit a number of particles from frame 0 to frame 100.
  • The number of faces in the collision object was changed while keeping the particle count constant.
  • Then the particle count was increased and the whole process was repeated.
  • The Display operator was disabled to remove the viewport redraw influence (which is significant only around one million particles)

Results

Conclusion

  • As you can see from the above numbers, the 3ds Max Collision Test (and in particular the UDeflector Space Warp) perform a linear search over all faces of the collision geometry without the use of any acceleration structure. As result, increasing the number of faces twice while keeping the particle count constant increases the collision time approximately two times. Similarly, increasing the particle count ten times while keeping the geometry face count constant also increases the collision time about ten times. Thus, increasing both particle count and face count quickly leads to unusable performance.
  • In the case of the Krakatoa Collision Test operator, increasing the face count has little effect when the geometry is static across the animation (which is the case in this particular test). The acceleration structure (a kd-tree) is built just once and then particles are tested quickly against it, thus causing almost no slowdown when the particles are not close enough to the surface to take it into consideration. Similarly, increasing the number of particles does not lead to the same linear slowdown because each new particles does not add that much more collision time to the mix unless when it comes close to the collision object.
  • As result, when testing with only 100 particles, both systems perform faily well with low-res geometry, but as the polygon count goes up, the Krakatoa Collision Test gets up to 40 times faster at 1 million faces.
  • Also, working with one million particles and about 200K faces is pretty much interactive with the Krakatoa Collision Operator - about 1 FPS average frame rate.
  • While the 3ds Max Collision can test 100K particles against 200 faces in 25 seconds, the Krakatoa Collision Test can collide the same amount of particles against 500K faces in about the same time, thus the claim that the Krakatoa Collision Test is around 2000 times faster with heavy meshes and reasonable particle counts. These scene setups are quite typical in visual effects production and not as esoteric as they might appear.
  • When using Deforming Meshes, the Krakatoa Geometry Test will have to do extra work rebuilding the kd-tree on each frame. As result, with very low particle counts (under 1000) and 100K faces, the 3ds Max Collision will be slightly faster, but the Krakatoa Test will be faster again with 10000 particles and more since the majority of time will be spent rebuilding the kd-tree. In fact, the collision time with 1000 and 10000 particles with an animated Noise Modifier on the plane was identical - 153 seconds - with 100K particles needing 157 seconds. For comparison, the 3ds Max Collision needed 107.25, over 1000 and over 10000 seconds for the same tests.