Friday, July 19, 2013

Houdini Class Notes

Houdini Notes:-

1)Switch on even or odd input.
if(ch("../../box_object2/Number")%2==0,0,1)

2)Echoing in textport
echo `rand(0.5)`
3)repeat operation =q key

4)Some Useful variables
$F,$FF,$PT,$NPT,$PR,$NPR,$CEX,$CEY,$CEZ,$RFSTART,$RFEND

http://www.sidefx.com/docs/houdini9.5/nodes/sop/standardvariables

http://www.sidefx.com/docs/houdini10.0/expressions/_globals

http://www.sidefx.com/docs/houdini10.0/nodes/vop/global

5)Getting centroid of other nodes which are moved from origin
centroid("path",D_X)

bounding box,
bbox("../path",D_XMIN,D_XMAX,.......)
$ZMAX,$ZMIN,D_XSIZE,...
Group selection
5-10:2,5 (between 5 and 10,select two out of 5s groups)
!5-25 (not from 5-25)
*^5-12^40-60 (select all except for 5-12 and 40-60)


6)square of value
pow(2,3)=8
    square root of a value
sqrt(144)=12

7)  Point shop:
     -create attribute eg:test and acess in the point color.
-create attribute in one branch (eg. color) and acess in seperate branch
using point ("add of node", PT num, name of attribute,component number)
eg: point ("../attributeCreate1",$PT," CD",0)

eg ..for float attrib called red (rand($PT))..in a seperate branch
in add color for point shop, red is the name
point (""./attribCreate1",$PT,"red",0)
 point can be used only to acesss point attribute ..not primitive
if number of points dont match ...for example 1st branch is 25 ..in second branch is 100...it ll return the last available point value
.

to reverse the order of color in second branch ...
point ("../attribCreate1",$NPT-($PT+1),red,0)

on every 21st point it should repeat from 0 again ...
point ("../attribCreate1",$NPR-($PR+1),red,0)
..the attribute needs to be of type primitive .and to acess it ..use primitive node ...not point node ..obviously ..

Vertex expression...to fetch vertex data ..
float vertex ( )

for details..type attribute
use detail()

Attribute Transfer
Make sure to transfer only the attribute we need ...not everything ...so that its faster to evaluate network ..

Attribute Promote:
Used to convert an attribute type to another ..for example from point to primitive ..
its also ..helpful to find the average,max,min values ..(we need to switch it to type details..for eg point to details and check it on details view )

Vectors using point...
To find the normal ..based on the two input..
$TX2-$TX,$TY2-$TY,$TZ2-$TZ

Aligning ..the tubes based on the curve ..first find the normal so that one follows another and use following expression..
replace ..x,y,z component ,,with 0,1,2
point ("../curve1",$PT+1,"P',0)-point ("../curve1",$PT,"P",0)

To make copies ..point towards the centre of circle ..
using sort node ..
using polyFrame node
using ..bbx-0.5 method.

copystamping ...
copy works only on points ..

create an attribute pscale..and paint node and override color to pscale ..now u can paint the scale...

on stamp ..create a variable test (rand$PT)*360 and specify that values in transform node after the instance stamp("../copy","test",0)
..to check the values stored (for eg ..test).....create attribute test and point that in the copy as $TEST

exersise...fit the values ..with in the new range
                create regions and have specific copies on specific regions

some more useful expressions...

floor (2.3)=2
ceil(2.3)=3
round(2.3)2
truc(4.6)=4
frac (4.6)=0.6

to find out the total number of pt in next branch ...
npoints ()
nprims ()

opninputs
for eg ..opninputs("../switch1")  ..gives number of input for switch
opdigits to extract digit from string..

 time shift node ..to shift animations ...

comparing the points behind ..the next geometry and Group them together..

$TZ < point("../xform2",1,"P",2)

solver node ..to remember previous output

For loop..
stamp("..","FORVALUE",0)


-naming the seperated group by clip node inside for each (set for each primitive/point)
group`stamp("..","FORVALUE",0)`

-using connectivity and partition nodes together to group the connected primitives.

-another approach is to use assemble node, or in vorenoi fracture create groups(inside its doing the same thing)

-For each using attribute and acess it ..to create a point on each chunk centre

Particle:
If velocity component isnt there ..it takes normal as velocity.
Impulse Birth rate/frame
Cont Birth rate /sec
life expentency is in sec
$NPRIM -total number of primitive

To create curve with points ..use add node (polygons>ByGroup>skip every nth point)

eg :create ramp to control the size of particle.
eg:map particles to the color of the image..and blow it away

Acessing Ramp parameter in point(add scale for particle)

float chramp (string ramp_path, float position, float component_index)

To map the image to points in polygon
add a point node/add color
pic("../cop2net1/default_pic",$BBX,$BBZ,D_CR) (this is slow)

Tex command
tex("Mandril.pic",$BBX,$BBZ,D_CR)
getting image path from cop2 network
tex("op:/obj/grid_object1/heightField/out",$BBX,$BBZ,l)
 eg: to transfer color from points in grid to respective copy on instances
-add a point and acess r,g,b using ..tex("Mandril.pic",$BBX,$BBZ,D_CR)
-create rgb variables ..pointing to above created values
-and stamp in copy node ...
-now we can create particle on the grid points to make image blown away..

eg ...shorter way is to just use Template Point Attributes in copy node ..that will copy each of the attributes ..



acessing the red component for scale of copies..
stamp("../copy1","scale",0.05)


Particles...
vary color based on Life of particle
$LIFE

popevent()
eg:to call event 'collided'
popevent("collided")
returns 1 when there is event or returns 0
popeventtime()....returns time value

-nodes:attracter
            property (to add physical properties like mass,etc)
           render (to select the render type)

-moving along the curve



-----------------------
Dop:-
opinputpath()- Returns the full path of the node connected to a given input

fracture vs fracture glue object:-glue object has internal bond parameter between the piece where as fracture object dont have em

rbd point object -needs to input
 use particle scale parameter in dop network ..to accept the scale variation on point objects
 To add multiple objects as point instances ?
-add mantra/instances in interface edit and switch of full point instancing to see it in render
-create point/add instance
point the different using same expression
 obj/box_box`$PT%4+1
now create rbd point object on it ..it ll add those instances
in point/add instance
/obj/instance_object`$PT%4+1`

-anim + dynamics
node  /rbd state/motion/objpos work in conjuction with active value node
use motion node to blend the velocity between animated and dynamics (set the option as always and activate it)
alternate node for this :- objpos/rbdkeyactive (easiest way)

-merge node in dop has different options of interaction
  another node for relation affecter
-relationships can be viewed in details view..lol ..wtf ..are u kidding me ??
-$OBJID (unique objects in dop)
-haspoint(),hasprim()
-dophassubdata()- to check if collision occurred and specify operation
variables:$DOPNET,$OBJNAME,$OBJID,$ST,$Affectorid,$affectedid

ex:-breaking away certains parts of objects based on glue values ...
    getting dop import as point(simulated) and using that to copy with other geometry.


















Questions:
Use ray shop to find the intersection distance ...(check point intersection option)..use that value to extrude the polygon...
..How to subdivide only the area in contacts ...?
---How to stop from moving scatterd points on every frame ..

How to iterate thru ..a value and increment by specific values on each frames ..

=Create fracture on Rolls...
=Making particles flow on the surface ..
=Particles on surface ..with particles dripping down ..
=Create Rain/snow
=Neuron effects ..with glow ..
=Dis integration effect
=Set up Animated noise map on surface and generate/kill particles based on the texture animation..
=shape changing particles from one to another ..
-







Thursday, July 11, 2013

Layered Shader In Houdini with emission

Here is an example of layered shader with emission...
add mixer for color,opacity,bsdf and add the area of emission as emission amount as well.In pbr set diffuse limit to more than 0.



Tuesday, July 9, 2013

BasicTriplanar Projection in Houdini

                                 Basic Triplanar Projection in Houdini