Previous Topic (Blending Particle File Sequences Using Krakatoa Particle Flow Operators) Up (Contents) Next Topic (Partitioning Existing File Sequences)

Using the Krakatoa Geometry Test Operator


The Krakatoa Geometry Test operator is a bonus tool inside of Particle Flow. It is not directly related to the Particle Rendering features of Krakatoa, but provides capabilities similar to the Particle Culling of the PRT Loader in Particle Flow and can be used for fast particle selection using arbitrary geometry volumes.

The following example, based on a user question from a public 3D graphics forum, shows how it can be used to solve general Particle problems with or without using the Krakatoa renderer.

Introduction

In this tutorial, we will create a LED display containing an array of spherical particles. We will use an arbitrary geometry volume, for example an extruded Text spline, to select the particles inside the volume and change their color to simulate the running lights effect of typical LED displays.

Particle Flow Setup

First we will need an array of particles placed on a rectangular grid.

  • Create a default Particle Flow emitter (PF Source 01)
  • Open Particle View and replace the Birth Operator with a Birth Script operator
  • Open the Birth Script editor and enter the following code:
on ChannelsUsed pCont do
(
	 pCont.useTime = true
	 pCont.useAge = true
	 pCont.usePosition = true
)

on Init pCont do ( )

on Proceed pCont do 
(
	t2 = pCont.getTimeEnd() as float
	if t2 == 0 do 
	(
		for y = 1 to 20 do
		(
			for x = 1 to 100 do
			(
				pCont.AddParticle()
				pCont.particleIndex = pCont.NumParticles() 
				pCont.particleTime = 0
				pCont.particleAge = 0
				pCont.particlePosition = [x*15, y*15, 0]
			)	
		)
	)
)

on Release pCont do ( )
  • Delete the Position Icon, Speed and Rotation operators.
  • Switch the Shape operator to Sphere.
  • Switch the Display operator to Geometry and move to the Global event PF Source 01.
  • Add a Send Out Test to the event after the Shape operator.
  • Drag and Drop a Krakatoa Geometry Test to the Particle View to create a new Event. Wire from the Send Out to the new Event.
  • Drag and Drop a Age Test to the Particle View to create yet another Event. Set it to 1 frame.
  • Wire from the Krakatoa Geometry Test to the new Event.
  • Wire out from the Age Test back into the Event with the Krakatoa Geometry Test.
  • Add unique Material Static operators to both new Events.
  • Drag and Drop two Standard materials to the two Material Static operators.
  • Set the first Material to Red, the second to Yellow and 50% Self-Illuminated.

Creating the Geometry Volume

  • Create a Text Shape with a size of 300 units
  • Set the Font to "Arial Black"
  • Enter the text "Krakatoa Rocks!" in the Text field.
  • Add an Extrude Modifier with Amount of 100 units.

  • Go to Object Properties and switch to "Display As Box" to see through it and disable the "Renderable" property.
  • Pick the Text object in the Krakatoa Geometry Test.
  • Move the Text object inside the particle grid to select particles.

At this point, any particles inside the text will be sent to the event with the yellow material, causing them to "light up".

  • You can now disable the Particle Flow and keyframe the Text Shape to move across the LED board from right to left over a number of frames.
  • Enable the Particle Flow again and render in any 3ds Max Renderer except Krakatoa.

Exploring the Krakatoa Geometry Test Options

The Krakatoa Geometry Test provides different test modes and a Distance mode to send out particles to the next event when these are inside the volume, outside of the volume, exactly on the surface and optionally at a given distance to the surface, either closer than or farther than a specified threshold.

  • Switching the Test to Outside with Distance mode Off results in the following look:

  • Switching the Test to Outside with a Distance Threshold Greater Than 15 results in the following look:

  • Switching the Test to Inside with a Distance Threshold Less Than 15 results in the following look:

  • Switching the Test to Inside and the Distance mode to Greater Than with a Threshold of 15.0 results in the following look:

Cascading Krakatoa Geometry Tests

We can combine multiple Krakatoa Geometry Tests and cascade the particles through them to split multiple times with different settings.

  • Clone the Krakatoa Geometry Test into the next event.
  • Instance the Age Test into a New Event and wire from the new Krakatoa Geometry Test to the New Event and from the Age Test back to the Second Event.
  • Switch the clone of the Krakatoa Geometry Test to Inside / Greater Than 15, while setting the first Krakatoa Geometry Test to Inside, Less Than 15.
  • Add a new Material Static operator to the New Event and drop a Standard Material with Cyan diffuse color and Self.Illumination of 50.0


Rendering In Krakatoa

Instead of rendering a few spheres in a grid in Scanline or mental ray, let's use the same setup and render millions of particles in Krakatoa.

  • Add a Position Operator to the Initial Event of the flow and set it to Volume.
  • Change the size of the PF Source 01 to Length of 400, Width of 2000 and height of 20.0
  • Change the Viewport % Multiplier to 1.0
  • Replace the Birth Script operator with a Birth operator set to Start and End of 0 and Amount of 1,000,000 (yes, a million particles)
  • Place the Text shape inside the Emitter to include particles inside the complete volume of the Text.

  • Disable the Shape operator since we don't need the Spheres to render in Krakatoa.
  • Assign Krakatoa as the Renderer, switch Final Pass Density to "Additive Density" and render a frame:

  • Switch Final Pass Density to "Volumetric Density".
  • Create an Omni Light above the Particle System and set its Multiplier to 2.0
  • Enable >USE LIGHTING in Krakatoa GUI
  • Change the Opacity of the Red Material to 10.0, of the Cyan Material to 50.0, keep the Yellow material to 100.0
  • Since the >Scale Density using Material Opacity is checked by default, the particles will render with different density based on the Material Opacity.
  • Render the current frame:

  • Increase the height of the Emitter Box to 200.0
  • Increase the Extrude Amount of the Text to 300.0 and move it so that it encloses the whole height of the box volume.
  • Increase the Amount in the Birth Operator to 5,000,000
  • Set the Density Per Particle to 1.0 Exponent 0