Page 1 of 1
Scripted Melt Attempt
Posted: Mon Jun 28, 2010 7:47 pm
by mdonovan
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.
Re: Scripted Melt Attempt
Posted: Mon Jun 28, 2010 10:48 pm
by Jorge Medina
Hi!
Would you mind to write the script in code format? I mean in this way "
".
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!
Re: Scripted Melt Attempt
Posted: Tue Jun 29, 2010 9:26 pm
by mdonovan
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)
Re: Scripted Melt Attempt
Posted: Wed Jun 30, 2010 2:05 pm
by mdonovan
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.
Re: Scripted Melt Attempt
Posted: Wed Jun 30, 2010 3:15 pm
by Jorge Medina
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
I think you should use fixed values in the neighbours.
I did something similar using a Filter daemon.
Re: Scripted Melt Attempt
Posted: Fri Jul 02, 2010 3:59 pm
by mdonovan
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 ??
Re: Scripted Melt Attempt
Posted: Tue Jul 06, 2010 9:06 am
by Jorge Medina
Yes, that make sense. I´ve seen in other posts you are nearly to solve it, aren´t you?