Tuesday 12 November 2013

UV particles via SOuP

Here is a small SOuP technique for producing a plane of particles with a UV gradient on their RGB.

First you need a plane, then emit some particles from that plane. Make sure that the particles have the rgbPP attribute available as we will need to put an expression on it.

Create a SOuP TextureToArray node
Create a SOuP rgbaToColorAndAlpha node
Create two ramp texture nodes - ramp1 is black to red along U, ramp two is black to green along V

Connect the following:

ramp2.outColor -->  ramp1.colorOffset
ramp1.outColor --> textureToArray1.inColor
polyPlaneShape.worldMesh[0] --> nParticleShape.inputGeometry
polyPlaneShape.worldMesh[0] --> textureToArray1.inGeometry
textureToArray1.outRgbaPP --> rgbToColorAndAlpha1.inRgbaPP 

Also connect the emitting plane's transform node to the particle's transform node as shown in the node graph.



Now set the rgbPP using the creation expression:

rgbPP=rgbaToColorAndAlpha1.outRgbPP

Rewind and step forward one frame so that the particles are emitted. Then set their initial state and disconnect the emitter and the connection between polyPlaneShape.worldMesh[0] --> nParticleShape.inputGeometry





The particles will now be dynamic again.


In Nuke, plug in your rendered particles into the STMap node as shown in the image below


Monday 11 November 2013

Ticker-Tape Tumble

Here is an expression I used to simulate the tumbling motion of ticker-tape.
The ticker tape need to tumble fast around its long axis, in my case the x-axis.


//which direction to tumble?userScalar1PP=rand(1);if(userScalar1PP<0.5){tumble_dirPP=1;}else {tumble_dirPP=-1;}

tumble_speedPP=rand(30,60);

rotStartPP=sphrand(360);rotIncrPP=<<(tumble_speedPP * tumble_dirPP),rand(-2,2),rand(-10,10)>>;

rotationPP=rotStartPP;

sizePP=rand(0.25,0.35);

indexPP=rand(3);

lifespanPP=99;