14.11.2014 Views

Procedural modelling in Houdini based on Function Representation

Procedural modelling in Houdini based on Function Representation

Procedural modelling in Houdini based on Function Representation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.4 <str<strong>on</strong>g>Procedural</str<strong>on</strong>g> functi<strong>on</strong>-<str<strong>on</strong>g>based</str<strong>on</strong>g> <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i<br />

FRep_Node class. The traversal of the nodes is c<strong>on</strong>trolled by <strong>on</strong>e s<str<strong>on</strong>g>in</str<strong>on</strong>g>gle, recursive functi<strong>on</strong><br />

called retrieveChildren. Not <strong>on</strong>ly is this functi<strong>on</strong> resp<strong>on</strong>sible for travers<str<strong>on</strong>g>in</str<strong>on</strong>g>g all child nodes,<br />

it also creates the corresp<strong>on</strong>d<str<strong>on</strong>g>in</str<strong>on</strong>g>g FRep entities and nodes as well as fills them with the<br />

parameters provided by the user <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i.<br />

The functi<strong>on</strong> is run with the (<strong>on</strong>ly) child of the FRep_Node as <str<strong>on</strong>g>in</str<strong>on</strong>g>put and returns a full FRep<br />

tree c<strong>on</strong>sist<str<strong>on</strong>g>in</str<strong>on</strong>g>g of FRep nodes and their children. The algorithm (see Algorithm 1) can be<br />

structured <str<strong>on</strong>g>in</str<strong>on</strong>g> five phases:<br />

1. Variables like factory and returnNode are <str<strong>on</strong>g>in</str<strong>on</strong>g>itialised. Also, further flags to <str<strong>on</strong>g>in</str<strong>on</strong>g>dicate<br />

the type of the current node are def<str<strong>on</strong>g>in</str<strong>on</strong>g>ed.<br />

2. A new frepNode <str<strong>on</strong>g>in</str<strong>on</strong>g>stance is created. This is achieved either by cast<str<strong>on</strong>g>in</str<strong>on</strong>g>g the current<br />

node, if it is an actual FRep node, or by manually creat<str<strong>on</strong>g>in</str<strong>on</strong>g>g it <str<strong>on</strong>g>in</str<strong>on</strong>g> case the current node<br />

is <strong>on</strong>e of Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s built-<str<strong>on</strong>g>in</str<strong>on</strong>g> primitives (Sphere, Box, Torus, C<strong>on</strong>e, etc.). Additi<strong>on</strong>ally, a<br />

new FRep entity of the corresp<strong>on</strong>d<str<strong>on</strong>g>in</str<strong>on</strong>g>g type is created. The node hold<str<strong>on</strong>g>in</str<strong>on</strong>g>g that entity is<br />

also marked to be returned.<br />

3. The FRep API offers a transform entity which can be appended to a node to perform<br />

operati<strong>on</strong>s. In case we are us<str<strong>on</strong>g>in</str<strong>on</strong>g>g an FRep node that can be transformed or even<br />

Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s own transform SOP, create the necessary FRep entity. Then, create the corresp<strong>on</strong>d<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

node and add it as child of the orig<str<strong>on</strong>g>in</str<strong>on</strong>g>al node. In this manner, an “<str<strong>on</strong>g>in</str<strong>on</strong>g>visible”<br />

FRep transform is added right after the node it transforms.<br />

4. In the last step, the algorithms determ<str<strong>on</strong>g>in</str<strong>on</strong>g>es what to return. If the current node is an<br />

FRep object (either by be<str<strong>on</strong>g>in</str<strong>on</strong>g>g <strong>on</strong>e of the FRep nodes or <strong>on</strong>e of Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s primitives<br />

represent<str<strong>on</strong>g>in</str<strong>on</strong>g>g <strong>on</strong>e), fill the entity and run this whole procedure for every child of this<br />

node. Alternatively, if this is just an ord<str<strong>on</strong>g>in</str<strong>on</strong>g>ary node that should be ignored by this<br />

system, run retrieveChildren <strong>on</strong> its <str<strong>on</strong>g>in</str<strong>on</strong>g>put (child). If the node is irrelevant to the<br />

FRep system and has no <str<strong>on</strong>g>in</str<strong>on</strong>g>puts, return NULL.<br />

21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!