Scripted Melt Attempt

Post Reply
mdonovan
Posts: 10
Joined: Fri Jun 25, 2010 3:56 pm

Scripted Melt Attempt

Post by mdonovan » Mon Jun 28, 2010 7:47 pm

Hey Guys ... so I am jumping on the scripted melt bandwagon ... I am must be having a brain freeze because my script seems to release a bunch of particles in the first few frames and then stops ... so the internal particles of the point cloud are remaining un-melted.
Last edited by mdonovan on Tue Jun 29, 2010 9:28 pm, edited 1 time in total.

Jorge Medina
Posts: 71
Joined: Wed Jun 09, 2010 6:23 pm

Re: Scripted Melt Attempt

Post by Jorge Medina » Mon Jun 28, 2010 10:48 pm

Hi!
Would you mind to write the script in code format? I mean in this way "

Code: Select all

 script 
".
So we could test it better.
And example:

Code: Select all

test_radius = .05
neighbors_below_threshold = False

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

def onSimulationBegin():

	shape_emitter = scene.getEmitter("fill")
	particle = shape_emitter.getFirstParticle()

	while (particle):
		particle.freeze()
		particle = particle.getNextParticle()

	blank = " \n"
	scene.message(str(blank*300))
Cheers!
Jorge Medina Alix
VFX TD / 3DFluids Consultancy

Tech RF Blog: RF Wisdom
Personal works (WIP): Liquid Entropy

mdonovan
Posts: 10
Joined: Fri Jun 25, 2010 3:56 pm

Re: Scripted Melt Attempt

Post by mdonovan » Tue Jun 29, 2010 9:26 pm

Thanks for the reply ... here is where I am at...
http://www.shimmerstudios.com/Public/melt_v1b.mov

There are a few things that I still need to figure out ...

1) i am adjusting the search radius in the getneighbors() call by using the y value of an animated null. At some point there is a critical value at which the number of particles released is too large resulting in a particle "dump". I would be curious is there is a way to avoid this through code rather than tweaking the null animation.

2) some particles get left behind for some reason .. if anyone has thoughts on this ... thanks.

3) It would be cool if I could drop larger particles masses that get disconnect from the main body ... in order to avoid the hanging in mid air look.

Any thoughts are appreciated

Michael

ps here is the code ...

Code: Select all

threshold = 5.5

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

def onSimulationBegin():
	
	shape_emitter = scene.getEmitter("fill")
	particle = shape_emitter.getFirstParticle()
    
	while (particle):
		particle.freeze()
		particle = particle.getNextParticle()

	blank = "    \n"
	scene.message(str(blank*200))

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

def onSimulationStep():
	
	global threshold 
	
	ctrl_null = scene.getObject("Null01")
	shape_emitter = scene.getEmitter("fill")
	melted=scene.getEmitter("melted")

	null_pos = ctrl_null.getParameter("Position")
	test_radius = ( null_pos.getY() * .07)
	
	particles =shape_emitter.getParticles()    
	for particle in particles:
		neighbors = particle.getNeighbors(test_radius)
		no_neighbors =	len(neighbors)	
		
		pid = particle.getId()
		pos=particle.getPosition()
		vel=particle.getVelocity()
		
		#scene.message( str(threshold))
		if (no_neighbors < threshold): 
			melted.addParticle(pos,vel)
			shape_emitter.removeParticle(pid)

mdonovan
Posts: 10
Joined: Fri Jun 25, 2010 3:56 pm

Re: Scripted Melt Attempt

Post by mdonovan » Wed Jun 30, 2010 2:05 pm

Here is my latest version

Melt V2

Still suffering from icebergs being released rather than a nice steady melt. I think this is because a lot of my particles might be the same distance from each other. I have to think about this ... any help would be great.

Also ... I need to figure out how to make particle clumps that get detached from the main body melt immediately. This should also help me solve the stranded particle problem.

Anyway ... its where I am at.

Jorge Medina
Posts: 71
Joined: Wed Jun 09, 2010 6:23 pm

Re: Scripted Melt Attempt

Post by Jorge Medina » Wed Jun 30, 2010 3:15 pm

I hadn´t have time to test it right now, but in a first look seems to be a problem in the line

Code: Select all

test_radius = ( null_pos.getY() * .07)
and the statement

Code: Select all

if (no_neighbors < threshold): 
I think you should use fixed values in the neighbours.
I did something similar using a Filter daemon.
Jorge Medina Alix
VFX TD / 3DFluids Consultancy

Tech RF Blog: RF Wisdom
Personal works (WIP): Liquid Entropy

mdonovan
Posts: 10
Joined: Fri Jun 25, 2010 3:56 pm

Re: Scripted Melt Attempt

Post by mdonovan » Fri Jul 02, 2010 3:59 pm

I am not sure I understand what you are getting at =/. I am slowly decreasing my search radius using an animated null .. the reason I am doing this is so as the particles melt my test for fewer neighbors gets slowly smaller. I found that unless I reduce my radius in the getneighbors call the particles will stop melting at all after a bit.

does that make sense ??

Jorge Medina
Posts: 71
Joined: Wed Jun 09, 2010 6:23 pm

Re: Scripted Melt Attempt

Post by Jorge Medina » Tue Jul 06, 2010 9:06 am

Yes, that make sense. I´ve seen in other posts you are nearly to solve it, aren´t you?
Jorge Medina Alix
VFX TD / 3DFluids Consultancy

Tech RF Blog: RF Wisdom
Personal works (WIP): Liquid Entropy

Post Reply