RAIN DROPS or whatever

Discussion about scripting with Python
User avatar
bolek
Posts: 121
Joined: Thu Nov 27, 2008 10:24 am
Contact:

RAIN DROPS or whatever

Postby bolek » Mon Oct 04, 2010 6:25 am

Hello again :)

For the past week in my free time I was working on script that I saw at http://www.oddmood.com/ site under "lab" link.

Script creates binaryLoader and rotate it along collision normal vector and It happens at each collision :)

VIMEO

PEACE!
____________________________________________
http://vimeo.com/bolekcg
http://bolekcg.blogspot.com/


User avatar
StephaneS
Posts: 85
Joined: Tue Jan 05, 2010 1:09 pm
Contact:

RAIN DROPS or whatever

Postby StephaneS » Mon Oct 04, 2010 11:06 am

Nice ! Bravo

Jdrayton
Posts: 27
Joined: Wed Apr 15, 2009 3:46 am

RAIN DROPS or whatever

Postby Jdrayton » Mon Oct 25, 2010 1:46 am

I saw this a few days ago and I really like the results. I am trying to do a similar effect were the rain drops are hitting the car with windshield wipers. I would love to know little more on the details of how this was done?
www.aftershockfx.com

User avatar
bolek
Posts: 121
Joined: Thu Nov 27, 2008 10:24 am
Contact:

RAIN DROPS or whatever

Postby bolek » Mon Oct 25, 2010 9:19 am

Hi.

Thanks Guys.

I intend to post script with simple scene but I have got so little free time : / .
For now- only script. To tell the truth, it's really easy. Btw in Oddmood lab are nice things :).

Code: Select all

#--------------------------------------------------
# Function: onSimulationBegin
#--------------------------------------------------
def onSimulationBegin():
   pass
#--------------------------------------------------
# Function: onSimulationStep
#--------------------------------------------------
def onSimulationStep():
   #BinaryLoaders import sequence path
   blImpSeq = "SEQUENCE TO IMPORT C:xxxxxxxxx"
   #variables
   emt = scene.getEmitter("rain")
   prt = emt.getParticles()
   pCol = emt.getParticlesColliding()
   curFrm = scene.getCurrentFrame()

   for p in pCol:
      #local variables
      pId = p.getId()
      pPos = p.getPosition()
      pCObj = p.getCollidingObject()
      face = p.getCollidingFace()
      colfc = pCObj.getFace(face)
      nrm = colfc.getNormal()
      nrmOff = pPos + nrm
      aimVec = pPos - nrmOff
      refVec = Vector.new(0.0,-1.0,0.0)
      rotVec = refVec.getEulerAngles(aimVec)

      #glonal binary loaders setup
      bl = scene.addEmitter("Binary Loader")
      bl.setParameter("Xform particles", True)
      bl.setParameter("Resolution", 5.0)
      bl.setParameter("Density", 1000.0)
      bl.setParameter("Int Pressure", 0.5)
      bl.setParameter("Ext Pressure", 1.0)
      bl.setParameter("Viscosity", 3.0)
      bl.setParameter("Surface Tension", 0.0)
      bl.setParameter("BIN sequence", blImpSeq)
      bl.setParameter("Position", pPos)
      bl.setParameter("Rotation", rotVec)
      bl.setParameter("Frame Offset", curFrm)
      bl.setParameter("Release particles", curFrm + 5)

      emt.removeParticle(pId)
#--------------------------------------------------
# Function: onSimulationFrame
#--------------------------------------------------
def onSimulationFrame():
   pass
#--------------------------------------------------
# Function: onSimulationEnd
#--------------------------------------------------
def onSimulationEnd():
   pass
#--------------------------------------------------
# Function: onChangeToFrame
#--------------------------------------------------
def onChangeToFrame():
   pass
____________________________________________
http://vimeo.com/bolekcg
http://bolekcg.blogspot.com/

Jdrayton
Posts: 27
Joined: Wed Apr 15, 2009 3:46 am

RAIN DROPS or whatever

Postby Jdrayton » Mon Oct 25, 2010 7:02 pm

Thanks for the quick reply, and the script. I am going to test it out when I get home and see how it turns out. Even though I use realflow quite a bit I'm still trying to understand basic scripting and actually getting them to work in realflow.
www.aftershockfx.com

sirchillalot
Posts: 18
Joined: Mon Sep 14, 2009 5:06 pm

RAIN DROPS or whatever

Postby sirchillalot » Thu Nov 25, 2010 5:01 pm

thanks for the script realy nice !

sirchillalot
Posts: 18
Joined: Mon Sep 14, 2009 5:06 pm

RAIN DROPS or whatever

Postby sirchillalot » Sat Mar 19, 2011 6:54 pm

can you tell more about the bin_loadery sec. what did you use for the animation, and how can i manipulate the particle from the binarly loader, where is the part on the script, can you explain a little bit more

User avatar
bolek
Posts: 121
Joined: Thu Nov 27, 2008 10:24 am
Contact:

RAIN DROPS or whatever

Postby bolek » Tue Mar 22, 2011 3:14 pm

Hello.

What exactly do you want to know?
-what did you use for the animation?
I used just simple circle emitter (sequence was about 10 frames)
-how can i manipulate the particle from the binarly loader?
You can release them after few frames .

Code: Select all

      #glonal binary loaders setup
        bl = scene.addEmitter("Binary Loader")
        bl.setParameter("Xform particles", True)
        bl.setParameter("Resolution", 5.0)
        bl.setParameter("Density", 1000.0)
        bl.setParameter("Int Pressure", 0.5)
        bl.setParameter("Ext Pressure", 1.0)
        bl.setParameter("Viscosity", 3.0)
        bl.setParameter("Surface Tension", 0.0)
        bl.setParameter("BIN sequence", blImpSeq)
        bl.setParameter("Position", pPos)
        bl.setParameter("Rotation", rotVec)
        bl.setParameter("Frame Offset", curFrm)
        bl.setParameter("Release particles", curFrm + 5)

This part of script is used to setup binaryLoader that is created after collision
You can use for example some random function on some attributes.

Be aware to use the same resolution on binaryLoader and earlier prepared sequence
____________________________________________
http://vimeo.com/bolekcg
http://bolekcg.blogspot.com/

sirchillalot
Posts: 18
Joined: Mon Sep 14, 2009 5:06 pm

RAIN DROPS or whatever

Postby sirchillalot » Thu Mar 24, 2011 1:20 am

ok thanks , but you dont give the bin sequence any forces, the circle emit upwards?

Deejay
Posts: 140
Joined: Fri Jul 30, 2010 9:38 pm

RAIN DROPS or whatever

Postby Deejay » Thu Mar 24, 2011 2:41 pm

nice!, i look forward to the test scene as i cant work out what the script does exactly :huh:
also as a side note my AV flags that site link as dodgy for some reason.

cheers

Deejay.


Return to “Python-Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest