*gimletful*

Hello, i am newbie to Houdini, i am watching the applied Houdini tutorial particle 3 as well, and i encountered this code. but i cannot get my head around.

@N = point (1, "P", @ptnum)- @P;

what does this code even mean.

i simply don't understand what is point (1, "P", @ptnum), it doesn't make sense. point is definitely not @P, it looks like a local variable, and what is the stuff in the bracket.

usually P would get followed by (x, y, z) but here 1 is not value 1 but the input.

can somebody point me to the right direction please.

Letters predefined by

**@** are attributes, you can find their values in Geometry Spreadsheet tab. In some cases, you may want to read attributes from another geometry, like here, from geometry connected to second input of attribute wrangle (All inputs have numbers starting from 0).

**@** can't read attributes from inputs other than 0, so you need special VEX function to read the attribute. You want to read Position attribute of current point from second input, so you need:

**Point** function, (there are also vertex(), prim(), detail() for attributes stored on vertices, primitives, details geometry components)

**(****1,** - input number (to read attribute from second input of attribute wrangle node)

**"P",** - attribute's name you want to read (N(normals),P(positon),"v"(velocity),"Cd"(color) etc.)

**@ptnum** - special type of attributes, contains number of current point(there are also @primnum(current primitive), @vtxnum( cur.vertex)

**)**Attribute wrangle will pass over every point and calculate the code

@N = point (1, "P", @ptnum)- @P;

Mathematically the code means:

Attribute wrangle(repeat calculations for every point from first(0) input):

Normal vector (x,y,z) = Second geometry's point position vector (x,y,z) - First geometry's point position vector (x,y,z)

PS:

Theoretically you can replace it with:

vector Normal = point(1, "P", @ptnum) - point(0, "P", @ptnum); //Vector variable Normal equal to vector position of point from first input minus vector position of point from second input)

setpointattrib(0, "N", @ptnum, N); //replace normal attribute with Normal variable.

But there is no need to make it so complicated, @ allows you read and write attributes freely but only for components from first(0) input.

Simple tutorials about geometry components and math operations in 3d space [

www.sidefx.com]

More advanced video tutorials about VEX programming and 3d math [

www.sidefx.com]

Geometry attributes documentation [

www.sidefx.com]

VEX functions reference list [

www.sidefx.com]