"bubble chamber" particle system

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 05 May 2008   #1
"bubble chamber" particle system


I'm a relative beginner to scripting particles, and I've been trying to recreate a kind of particle collision bubble chamber effect. (in an attempt to recreate this:
which generously comes with the processing code too)

By hacking one of the scripts that comes with max (scripted randomwalk) I've got to a certain point but at the moment the particles are kind of hardwired to come out in one direction and only deviate from that direction. I would like them to fire out at random directions and make the spiral shapes in their own plane. I guess I need to translate them with some kind of matrix? I've tried a few things but with no joy.

here's a screen of what happens at the moment

here's the script (sorry about the superfluous lines that probably don't do anything, I'm very much feeling around at the moment). Important bit is in yellow.

on ChannelsUsed pCont do
pCont.useTime = true
pCont.useEventTime = true
pCont.useSpeed = true -- we will modify the speed
pCont.usePosition = true
pCont.useInteger = true
pCont.useFloat = true -- the length of the next force-apply is kept in this channel
pCont.useVector = true -- the force being applied in the next push
pCont.useMatrix = true -- we are going to use just a single float out of this matrix value to keep track of particles that were modified

on Init pCont do

global RND_walk_maxspeed = 300.0
global RND_walk_force = 0.01
global mtx = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]) -- variable to make data exchange with particle matrix channel

on Proceed pCont do
count = pCont.NumParticles() -- the count of the particles in this container
tTPS = 4800.0 / FrameRate -- the current number of ticks per frame
tStart = (pCont.getTimeStart() as float) -- the starting tick# in this time-interval
tEnd = (pCont.getTimeEnd() as float) -- the end tick# of this time-interval
tDif = (tEnd - tStart) / tTPS -- the current iteration length in frames
-- when this value is 1.0, it means we are iterating once per frame, if it's 0.5 we have two iterations per frame, etc.
-- we need this value to be used as a force multiplier, to avoid different results for viewport/rendering
-- as by the default settings, we have 1 iteration per frame for the viewports, but 2 for the rendering.
local force_multiplier = tDif * RND_walk_force / tTPS
local maxspeed = RND_walk_maxspeed / tTPS / frameRate
--local mtx = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])

for i in 1 to count do -- we have to go through all the particles in this container
pCont.particleIndex = i
local pInt = pCont.particleInteger
local pFloat = pCont.particleFloat

local pVec = pCont.particleVector
if (pCont.particleNew) then ( -- if the particle just entered the event, we have to give an initial value to the next-push time variables
pFloat = random -0.01 0.01
pCont.particleFloat = pFloat
mtx[4]= pCont.particleSpeed
pCont.particleMatrix = mtx
pVec = pCont.particleSpeed
pCont.particleVector = pVec

local curr_speed = (length pCont.particleSpeed)
local pETime = (pCont.particleEventTime as float) / tTPS -- current event-time of the particle

mtx = pCont.particleMatrix
if (pFloat > 2000 or pFloat < -2000) then (
pFloat /= pFloat/15
pVec.x = -curr_speed*sin(pFloat)
pVec.y = -curr_speed*cos(pFloat)
else (
pFloat += pFloat/15
pVec.x = curr_speed*sin(pFloat)
pVec.y = curr_speed*cos(pFloat)
pCont.particleFloat = pFloat
pCont.particleVector = pVec
pCont.particlePosition += mtx[4]
pCont.particleSpeed = pCont.particleVector


any help at all is much appreciated

Old 05 May 2008   #2
Nice effect, but I've try to run your script and got this error:
CG Taiwaner
Old 05 May 2008   #3
Yup - Jared Tarbell does some wicked stuff.

I added your script as an operator in an an event below the birth event, and the particles just move downwards and siedways - no spiraling in way shape or form.

Care to explain your setup?
Portfolio | Keyframes and Code
Old 06 June 2008   #4
I'm sorry that wasn't enough, I realised I should've included the max file rather than just the script. here it is - hope it clarifies things a bit...(it's for max 2008).
Attached Files
File Type: zip bubble chamber.zip (25.1 KB, 13 views)
Old 06 June 2008   #5
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:09 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.