mardi 26 janvier 2016

Light particle system


http://www.nukepedia.com/gizmos/particles/partsystem

I did this gizmo for the movie "The End".

We needed small particles in the lighthouse, they had to react with the light of the wall and be fast to render, because it's a 40 second shot.
This is the trick I found.

This gizmo is absolutely inspired by the TX_Fog gizmo by Tomas Lefebvre :
http://www.nukepedia.com/gizmos/3d/tx_fog

Actually, it's no more than a lot of card with a lot a dots.



A card is distorded by a displaced geo which is animated by a noise.
Then this card goes to as much as the user wants of displace geo that all have an offset choose by the user.

The scene get the moved cards back, and the final transform geo moves the whole system.

I gives you the code that is in the reload button and creates all the cards :
nuke.thisNode().begin() #get into the gizmo
scene = nuke.toNode("Scene1")
ctrl = nuke.toNode("ctrl")
displace = nuke.toNode("DisplaceGeo1")

#delete the previous transform geo connected to the scene
for i in range(scene.inputs()): 
    nuke.delete(scene.input(i))
    sc.setInput(i, None)

card = nuke.toNode("Card1")
xpos = card ['xpos'].value()
ypos = card ['ypos'].value()
transformList = []

#create the transform geo nodes
#ctrl['nbCard'] = nombre de card asked by the user

for i in range(int(ctrl['nbCard'].value())) :
    offset = str(i)
    transform = nuke.createNode("TransformGeo", inpanel=False)
    transform['xpos'].setValue(xp + 200*i)
    transform['ypos'].setValue(yp + 150)

    #set the value of the transform geo, with offset
    for a in [0,1,2] :
        for b in ['translate', 'rotate']:
            t[b].setExpression("ctrl." + b + "." + str(a) + "*" + sti, a)
    transform.setInput(0,dp)
    transformList.append(transform)


#reconnect the scene
i =0
for n in transformList:
    sc.setInput(i,n)
    i+=1

in the transform geo, the expression ends up like this :


Once again, I you want to know more about this gizmo, please ask !

Aucun commentaire:

Enregistrer un commentaire