Bubble Script

Share your scripts with other members
brandony
Posts: 231
Joined: Sat Oct 21, 2006 7:38 am

Bubble Script

Post by brandony » Wed Sep 03, 2008 11:50 pm

Code: Select all

# Name : Bubble Script
# Description: Create tearing effect off a main bubble.
#
# Author 	: Brandon Young
# Date 		: August 30th 2008
# Version	: 1.0
#--------------------------------------------------


#--------------------------------------------------
# Function: onSimulationStep 
#--------------------------------------------------

def onSimulationStep():
	bubble = scene.getEmitter("Sphere01")
	trails = scene.getEmitter("Circle01")
	particles = bubble.getParticles()
	#vel = Vector.new(0,0,-14)
	for particle in particles:
		neighbors = particle.getNeighbors( .066)
		if (len(neighbors)>0):
			for neighbor in neighbors:
					pos = neighbor.getPosition()
					vel = neighbor.getVelocity()
					trails.addParticle(pos, vel)
					bubble.removeParticle(particle.getId())
					
				

#--------------------------------------------------
# Function: onSimulationFrame 
#--------------------------------------------------

def onSimulationFrame():
	pass

#--------------------------------------------------
# Function: onSimulationBegin
#--------------------------------------------------

def onSimulationBegin():
	pass


#--------------------------------------------------
# Function: onSimulationEnd 
#--------------------------------------------------

def onSimulationEnd():
	pass




#--------------------------------------------------
# Function: onChangeToFrame 
#--------------------------------------------------

def onChangeToFrame():
	pass
little hack just play with the getNeighbors radius.
Brandon Young
www.byvfx.com
FX Artist | TD

tmdag
Posts: 1023
Joined: Thu Jun 28, 2007 2:22 pm
Location: New Zealand
Contact:

Bubble Script

Post by tmdag » Thu Sep 04, 2008 5:35 pm

Big thanks brandony!
"Do not feed the trolls"
Albert 'tmdag' Szostkiewicz
FX Technical Director
Weta Digital

Spongebob
Posts: 124
Joined: Sun Sep 10, 2006 11:30 pm

Bubble Script

Post by Spongebob » Fri Sep 05, 2008 12:06 am

Anyone have a test render to share of the script in action?


brandony
Posts: 231
Joined: Sat Oct 21, 2006 7:38 am

Bubble Script

Post by brandony » Fri Sep 05, 2008 9:14 pm

i will post up a preview for you guys. off to do it now :)
Brandon Young
www.byvfx.com
FX Artist | TD

brandony
Posts: 231
Joined: Sat Oct 21, 2006 7:38 am

Bubble Script

Post by brandony » Fri Sep 05, 2008 10:04 pm

Code: Select all

# Name : Bubble Script
# Description: Create tearing effect off a main bubble.
#
# Author 	: Brandon Young
# Date 		: August 30th 2008
# Version	: 1.0
#--------------------------------------------------
import random

def onSimulationStep():
	bubble = scene.getEmitter("Sphere01")
	trails = scene.getEmitter("Circle01")
	particles = bubble.getParticles()
	vel = Vector.new(0,0,-1.0)
	rnd = random.uniform (3.5,11.0)
	for particle in particles:
		if particle.getVelocity().module() > 3.5:
			neighbors = particle.getNeighbors( .055)
			if particle.getVelocity().module() > 6.0:
				neighbors = particle.getNeighbors( .058)
				if particle.getVelocity().module() > 9.0:
					neighbors = particle.getNeighbors( .06)
			for neighbor in neighbors:
				pos = neighbor.getPosition()
				#vel = neighbor.getVelocity()
				trails.addParticle(pos, vel)
				bubble.removeParticle(particle.getId())
					
#--------------------------------------------------
# Function: onSimulationFrame 
#--------------------------------------------------

def onSimulationFrame():
	pass

#--------------------------------------------------
# Function: onSimulationBegin
#--------------------------------------------------

def onSimulationBegin():
	pass


#--------------------------------------------------
# Function: onSimulationEnd 
#--------------------------------------------------

def onSimulationEnd():
	pass




#--------------------------------------------------
# Function: onChangeToFrame 
#--------------------------------------------------

def onChangeToFrame():
	pass
Changed the script some but you get the idea with preview..
The preview Ls3D linked to was something altogether different :) sorry for any confusion

Preview
Brandon Young
www.byvfx.com
FX Artist | TD

User avatar
Ls3D
Posts: 745
Joined: Tue Sep 12, 2006 11:44 pm
Contact:

Bubble Script

Post by Ls3D » Fri Sep 05, 2008 11:01 pm

OIC,... just a guess cuz I never ran the script or scene - so my bad.

I was probably just hoping it was that trick scene! Shyaa right!..

-Shea

brandony
Posts: 231
Joined: Sat Oct 21, 2006 7:38 am

Bubble Script

Post by brandony » Fri Sep 05, 2008 11:43 pm

i can post that scene as well if you want :)
Brandon Young
www.byvfx.com
FX Artist | TD

User avatar
Ls3D
Posts: 745
Joined: Tue Sep 12, 2006 11:44 pm
Contact:

Bubble Script

Post by Ls3D » Sun Sep 07, 2008 4:01 pm

That would be awesome Brandon - always looking to learn. I'm not much on scripting but would be fun to see if I could evolve the scene into a mud bubble type effect,.. attempting to generate large mud bubbles that hold their shape a while then splat!... add in a ZBrushed mud skipper and a little environment...

-Shea

tmdag
Posts: 1023
Joined: Thu Jun 28, 2007 2:22 pm
Location: New Zealand
Contact:

Bubble Script

Post by tmdag » Wed Sep 10, 2008 12:39 am

brandony wrote: i can post that scene as well if you want :)
that would be nice :)
"Do not feed the trolls"
Albert 'tmdag' Szostkiewicz
FX Technical Director
Weta Digital

Post Reply

Return to “User Scripts”