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.

<str<strong>on</strong>g>Procedural</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 />

<str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> Functi<strong>on</strong> Representati<strong>on</strong><br />

Master’s Thesis<br />

Andy Abgottsp<strong>on</strong><br />

August 2011 – Nati<strong>on</strong>al Centre for Computer Animati<strong>on</strong>, Bournemouth University


Abstract<br />

In modern computer graphics, objects are mostly represented by boundary representati<strong>on</strong><br />

models like polyg<strong>on</strong>al meshes. Such models <strong>on</strong>ly store <str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong> about an object’s boundary<br />

and are relatively easy to render and often highly scalable. While this is sufficient for<br />

a variety of applicati<strong>on</strong>s like many types of computer animati<strong>on</strong> and games, other uses require<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong> about volume rather than just surface. Functi<strong>on</strong> representati<strong>on</strong> (FRep)<br />

allows def<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g objects as a set of geometric primitives with certa<str<strong>on</strong>g>in</str<strong>on</strong>g> operati<strong>on</strong>s and relati<strong>on</strong>s.<br />

S<str<strong>on</strong>g>in</str<strong>on</strong>g>ce objects are def<str<strong>on</strong>g>in</str<strong>on</strong>g>ed as mathematic functi<strong>on</strong>s as opposed to a list of po<str<strong>on</strong>g>in</str<strong>on</strong>g>ts, models are<br />

resoluti<strong>on</strong> <str<strong>on</strong>g>in</str<strong>on</strong>g>dependent and can be polyg<strong>on</strong>ised at any desired level of detail.<br />

Build<str<strong>on</strong>g>in</str<strong>on</strong>g>g up<strong>on</strong> the current library developed at the NCCA and its Maya plug<str<strong>on</strong>g>in</str<strong>on</strong>g>, FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g><br />

functi<strong>on</strong>ality has been <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrated <str<strong>on</strong>g>in</str<strong>on</strong>g>to Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i and its node-<str<strong>on</strong>g>based</str<strong>on</strong>g> envir<strong>on</strong>ment. The<br />

library is developed <str<strong>on</strong>g>in</str<strong>on</strong>g> C++ us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK) and comes as a set<br />

of custom nodes.<br />

i


C<strong>on</strong>tents<br />

Abstract<br />

Table of C<strong>on</strong>tents<br />

List of Figures<br />

Acknowledgements<br />

i<br />

ii<br />

v<br />

vi<br />

1 Introducti<strong>on</strong> 1<br />

2 Previous work 2<br />

2.1 Overview of representati<strong>on</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2<br />

2.2 The Functi<strong>on</strong> Representati<strong>on</strong> (FRep) . . . . . . . . . . . . . . . . . . . . . . . 3<br />

2.2.1 Operati<strong>on</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3<br />

2.2.2 Polyg<strong>on</strong>isati<strong>on</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4<br />

3 Technical background 5<br />

3.1 FRep API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

3.1.1 Architectural overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

3.1.2 Entities and nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6<br />

3.1.3 The FRep tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />

3.1.4 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />

3.2 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK) . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

3.2.1 Extend<str<strong>on</strong>g>in</str<strong>on</strong>g>g Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

3.2.2 Operators and attributes . . . . . . . . . . . . . . . . . . . . . . . . . . 10<br />

3.2.3 The SOP Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />

3.2.4 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />

4 Design and implementati<strong>on</strong> 14<br />

4.1 System overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />

4.2 Development envir<strong>on</strong>ment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16<br />

4.2.1 Installati<strong>on</strong> and setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16<br />

4.2.2 Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16<br />

4.2.3 IDE Integrati<strong>on</strong> and debugg<str<strong>on</strong>g>in</str<strong>on</strong>g>g . . . . . . . . . . . . . . . . . . . . . . . 16<br />

ii


4.3 Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the FRep API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />

4.3.1 GCC compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />

4.3.2 Custom <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />

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 . . . . . . . . . . . . . . . . . 19<br />

4.4.1 The <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />

4.4.2 Tree traversal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20<br />

4.4.3 Polyg<strong>on</strong>isati<strong>on</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

4.4.4 FRep Operati<strong>on</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

5 Results and analysis 29<br />

5.1 Modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />

5.2 Animati<strong>on</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />

5.3 Morph<str<strong>on</strong>g>in</str<strong>on</strong>g>g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31<br />

5.4 Limitati<strong>on</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />

6 C<strong>on</strong>clusi<strong>on</strong> 33<br />

6.1 Applicati<strong>on</strong>s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />

6.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />

References 35<br />

iii


List of Figures<br />

2.1 Example of a boundary representati<strong>on</strong>: triangle mesh model . . . . . . . . . . 2<br />

2.2 Set-theoretic operati<strong>on</strong>s <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> R-functi<strong>on</strong>s: (a) Uni<strong>on</strong> and (b) Intersecti<strong>on</strong><br />

(Kravtsov 2011) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3<br />

2.3 Shape and positi<strong>on</strong> of 3D blend is c<strong>on</strong>trolled by the bound<str<strong>on</strong>g>in</str<strong>on</strong>g>g ellipsoid. (Pasko<br />

et al. 2005) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4<br />

2.4 The leftmost and rightmost images dem<strong>on</strong>strate the <str<strong>on</strong>g>in</str<strong>on</strong>g>itial and f<str<strong>on</strong>g>in</str<strong>on</strong>g>al triangle<br />

surfaces, before and after optimisati<strong>on</strong>. The two middle images show <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate<br />

stages. (Ohtake et al. 2002) . . . . . . . . . . . . . . . . . . . . . . . . . 4<br />

3.1 Full structure of the <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> envir<strong>on</strong>ment and basic tools for FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g><br />

(Kravtsov 2011) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6<br />

3.2 The FRep entity UML-diagram (Kravtsov 2011) . . . . . . . . . . . . . . . . . 7<br />

3.3 FRep tree <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />

3.4 A Model-View-C<strong>on</strong>troller diagram: The general design pattern (Kravtsov 2011) 9<br />

3.5 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s node <str<strong>on</strong>g>based</str<strong>on</strong>g> system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10<br />

3.6 Basic class diagram for custom Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i nodes (adapted from SideFX (2011a)) 11<br />

3.7 Provid<str<strong>on</strong>g>in</str<strong>on</strong>g>g guide geometry (blue lattice) <str<strong>on</strong>g>in</str<strong>on</strong>g> a custom node . . . . . . . . . . . . 12<br />

3.8 Geometry Structure <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i (SideFX 2011b) . . . . . . . . . . . . . . . . . 13<br />

4.1 Class diagram of custom Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i nodes . . . . . . . . . . . . . . . . . . . . . . 15<br />

4.2 Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g custom build steps <str<strong>on</strong>g>in</str<strong>on</strong>g> QtCreator to compile and bundle the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i<br />

library from with<str<strong>on</strong>g>in</str<strong>on</strong>g> the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />

4.3 Debugg<str<strong>on</strong>g>in</str<strong>on</strong>g>g us<str<strong>on</strong>g>in</str<strong>on</strong>g>g QtCreator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />

4.4 The <str<strong>on</strong>g>in</str<strong>on</strong>g>teracti<strong>on</strong> with the FRep API (Kravtsov 2011) . . . . . . . . . . . . . . 19<br />

4.5 Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g built-<str<strong>on</strong>g>in</str<strong>on</strong>g> primitive types as guide geometry . . . . . . . . . . . . . . . . . 20<br />

4.6 Transform node for scale, translati<strong>on</strong> and rotati<strong>on</strong> . . . . . . . . . . . . . . . . 20<br />

4.7 Polyg<strong>on</strong>isati<strong>on</strong> us<str<strong>on</strong>g>in</str<strong>on</strong>g>g analytic normals and a subdivisi<strong>on</strong> level of 3 . . . . . . . 23<br />

4.8 Example of a CSG node used to perform a subtract operati<strong>on</strong> . . . . . . . . . 24<br />

4.9 Example of the blend node <str<strong>on</strong>g>in</str<strong>on</strong>g> use with different blend values: 1 10 1, 1 50 50,<br />

1 1 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />

4.10 Bounded blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g us<str<strong>on</strong>g>in</str<strong>on</strong>g>g three spheres . . . . . . . . . . . . . . . . . . . . . . . 25<br />

4.11 Example of the taper node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />

4.12 Examples of bend, twist and deform po<str<strong>on</strong>g>in</str<strong>on</strong>g>t operati<strong>on</strong>s . . . . . . . . . . . . . . 26<br />

iv


4.13 Sphere sweep node us<str<strong>on</strong>g>in</str<strong>on</strong>g>g a standard Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i curve as <str<strong>on</strong>g>in</str<strong>on</strong>g>put . . . . . . . . . . 26<br />

4.14 Offset node us<str<strong>on</strong>g>in</str<strong>on</strong>g>g different offset values: -0.5 (left), 0 (middle), 0.5 (right) . . . 27<br />

4.15 Metamorphosis from a c<strong>on</strong>e to a torus . . . . . . . . . . . . . . . . . . . . . . . 27<br />

4.16 Instancer node output <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> torus . . . . . . . . . . . . . . . . . . . . . . . 28<br />

4.17 More complex example of the <str<strong>on</strong>g>in</str<strong>on</strong>g>stancer node. . . . . . . . . . . . . . . . . . . 28<br />

5.1 Screw model with its corresp<strong>on</strong>d<str<strong>on</strong>g>in</str<strong>on</strong>g>g node network and optimisati<strong>on</strong> for sharp<br />

features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />

5.2 Pengu<str<strong>on</strong>g>in</str<strong>on</strong>g> FRep model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />

5.3 Truck show<str<strong>on</strong>g>in</str<strong>on</strong>g>g keyframe animati<strong>on</strong> . . . . . . . . . . . . . . . . . . . . . . . . 30<br />

5.4 Animati<strong>on</strong> graph of the truck animati<strong>on</strong> . . . . . . . . . . . . . . . . . . . . . 31<br />

5.5 Metamorphosis of simple 3D character to a screw . . . . . . . . . . . . . . . . 31<br />

6.1 A set of applicati<strong>on</strong> and platform specific translators (Kravtsov 2011) . . . . . 34<br />

v


Acknowledgements<br />

I would like to express my gratitude towards the course leader J<strong>on</strong> Macey for his support<br />

and <str<strong>on</strong>g>in</str<strong>on</strong>g>puts throughout the academic year and this project.<br />

I thank Denis Kravtsov for provid<str<strong>on</strong>g>in</str<strong>on</strong>g>g me with the idea and base for this project, as well as<br />

for his patient and k<str<strong>on</strong>g>in</str<strong>on</strong>g>d support.<br />

Also, thanks to Turlif Vilbrandt from Uformia AS and Prof.<br />

valuable feedback and <str<strong>on</strong>g>in</str<strong>on</strong>g>terest <str<strong>on</strong>g>in</str<strong>on</strong>g> the project.<br />

Alexander Pasko for their<br />

vi


Chapter 1<br />

Introducti<strong>on</strong><br />

In the visual effects and games <str<strong>on</strong>g>in</str<strong>on</strong>g>dustry, the predom<str<strong>on</strong>g>in</str<strong>on</strong>g>ant <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> techniques are us<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

polyg<strong>on</strong>al meshes. While these offer various benefits and are well <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrated <str<strong>on</strong>g>in</str<strong>on</strong>g>to current<br />

pipel<str<strong>on</strong>g>in</str<strong>on</strong>g>es, they <strong>on</strong>ly represent surfaces and have a given amount of detail. As a c<strong>on</strong>sequence,<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong> about an object <str<strong>on</strong>g>in</str<strong>on</strong>g>ternal structure cannot be stored and <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> of heterogeneous<br />

real-world objects is difficult. In other fields like CAD and 3D pr<str<strong>on</strong>g>in</str<strong>on</strong>g>t<str<strong>on</strong>g>in</str<strong>on</strong>g>g, the tradeoffs<br />

cannot be circumvented without effort and alternative representati<strong>on</strong>s are needed.<br />

One alternative is to use “Functi<strong>on</strong> representati<strong>on</strong> <str<strong>on</strong>g>in</str<strong>on</strong>g> geometric <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g>” as suggested by<br />

Pasko et al. (1995). The so-called FRep allows the def<str<strong>on</strong>g>in</str<strong>on</strong>g>iti<strong>on</strong> of objects, operati<strong>on</strong>s and<br />

relati<strong>on</strong>s as a mathematical functi<strong>on</strong> as opposed to po<str<strong>on</strong>g>in</str<strong>on</strong>g>t data and meshes. A lot of research<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g> this field has been d<strong>on</strong>e at the NCCA. The FRep API (Kravtsov 2011) was taken as base<br />

for this project.<br />

This thesis documents the design and implementati<strong>on</strong> of a custom plug<str<strong>on</strong>g>in</str<strong>on</strong>g> for Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i that<br />

was written <str<strong>on</strong>g>in</str<strong>on</strong>g> C++ us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK). Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i is a high-end 3D<br />

animati<strong>on</strong> package developed by Side Effects Software and used heavily <str<strong>on</strong>g>in</str<strong>on</strong>g> the VFX <str<strong>on</strong>g>in</str<strong>on</strong>g>dustry.<br />

Due to its node-<str<strong>on</strong>g>based</str<strong>on</strong>g> architecture, it is very suitable for procedural <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g>. Moreover,<br />

many of the c<strong>on</strong>cepts <str<strong>on</strong>g>in</str<strong>on</strong>g> the FRep API, like for example the tree and node structure, translate<br />

and <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrate very well <str<strong>on</strong>g>in</str<strong>on</strong>g>to the software.<br />

Chapter 2 gives an overview of the topic and related research. In Chapter 3, the relevant<br />

c<strong>on</strong>cepts of the APIs used, namely the exist<str<strong>on</strong>g>in</str<strong>on</strong>g>g FRep API and the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit,<br />

are <str<strong>on</strong>g>in</str<strong>on</strong>g>troduced. Chapter 4 documents the c<strong>on</strong>ceptual design of the plug<str<strong>on</strong>g>in</str<strong>on</strong>g> and further details<br />

particular to the development envir<strong>on</strong>ment and workflow. Furthermore, the <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> process<br />

and key algorithms are expla<str<strong>on</strong>g>in</str<strong>on</strong>g>ed. Chapter 5 presents results and gives an idea over potential<br />

applicati<strong>on</strong>s. The results are evaluated <str<strong>on</strong>g>in</str<strong>on</strong>g> Chapter 6 where future work and improvements<br />

are discussed.<br />

1


Chapter 2<br />

Previous work<br />

There are different ways of represent<str<strong>on</strong>g>in</str<strong>on</strong>g>g objects digitally. This chapter gives a brief overview<br />

of various representati<strong>on</strong>s and discusses the fundamental research relevant for this project.<br />

2.1 Overview of representati<strong>on</strong>s<br />

The most dom<str<strong>on</strong>g>in</str<strong>on</strong>g>ant way of represent<str<strong>on</strong>g>in</str<strong>on</strong>g>g objects <str<strong>on</strong>g>in</str<strong>on</strong>g> modern computer graphics are boundary<br />

representati<strong>on</strong> models, also known as BRep. Such models do not store any <str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong> about<br />

objects’ <str<strong>on</strong>g>in</str<strong>on</strong>g>ner properties. Figure 2.1 shows a triangle mesh, a popular type of a boundary<br />

representati<strong>on</strong> model. In film and games, most efforts are spent <strong>on</strong> creat<str<strong>on</strong>g>in</str<strong>on</strong>g>g visually pleas<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

results rather than accurate models of reality. Therefore, boundary representati<strong>on</strong> are often<br />

sufficient and even preferred because they offer a rich set of operati<strong>on</strong>s and are comparatively<br />

easy to render.<br />

Figure 2.1: Example of a boundary representati<strong>on</strong>: triangle mesh model<br />

2


2.2 The Functi<strong>on</strong> Representati<strong>on</strong> (FRep)<br />

For other purposes, volumetric representati<strong>on</strong>s allow us to store the object’s <str<strong>on</strong>g>in</str<strong>on</strong>g>ternal structure<br />

rather than <strong>on</strong>ly a limited surface <str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong>. This is especially important when <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g><br />

real-life heterogeneous objects. There are a number of volumetric representati<strong>on</strong>s <str<strong>on</strong>g>in</str<strong>on</strong>g>clud<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

voxel representati<strong>on</strong>, implicit surfaces and FReps.<br />

2.2 The Functi<strong>on</strong> Representati<strong>on</strong> (FRep)<br />

The Functi<strong>on</strong> Representati<strong>on</strong> (FRep) comb<str<strong>on</strong>g>in</str<strong>on</strong>g>es different models such as algebraic surfaces,<br />

skelet<strong>on</strong> <str<strong>on</strong>g>based</str<strong>on</strong>g> “implicit” surfaces, CSG (C<strong>on</strong>structive Solid Geometry), sweeps, volumetric<br />

objects, parametric models and procedural models. The representati<strong>on</strong> def<str<strong>on</strong>g>in</str<strong>on</strong>g>es a geometric<br />

object by a s<str<strong>on</strong>g>in</str<strong>on</strong>g>gle real c<strong>on</strong>t<str<strong>on</strong>g>in</str<strong>on</strong>g>uous functi<strong>on</strong> of po<str<strong>on</strong>g>in</str<strong>on</strong>g>t coord<str<strong>on</strong>g>in</str<strong>on</strong>g>ates as F (X) ≥ 0 (Pasko 2011).<br />

This also lets us represent models <str<strong>on</strong>g>in</str<strong>on</strong>g>dependent from resoluti<strong>on</strong>.<br />

A c<strong>on</strong>structive tree def<str<strong>on</strong>g>in</str<strong>on</strong>g>es functi<strong>on</strong>s and provides a visual overview of operati<strong>on</strong>s and parameters.<br />

Leaf nodes are primitives like a box, sphere, torus, etc. N<strong>on</strong>-leaf nodes c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g><br />

operati<strong>on</strong>s and relati<strong>on</strong>s. This functi<strong>on</strong>ality was implemented and made accessible via an<br />

FRep API.<br />

2.2.1 Operati<strong>on</strong>s<br />

Besides C<strong>on</strong>structive Solid Geometry (CSG) <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> R-functi<strong>on</strong> (see Figure 2.2), there is<br />

also a number of blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g operators offered by the FRep API.<br />

Figure 2.2: Set-theoretic operati<strong>on</strong>s <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> R-functi<strong>on</strong>s: (a) Uni<strong>on</strong> and (b) Intersecti<strong>on</strong><br />

(Kravtsov 2011)<br />

3


2.2 The Functi<strong>on</strong> Representati<strong>on</strong> (FRep)<br />

In additi<strong>on</strong> to regular blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g, bounded blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g allows for the generati<strong>on</strong> of smooth transiti<strong>on</strong>s<br />

between two or more surfaces. It also gives local c<strong>on</strong>trol over how and where the<br />

transiti<strong>on</strong>s happen us<str<strong>on</strong>g>in</str<strong>on</strong>g>g a bound<str<strong>on</strong>g>in</str<strong>on</strong>g>g solid (see Figure 2.3).<br />

Figure 2.3: Shape and positi<strong>on</strong> of 3D blend is c<strong>on</strong>trolled by the bound<str<strong>on</strong>g>in</str<strong>on</strong>g>g ellipsoid. (Pasko<br />

et al. 2005)<br />

2.2.2 Polyg<strong>on</strong>isati<strong>on</strong><br />

The FRep API comes with its own polyg<strong>on</strong>iser. The basic algorithm is <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> march<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

cubes which can lack accuracy when polyg<strong>on</strong>is<str<strong>on</strong>g>in</str<strong>on</strong>g>g implicit surfaces with sharp features.<br />

However, the API also implements another approach called “Dynamic Mesh Optimizati<strong>on</strong><br />

for Polyg<strong>on</strong>ized Implicit Surfaces with Sharp Features” as <str<strong>on</strong>g>in</str<strong>on</strong>g>troduced by Ohtake et al. (2002)<br />

(see Figure 2.4).<br />

Figure 2.4: The leftmost and rightmost images dem<strong>on</strong>strate the <str<strong>on</strong>g>in</str<strong>on</strong>g>itial and f<str<strong>on</strong>g>in</str<strong>on</strong>g>al triangle<br />

surfaces, before and after optimisati<strong>on</strong>. The two middle images show <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate stages.<br />

(Ohtake et al. 2002)<br />

4


Chapter 3<br />

Technical background<br />

Work<str<strong>on</strong>g>in</str<strong>on</strong>g>g with 3rd party code and frameworks can be challeng<str<strong>on</strong>g>in</str<strong>on</strong>g>g. Al<strong>on</strong>g with the technical<br />

details, a fair understand<str<strong>on</strong>g>in</str<strong>on</strong>g>g of the overall envir<strong>on</strong>ment is required to make the right design<br />

decisi<strong>on</strong>s later. This chapter gives an overview of the FRep API and the key HDK c<strong>on</strong>cepts<br />

relevant to this project.<br />

3.1 FRep API<br />

This project is us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the FRep API developed by (Kravtsov 2011). He describes the communicati<strong>on</strong><br />

between API and applicati<strong>on</strong>s as follows:<br />

“The ma<str<strong>on</strong>g>in</str<strong>on</strong>g> and most comm<strong>on</strong> way of communicati<strong>on</strong> between the FRep API<br />

and higher-level applicati<strong>on</strong>s us<str<strong>on</strong>g>in</str<strong>on</strong>g>g FReps is through the parameters of the FRep<br />

entities and through the creati<strong>on</strong> of complex FRep trees c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g the aforementi<strong>on</strong>ed<br />

entities.” (Kravtsov 2011)<br />

3.1.1 Architectural overview<br />

The FRep API itself makes use of a number of libraries and underly<str<strong>on</strong>g>in</str<strong>on</strong>g>g APIs. Figure 3.1<br />

shows the API <str<strong>on</strong>g>in</str<strong>on</strong>g> the c<strong>on</strong>text and <str<strong>on</strong>g>in</str<strong>on</strong>g> relati<strong>on</strong> to the <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer. The plug<str<strong>on</strong>g>in</str<strong>on</strong>g> developed<br />

acts as <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer between the external applicati<strong>on</strong> (Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i) and the API.<br />

5


3.1 FRep API<br />

Figure 3.1: Full structure of the <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> envir<strong>on</strong>ment and basic tools for FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g><br />

(Kravtsov 2011)<br />

3.1.2 Entities and nodes<br />

FReps are represented us<str<strong>on</strong>g>in</str<strong>on</strong>g>g FRep entities <str<strong>on</strong>g>in</str<strong>on</strong>g>side the API. Some classes are templated (these<br />

are named with the suffix _T) and can therefore operate <strong>on</strong> data of multiple types. Figure 3.2<br />

gives an overview of the classes def<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g the FRep entities and nodes which are then used to<br />

build FRep trees.<br />

Some nodes and their children are extensively used <str<strong>on</strong>g>in</str<strong>on</strong>g> the plug<str<strong>on</strong>g>in</str<strong>on</strong>g>:<br />

• ENTITY_T is represent<str<strong>on</strong>g>in</str<strong>on</strong>g>g an FRep entity with its parameters (see PARAMS_TYPE and<br />

PARAMETER_TYPE), bounds, etc. It is also the base class for primitives like BOX_ENTITY_T<br />

and SPHERE_ENTITY_T.<br />

6


3.1 FRep API<br />

• ID_TYPE is an attribute of the entity class and used to identify an entity’s type such as<br />

FREP_SPHERE_ID or FREP_BOX_ID.<br />

• ENTITY_NODE_T can be created from an ENTITY_T and c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g> additi<strong>on</strong>al <str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong><br />

like parent and child nodes. This is used for FRep tree and traversal.<br />

• ENTITY_FACTORY_T is a factory class generat<str<strong>on</strong>g>in</str<strong>on</strong>g>g entities.<br />

Figure 3.2: The FRep entity UML-diagram (Kravtsov 2011)<br />

3.1.3 The FRep tree<br />

The next step is to create the nodes and entities shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Secti<strong>on</strong> 3.1.2 and establish relati<strong>on</strong>ships<br />

between them. Nodes can represent both primitives and operati<strong>on</strong>s and comb<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

them to form an FRep tree can help us build<str<strong>on</strong>g>in</str<strong>on</strong>g>g complex models.<br />

Figure 3.3 shows an example of such a tree as represented with<str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i. To expla<str<strong>on</strong>g>in</str<strong>on</strong>g> the<br />

details of the tree evaluati<strong>on</strong> with<str<strong>on</strong>g>in</str<strong>on</strong>g> the API would go bey<strong>on</strong>d the scope of this project. It<br />

is however important to understand that FRep nodes relate to <strong>on</strong>e another and that child<br />

nodes can be added to any node. The <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer has its own tree traversal algorithm<br />

to gather the required data as expla<str<strong>on</strong>g>in</str<strong>on</strong>g>ed <str<strong>on</strong>g>in</str<strong>on</strong>g> Secti<strong>on</strong> 4.4.2.<br />

7


3.1 FRep API<br />

Figure 3.3: FRep tree <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 />

3.1.4 Usage<br />

There are a number of ways to <str<strong>on</strong>g>in</str<strong>on</strong>g>teract with FRep models. Models can be created and<br />

manipulated directly us<str<strong>on</strong>g>in</str<strong>on</strong>g>g a variety of programm<str<strong>on</strong>g>in</str<strong>on</strong>g>g languages. This could be a high-level<br />

programm<str<strong>on</strong>g>in</str<strong>on</strong>g>g language like C++, a script<str<strong>on</strong>g>in</str<strong>on</strong>g>g language like Pyth<strong>on</strong> or a simple but specialized<br />

high-level programm<str<strong>on</strong>g>in</str<strong>on</strong>g>g language like “HyperFun” (Adzhiev et al. 1999) or “HyperJazz”<br />

(Adzhiev et al. 1996). Each of these methods have different effects <strong>on</strong> performance and code<br />

ma<str<strong>on</strong>g>in</str<strong>on</strong>g>ta<str<strong>on</strong>g>in</str<strong>on</strong>g>ability.<br />

Another way is to allow the user to manipulate FRep models via a graphical user <str<strong>on</strong>g>in</str<strong>on</strong>g>terface.<br />

The “Model-View-C<strong>on</strong>troller” design pattern (Gamma et al. 1995) describes this sort of<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>teracti<strong>on</strong> as shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Figure 3.4. In this scenario, the c<strong>on</strong>troller of our <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer<br />

would be resp<strong>on</strong>sible for pass<str<strong>on</strong>g>in</str<strong>on</strong>g>g <strong>on</strong> the <str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong> of the view to the FRep API and therefore<br />

sync<str<strong>on</strong>g>in</str<strong>on</strong>g>g the user <str<strong>on</strong>g>in</str<strong>on</strong>g>terface with the <str<strong>on</strong>g>in</str<strong>on</strong>g>ternal models. Further details <strong>on</strong> the implementati<strong>on</strong><br />

of the <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer are discussed <str<strong>on</strong>g>in</str<strong>on</strong>g> Secti<strong>on</strong> 4.3.2.<br />

8


3.2 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK)<br />

Figure 3.4: A Model-View-C<strong>on</strong>troller diagram: The general design pattern (Kravtsov 2011)<br />

3.2 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK)<br />

3.2.1 Extend<str<strong>on</strong>g>in</str<strong>on</strong>g>g Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i<br />

There are several ways to extend Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s capabilities. For <strong>on</strong>e, the node-<str<strong>on</strong>g>based</str<strong>on</strong>g> architecture<br />

allows bundl<str<strong>on</strong>g>in</str<strong>on</strong>g>g any sort of nodes <str<strong>on</strong>g>in</str<strong>on</strong>g>to so-called Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Digital Assets (HDA) that can be<br />

equipped with attributes and c<strong>on</strong>trols. They are also capable of us<str<strong>on</strong>g>in</str<strong>on</strong>g>g <str<strong>on</strong>g>in</str<strong>on</strong>g>puts and outputt<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

data.<br />

VEX is an <str<strong>on</strong>g>in</str<strong>on</strong>g>terpreted language with<str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i. It is fairly easy to use and offers a set of<br />

functi<strong>on</strong>s to allow modificati<strong>on</strong> of po<str<strong>on</strong>g>in</str<strong>on</strong>g>t attributes. While this makes it very scalable and<br />

optimised for multi-thread<str<strong>on</strong>g>in</str<strong>on</strong>g>g, VEX is unable to create or destroy geometry.<br />

In order to create custom expressi<strong>on</strong>s, commands or operators like SOPs, COPs, DOPs, etc.,<br />

the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit is required. The HDK is a set of C++ libraries used by the<br />

creators of Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i themselves to create nodes and <str<strong>on</strong>g>in</str<strong>on</strong>g>terfaces. It is the SDK Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i itself is<br />

built with.<br />

Alternatively, the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Object Model (HOM) can be used to create SOPs us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the Pyth<strong>on</strong><br />

script<str<strong>on</strong>g>in</str<strong>on</strong>g>g language. Compared to the HDK, it offers <str<strong>on</strong>g>in</str<strong>on</strong>g>creased flexibility, but can also be slower<br />

due to the overhead <str<strong>on</strong>g>in</str<strong>on</strong>g>troduced by Pyth<strong>on</strong>.<br />

For this project, both the HDK and HOM have been evaluated. The Pyth<strong>on</strong> API provides<br />

a module named <str<strong>on</strong>g>in</str<strong>on</strong>g>l<str<strong>on</strong>g>in</str<strong>on</strong>g>ecpp (SideFX 2011c) enabl<str<strong>on</strong>g>in</str<strong>on</strong>g>g the programmer to write functi<strong>on</strong>s <str<strong>on</strong>g>in</str<strong>on</strong>g><br />

C++. However, due to the many <str<strong>on</strong>g>in</str<strong>on</strong>g>teracti<strong>on</strong>s between the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i comp<strong>on</strong>ent and the FRep<br />

API, this method seemed to be too limited. Another reas<strong>on</strong> to choose the HDK was better<br />

extendability for future work and possibly more complex optimisati<strong>on</strong>s.<br />

9


3.2 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK)<br />

3.2.2 Operators and attributes<br />

Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i is organised <str<strong>on</strong>g>in</str<strong>on</strong>g>to a hierarchy of nodes. There are several levels, start<str<strong>on</strong>g>in</str<strong>on</strong>g>g at the<br />

“directory” levels, <str<strong>on</strong>g>in</str<strong>on</strong>g>ternally called Networks, like obj, shop, ch, out and others. Operati<strong>on</strong>s<br />

and objects related to geometry are found <str<strong>on</strong>g>in</str<strong>on</strong>g> Surface operators (SOPs) with<str<strong>on</strong>g>in</str<strong>on</strong>g> the Object<br />

Manager (path /obj). Figure 3.5 shows a set of <str<strong>on</strong>g>in</str<strong>on</strong>g>terc<strong>on</strong>nected nodes with<str<strong>on</strong>g>in</str<strong>on</strong>g> a geometry<br />

object (/obj/geo3).<br />

Figure 3.5: Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s node <str<strong>on</strong>g>based</str<strong>on</strong>g> system<br />

Internally, all nodes are subclasses of OP_Node. As stated <str<strong>on</strong>g>in</str<strong>on</strong>g> the HDK documentati<strong>on</strong> (SideFX<br />

2011a), custom nodes do not <str<strong>on</strong>g>in</str<strong>on</strong>g>herit from this base node directly. Instead, node types are<br />

grouped <str<strong>on</strong>g>in</str<strong>on</strong>g>to different network types like SOP_Node for surface operators as shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Figure<br />

3.6. Custom nodes like FRep_Node create an operator def<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g properties like node name,<br />

attributes and the allowed number of <str<strong>on</strong>g>in</str<strong>on</strong>g>puts.<br />

Furthermore, custom nodes def<str<strong>on</strong>g>in</str<strong>on</strong>g>e a list of PRM_Template items for every attribute. This<br />

def<str<strong>on</strong>g>in</str<strong>on</strong>g>iti<strong>on</strong> c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g>s the type, attribute name, UI name, default value(s) and range. Examples<br />

of often used attributes are dropdown lists, toggles, labels or numeric <str<strong>on</strong>g>in</str<strong>on</strong>g>put fields like float<br />

and <str<strong>on</strong>g>in</str<strong>on</strong>g>t.<br />

10


3.2 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK)<br />

Figure 3.6: Basic class diagram for custom Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i nodes (adapted from SideFX (2011a))<br />

3.2.3 The SOP Node<br />

SOP nodes are dist<str<strong>on</strong>g>in</str<strong>on</strong>g>guished between generators and filters. Generators do not require any<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>put, <str<strong>on</strong>g>in</str<strong>on</strong>g>stead they generate geometry purely <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> their parameters. Filters <strong>on</strong> the<br />

other hand alter geometry and apply a set of operati<strong>on</strong>s to it. In the case of this project,<br />

nodes always except at least <strong>on</strong>e <str<strong>on</strong>g>in</str<strong>on</strong>g>put. Even the FRep node itself that outputs the mesh<br />

after polyg<strong>on</strong>isati<strong>on</strong> is retriev<str<strong>on</strong>g>in</str<strong>on</strong>g>g his attributes from c<strong>on</strong>nected nodes dur<str<strong>on</strong>g>in</str<strong>on</strong>g>g traversal (see<br />

Secti<strong>on</strong> 4.4.2).<br />

As shown <str<strong>on</strong>g>in</str<strong>on</strong>g> the previous secti<strong>on</strong>, the first step <str<strong>on</strong>g>in</str<strong>on</strong>g> creat<str<strong>on</strong>g>in</str<strong>on</strong>g>g a custom SOP is to sub-class<br />

SOP_Node, register the operator and start def<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g attributes. The method which c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g>s<br />

the actual code to manipulate the geometry is called cookMySop and is called automatically<br />

as so<strong>on</strong> as the node is evaluated or refreshed.<br />

Another useful c<strong>on</strong>cept which helps users understand what the SOP is work<str<strong>on</strong>g>in</str<strong>on</strong>g>g with, is the<br />

opti<strong>on</strong> of add<str<strong>on</strong>g>in</str<strong>on</strong>g>g guide geometry. This geometry is not part of the operator and is <strong>on</strong>ly<br />

displayed as guid<str<strong>on</strong>g>in</str<strong>on</strong>g>g <str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong>, as used to display the bound<str<strong>on</strong>g>in</str<strong>on</strong>g>g box of the polyg<strong>on</strong>isati<strong>on</strong><br />

(see Figure 3.7).<br />

11


3.2 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK)<br />

Figure 3.7: Provid<str<strong>on</strong>g>in</str<strong>on</strong>g>g guide geometry (blue lattice) <str<strong>on</strong>g>in</str<strong>on</strong>g> a custom node<br />

3.2.4 Geometry<br />

The ma<str<strong>on</strong>g>in</str<strong>on</strong>g> geometry libraries <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i are GB, GD, GEO and GU. It is bey<strong>on</strong>d the scope of<br />

this thesis to expla<str<strong>on</strong>g>in</str<strong>on</strong>g> all of these <str<strong>on</strong>g>in</str<strong>on</strong>g> detail, but here a brief overview: GB is the geometry base<br />

class <strong>on</strong> which GD (for 2D geometry) and GEO (for 3D geometry) are <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong>. GU is a library<br />

sub-classed off the GEO library c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g higher level tools and classes like GU_Detail.<br />

For 3D geometry, the detail class is used as a c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g>er for po<str<strong>on</strong>g>in</str<strong>on</strong>g>ts, primitives and attributes.<br />

A GEO_Po<str<strong>on</strong>g>in</str<strong>on</strong>g>t represents a po<str<strong>on</strong>g>in</str<strong>on</strong>g>t <str<strong>on</strong>g>in</str<strong>on</strong>g> space; multiple po<str<strong>on</strong>g>in</str<strong>on</strong>g>ts can form a primitive, <str<strong>on</strong>g>in</str<strong>on</strong>g> which case<br />

a GEO_Vertex object is created to store the reference to the po<str<strong>on</strong>g>in</str<strong>on</strong>g>t (see Figure 3.8). For this<br />

project, meshes are all triangulated, so each primitive c<strong>on</strong>sists of 3 vertices.<br />

12


3.2 Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK)<br />

Figure 3.8: Geometry Structure <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i (SideFX 2011b)<br />

13


Chapter 4<br />

Design and implementati<strong>on</strong><br />

To design a system well requires knowledge of all comp<strong>on</strong>ents and appropriate use of the<br />

tools at disposal. After all, design is not just what someth<str<strong>on</strong>g>in</str<strong>on</strong>g>g looks like, it is how it works.<br />

Many design decisi<strong>on</strong>s made throughout the project were <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> best practises and examples<br />

from Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i and its HDK. The ma<str<strong>on</strong>g>in</str<strong>on</strong>g> goal was to <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrate FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> capabilities<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>to a envir<strong>on</strong>ment familiar to exist<str<strong>on</strong>g>in</str<strong>on</strong>g>g Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i users rather than <str<strong>on</strong>g>in</str<strong>on</strong>g>vent<str<strong>on</strong>g>in</str<strong>on</strong>g>g complicated new<br />

workflows.<br />

4.1 System overview<br />

General nam<str<strong>on</strong>g>in</str<strong>on</strong>g>g c<strong>on</strong>venti<strong>on</strong>s and cod<str<strong>on</strong>g>in</str<strong>on</strong>g>g standards have been respected and kept c<strong>on</strong>sistent<br />

with the Maya plug<str<strong>on</strong>g>in</str<strong>on</strong>g> and FRep library itself, wherever possible and not c<strong>on</strong>flict<str<strong>on</strong>g>in</str<strong>on</strong>g>g with<br />

HDK’s cod<str<strong>on</strong>g>in</str<strong>on</strong>g>g guidel<str<strong>on</strong>g>in</str<strong>on</strong>g>es.<br />

There are three ma<str<strong>on</strong>g>in</str<strong>on</strong>g> QtCreator projects:<br />

• QtRep: The port of the FRep API from W<str<strong>on</strong>g>in</str<strong>on</strong>g>dows to Mac OS X (see Secti<strong>on</strong> 4.3.1 <strong>on</strong><br />

GCC compatibility). The output is a dynamic library libQtRep.dylib <strong>on</strong> Mac OS.<br />

On W<str<strong>on</strong>g>in</str<strong>on</strong>g>dows, this would corresp<strong>on</strong>d to a .dll, <strong>on</strong> L<str<strong>on</strong>g>in</str<strong>on</strong>g>ux to a .so file.<br />

• frep-houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i: The <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer (see Secti<strong>on</strong> 3.1.1), mak<str<strong>on</strong>g>in</str<strong>on</strong>g>g use of libQtRep.<br />

dylib and c<strong>on</strong>ta<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g all custom FRep nodes for Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i.<br />

• houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i-test: A standal<strong>on</strong>e test project that uses libQtRep.dylib and allows to make<br />

calls to the FRep API. This is useful for test<str<strong>on</strong>g>in</str<strong>on</strong>g>g and debugg<str<strong>on</strong>g>in</str<strong>on</strong>g>g the <str<strong>on</strong>g>in</str<strong>on</strong>g>teracti<strong>on</strong> with the<br />

FRep library.<br />

14


4.1 System overview<br />

The core of the <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer c<strong>on</strong>sists of a set of custom Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i nodes (see Figure 4.1).<br />

They all <str<strong>on</strong>g>in</str<strong>on</strong>g>herit from FRep_Node which forms the base for primitives and operati<strong>on</strong>s. At the<br />

same time FRep_Node is resp<strong>on</strong>sible for travers<str<strong>on</strong>g>in</str<strong>on</strong>g>g the nodes (see Secti<strong>on</strong> 4.4.2), build<str<strong>on</strong>g>in</str<strong>on</strong>g>g the<br />

FRep tree and outputt<str<strong>on</strong>g>in</str<strong>on</strong>g>g the mesh (see Secti<strong>on</strong> 4.4.3).<br />

SOP_Node<br />

FRep_Node<br />

- m_templateList[] : PRM_Template<br />

- m_variables[] : CH_LocalVariable<br />

- m_attrNames[] : PRM_Name<br />

+ myC<strong>on</strong>structor(i_net : OP_Network, i_name : c<strong>on</strong>st char, i_op : OP_Operator) : OP_ERROR<br />

+ getId() : unsigned <str<strong>on</strong>g>in</str<strong>on</strong>g>t<br />

+ fillParameters(i_entity : ENTITY_BASE_T*, i_now : double, i_srcNode = NULL : OP_Node) : BOOL<br />

+ fillParametersTransform(i_entity : ENTITY_BASE_T, i_now : double, i_thisNode : OP_Node) : BOOL<br />

+ cookMySop(i_c<strong>on</strong>text : OP_C<strong>on</strong>text&) : OP_ERROR<br />

+ cookMyGuide1(i_c<strong>on</strong>text : OP_C<strong>on</strong>text&) : OP_ERROR<br />

- gather(i_now : double) : OP_ERROR<br />

- generateMesh(i_node : ENTITY_NODE_T*, i_now : double) : OP_ERROR<br />

- retrieveChildren(i_node : OP_Node, i_now : double) : ENTITY_NODE_T*<br />

Box_Node CSG_Node Bend_Node Metamorph_Node<br />

Sphere_Node<br />

Blend_Node<br />

Twist_Node<br />

Instancer_Node<br />

Torus_Node<br />

Bounded_Blend_Node<br />

Taper_Node<br />

Sphere_Sweep_Node<br />

C<strong>on</strong>e_Node<br />

Deform_Po<str<strong>on</strong>g>in</str<strong>on</strong>g>t_Node<br />

Cyl<str<strong>on</strong>g>in</str<strong>on</strong>g>der_Node<br />

Figure 4.1: Class diagram of custom Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i nodes<br />

15


4.2 Development envir<strong>on</strong>ment<br />

4.2 Development envir<strong>on</strong>ment<br />

4.2.1 Installati<strong>on</strong> and setup<br />

The Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit (HDK) is part of Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i and <str<strong>on</strong>g>in</str<strong>on</strong>g>stalled under $HFS/toolkit.<br />

All required header files, makefiles and samples are available <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Master as well as<br />

the free Apprentice versi<strong>on</strong>. This project was developed us<str<strong>on</strong>g>in</str<strong>on</strong>g>g QtCreator <str<strong>on</strong>g>in</str<strong>on</strong>g> order to allow<br />

deployment to other platforms. The operat<str<strong>on</strong>g>in</str<strong>on</strong>g>g system used dur<str<strong>on</strong>g>in</str<strong>on</strong>g>g development was Mac OS<br />

X 10.7.<br />

After the <str<strong>on</strong>g>in</str<strong>on</strong>g>stallati<strong>on</strong>, the $HFS envir<strong>on</strong>ment variable po<str<strong>on</strong>g>in</str<strong>on</strong>g>ts to the <str<strong>on</strong>g>in</str<strong>on</strong>g>stallati<strong>on</strong> directory,<br />

which is typically /Library/Frameworks/Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i.framework/Resources <strong>on</strong> a Mac.<br />

4.2.2 Makefiles<br />

There are several ways of compil<str<strong>on</strong>g>in</str<strong>on</strong>g>g HDK code. Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the hcustom command-l<str<strong>on</strong>g>in</str<strong>on</strong>g>e tool is very<br />

c<strong>on</strong>venient and useful for test<str<strong>on</strong>g>in</str<strong>on</strong>g>g, but also limited to a s<str<strong>on</strong>g>in</str<strong>on</strong>g>gle C++ source file and therefore<br />

not appropriate for the library. The alternative is us<str<strong>on</strong>g>in</str<strong>on</strong>g>g Makefiles which are shipped with<br />

the HDK and provide sample Makefiles for L<str<strong>on</strong>g>in</str<strong>on</strong>g>ux and W<str<strong>on</strong>g>in</str<strong>on</strong>g>dows.<br />

For the Mac, Schmidt (2011) provides a makefile which was used as a base. Additi<strong>on</strong>ally,<br />

runn<str<strong>on</strong>g>in</str<strong>on</strong>g>g hcustom -e My_Node.cpp outputs the compiler and l<str<strong>on</strong>g>in</str<strong>on</strong>g>ker commands executed by<br />

hcustom and offers an <str<strong>on</strong>g>in</str<strong>on</strong>g>sight <str<strong>on</strong>g>in</str<strong>on</strong>g>to the way plug<str<strong>on</strong>g>in</str<strong>on</strong>g>s are compiled and bundled. This is particularly<br />

helpful when compil<str<strong>on</strong>g>in</str<strong>on</strong>g>g from c<strong>on</strong>sole or for debugg<str<strong>on</strong>g>in</str<strong>on</strong>g>g compiler and l<str<strong>on</strong>g>in</str<strong>on</strong>g>ker flags.<br />

4.2.3 IDE Integrati<strong>on</strong> and debugg<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

It is worth menti<strong>on</strong><str<strong>on</strong>g>in</str<strong>on</strong>g>g a number of best practices that have been discovered throughout the<br />

development, especially s<str<strong>on</strong>g>in</str<strong>on</strong>g>ce effective workflows <strong>on</strong> different platforms us<str<strong>on</strong>g>in</str<strong>on</strong>g>g various IDEs<br />

are scarcely documented.<br />

Unfortunately, Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s plug<str<strong>on</strong>g>in</str<strong>on</strong>g> architecture does not (officially) support load<str<strong>on</strong>g>in</str<strong>on</strong>g>g and reload<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

of plug<str<strong>on</strong>g>in</str<strong>on</strong>g>s. Instead, they are loaded up<strong>on</strong> startup which requires Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i to be closed and<br />

reopened every time a change to a library is made. Dur<str<strong>on</strong>g>in</str<strong>on</strong>g>g the development of the project,<br />

the follow<str<strong>on</strong>g>in</str<strong>on</strong>g>g workflow has proven to be most effective:<br />

1. Apply changes to the code and build project from with<str<strong>on</strong>g>in</str<strong>on</strong>g> QtCreator. Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g custom<br />

build steps as shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Figure 4.2, make <str<strong>on</strong>g>in</str<strong>on</strong>g>stall can be run from with<str<strong>on</strong>g>in</str<strong>on</strong>g> the IDE us<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

the standard shortcut. Note that <strong>on</strong>e can also add a custom build step for make clean<br />

to rebuild the project entirely.<br />

16


4.2 Development envir<strong>on</strong>ment<br />

2. Start Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i from Term<str<strong>on</strong>g>in</str<strong>on</strong>g>al. This could also be d<strong>on</strong>e automatically via a custom build<br />

step. However, the term<str<strong>on</strong>g>in</str<strong>on</strong>g>al w<str<strong>on</strong>g>in</str<strong>on</strong>g>dow is at the same time used for logs and therefore<br />

useful to display.<br />

3. Opti<strong>on</strong>al: The debugger can then be attached to the runn<str<strong>on</strong>g>in</str<strong>on</strong>g>g applicati<strong>on</strong> with<str<strong>on</strong>g>in</str<strong>on</strong>g> QtCreator<br />

via the menu Debug => Start Debugg<str<strong>on</strong>g>in</str<strong>on</strong>g>g => Attach to Runn<str<strong>on</strong>g>in</str<strong>on</strong>g>g External Applicati<strong>on</strong>...<br />

(see Figure 4.3).<br />

Figure 4.2: Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g custom build steps <str<strong>on</strong>g>in</str<strong>on</strong>g> QtCreator to compile and bundle the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i<br />

library from with<str<strong>on</strong>g>in</str<strong>on</strong>g> the IDE<br />

17


4.3 Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the FRep API<br />

Figure 4.3: Debugg<str<strong>on</strong>g>in</str<strong>on</strong>g>g us<str<strong>on</strong>g>in</str<strong>on</strong>g>g QtCreator<br />

4.3 Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the FRep API<br />

4.3.1 GCC compatibility<br />

Various adjustments to the exist<str<strong>on</strong>g>in</str<strong>on</strong>g>g FRep library (see Secti<strong>on</strong> 3.1) were required for it to be<br />

used <str<strong>on</strong>g>in</str<strong>on</strong>g> the HDK plug<str<strong>on</strong>g>in</str<strong>on</strong>g>. A dynamic library was built and the code, orig<str<strong>on</strong>g>in</str<strong>on</strong>g>ally developed <strong>on</strong><br />

W<str<strong>on</strong>g>in</str<strong>on</strong>g>dows us<str<strong>on</strong>g>in</str<strong>on</strong>g>g Visual Studio’s compiler, was made GCC compatible.<br />

This very time-c<strong>on</strong>sum<str<strong>on</strong>g>in</str<strong>on</strong>g>g task was at the same time necessary groundwork. Hav<str<strong>on</strong>g>in</str<strong>on</strong>g>g a<br />

standard-compliant code base then allows for cross-platform development. The orig<str<strong>on</strong>g>in</str<strong>on</strong>g>al library<br />

heavily relies <strong>on</strong> templates and some notati<strong>on</strong>s needed to be adjusted <str<strong>on</strong>g>in</str<strong>on</strong>g> order to work<br />

with the usually more strict GCC. Although be<str<strong>on</strong>g>in</str<strong>on</strong>g>g platform-<str<strong>on</strong>g>in</str<strong>on</strong>g>dependent for the most part,<br />

some platform-specific code <str<strong>on</strong>g>in</str<strong>on</strong>g> the FRep library had to be ported as well.<br />

4.3.2 Custom <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer<br />

The set of Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i operators create a custom <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer, allow<str<strong>on</strong>g>in</str<strong>on</strong>g>g communicati<strong>on</strong><br />

between FRep API and Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i (see Figure 4.4). These patterns were adapted from the exist<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

plug<str<strong>on</strong>g>in</str<strong>on</strong>g> for Autodesk Maya (Kravtsov 2011). Furthermore, exist<str<strong>on</strong>g>in</str<strong>on</strong>g>g nam<str<strong>on</strong>g>in</str<strong>on</strong>g>g c<strong>on</strong>venti<strong>on</strong>s<br />

were kept and pre-exist<str<strong>on</strong>g>in</str<strong>on</strong>g>g standards respected to ensure portability and ma<str<strong>on</strong>g>in</str<strong>on</strong>g>ta<str<strong>on</strong>g>in</str<strong>on</strong>g>ability.<br />

18


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 />

Figure 4.4: The <str<strong>on</strong>g>in</str<strong>on</strong>g>teracti<strong>on</strong> with the FRep API (Kravtsov 2011)<br />

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 />

4.4.1 The <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> workflow<br />

Modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g us<str<strong>on</strong>g>in</str<strong>on</strong>g>g FRep nodes is very similar to the traditi<strong>on</strong>al approach of procedural <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g><br />

<str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i. FRep nodes can be classified as primitives and operati<strong>on</strong>s. In order to<br />

keep the workflow as natural as possible without forc<str<strong>on</strong>g>in</str<strong>on</strong>g>g users to adapt to new nodes, FRep<br />

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 Box, Sphere, Torus, C<strong>on</strong>e and Tube (called Cyl<str<strong>on</strong>g>in</str<strong>on</strong>g>der <str<strong>on</strong>g>in</str<strong>on</strong>g> the FRep<br />

API) can be used.<br />

Mak<str<strong>on</strong>g>in</str<strong>on</strong>g>g use of Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s native primitive nodes also enables us to reuse guide geometry and<br />

handles. Figure 4.5 shows a basic example of an ord<str<strong>on</strong>g>in</str<strong>on</strong>g>ary box and sphere be<str<strong>on</strong>g>in</str<strong>on</strong>g>g fed <str<strong>on</strong>g>in</str<strong>on</strong>g>to<br />

an FRep blend node. The FRep node at the end of the tree (frep_node6) is needed for<br />

polyg<strong>on</strong>isati<strong>on</strong> and outputt<str<strong>on</strong>g>in</str<strong>on</strong>g>g the mesh.<br />

In additi<strong>on</strong> to the already menti<strong>on</strong>ed primitive types, the <str<strong>on</strong>g>in</str<strong>on</strong>g>termediate layer (or to be more<br />

precise, the traversal algorithm described <str<strong>on</strong>g>in</str<strong>on</strong>g> Secti<strong>on</strong> 4.4.2) is also aware of the Transform<br />

SOP which can be employed for scal<str<strong>on</strong>g>in</str<strong>on</strong>g>g, translat<str<strong>on</strong>g>in</str<strong>on</strong>g>g and rotat<str<strong>on</strong>g>in</str<strong>on</strong>g>g (see Figure 4.6).<br />

19


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 />

Figure 4.5: Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g built-<str<strong>on</strong>g>in</str<strong>on</strong>g> primitive types as guide geometry<br />

Figure 4.6: Transform node for scale, translati<strong>on</strong> and rotati<strong>on</strong><br />

4.4.2 Tree traversal<br />

Gather<str<strong>on</strong>g>in</str<strong>on</strong>g>g the necessary <str<strong>on</strong>g>in</str<strong>on</strong>g>formati<strong>on</strong> to build the FRep tree works differently <str<strong>on</strong>g>in</str<strong>on</strong>g> Maya and<br />

Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i. In Maya, the architecture requires every node to be <str<strong>on</strong>g>in</str<strong>on</strong>g>dependent, so all the attributes<br />

need to be passed and kept up to date. In Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i, this is slightly easier to <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrate and<br />

<strong>on</strong>e node can be used to gather all its <str<strong>on</strong>g>in</str<strong>on</strong>g>put nodes recursively and build the tree from that.<br />

This node at the end of the tree (<str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i typically at the bottom) is represented by the<br />

20


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


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 />

Functi<strong>on</strong>: retrieveChildren(thisNode)<br />

// Phase 1: Initialisati<strong>on</strong><br />

factory ← Create factory<br />

returnNode ← Node to be returned (<str<strong>on</strong>g>in</str<strong>on</strong>g>itially NULL)<br />

isFRepNode ← Is the node <strong>on</strong>e of our own FRep nodes?<br />

isHoud<str<strong>on</strong>g>in</str<strong>on</strong>g>iGeoNode ← Is Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i geometry node like Sphere, Box, Torus, etc.?<br />

isTransformNode ← Is Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i transform node?<br />

// Phase 2: Create FRep node and entities<br />

if isFRepNode or isHoud<str<strong>on</strong>g>in</str<strong>on</strong>g>iGeoNode then<br />

if isFRepNode then<br />

frepNode ← cast thisNode as FRep_Node<br />

else if isHoud<str<strong>on</strong>g>in</str<strong>on</strong>g>iGeoNode? then<br />

frepNode ← create FRep node for Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i native primitive<br />

end<br />

newEntity ← create entity of frepNode.getTypeId() via factory<br />

newFrepNode ← create node <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> newEntity<br />

returnNode ← newFrepNode<br />

end<br />

// Phase 3: Add transform node<br />

if isFRepNode or isTransformNode then<br />

transformEntity ← create entity with the transforms of thisNode<br />

transformNode ← create node <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> transformEntity<br />

transformNode.addChild(newFrepNode)<br />

returnNode ← transformNode<br />

end<br />

// Phase 4: Fill parameters and run <strong>on</strong> child nodes (if any)<br />

if isFRepNode or isHoud<str<strong>on</strong>g>in</str<strong>on</strong>g>iGeoNode then<br />

frepNode.fillParameters()<br />

foreach child <str<strong>on</strong>g>in</str<strong>on</strong>g> <str<strong>on</strong>g>in</str<strong>on</strong>g>putNodes do<br />

childNode ← retrieveChildren(child)<br />

if Child is FRep node then newFrepNode.addChild(childNode)<br />

end<br />

return returnNode<br />

else if thisNode has <str<strong>on</strong>g>in</str<strong>on</strong>g>put then<br />

return retrieveChildren(<str<strong>on</strong>g>in</str<strong>on</strong>g>put)<br />

else<br />

return NULL<br />

end<br />

Algorithm 1: Recursive node traversal functi<strong>on</strong><br />

22


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 />

4.4.3 Polyg<strong>on</strong>isati<strong>on</strong><br />

As menti<strong>on</strong>ed <str<strong>on</strong>g>in</str<strong>on</strong>g> Secti<strong>on</strong> 4.4.1 about the FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> workflow, an frep_node is added<br />

to the end of the network. This node has two ma<str<strong>on</strong>g>in</str<strong>on</strong>g> tasks. The first is travers<str<strong>on</strong>g>in</str<strong>on</strong>g>g all nodes<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g> order to gather all parameters and build the FRep tree as described <str<strong>on</strong>g>in</str<strong>on</strong>g> Secti<strong>on</strong> 4.4.2. The<br />

sec<strong>on</strong>d task of the node is to pass the tree to the polyg<strong>on</strong>iser of the FRep API and then<br />

assign the generated mesh data to Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s geometry structures.<br />

The polyg<strong>on</strong>iser has a number of attributes that can be manipulated via the user <str<strong>on</strong>g>in</str<strong>on</strong>g>terface.<br />

The bound<str<strong>on</strong>g>in</str<strong>on</strong>g>g box, grid resoluti<strong>on</strong> and surface generati<strong>on</strong> method can be def<str<strong>on</strong>g>in</str<strong>on</strong>g>ed. An example<br />

of the analytic method is shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Figure 4.7.<br />

Figure 4.7: Polyg<strong>on</strong>isati<strong>on</strong> us<str<strong>on</strong>g>in</str<strong>on</strong>g>g analytic normals and a subdivisi<strong>on</strong> level of 3<br />

Assign<str<strong>on</strong>g>in</str<strong>on</strong>g>g the data received from the polyg<strong>on</strong>iser is fairly straight-forward, keep<str<strong>on</strong>g>in</str<strong>on</strong>g>g the <str<strong>on</strong>g>in</str<strong>on</strong>g>ternal<br />

structure of Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s geometry architecture (see Secti<strong>on</strong> 3.2.4) <str<strong>on</strong>g>in</str<strong>on</strong>g> m<str<strong>on</strong>g>in</str<strong>on</strong>g>d.<br />

4.4.4 FRep Operati<strong>on</strong>s<br />

Blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

There is a variety of operati<strong>on</strong>s possible. For c<strong>on</strong>venti<strong>on</strong>al boolean <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g>, the CSG node<br />

can be used for uni<strong>on</strong>, <str<strong>on</strong>g>in</str<strong>on</strong>g>tersecti<strong>on</strong> and subtracti<strong>on</strong> operati<strong>on</strong>s (see Figure 4.8). The Blend<br />

node is similar to the CSG node but provides more user c<strong>on</strong>trol, offer<str<strong>on</strong>g>in</str<strong>on</strong>g>g three parameters to<br />

c<strong>on</strong>trol the blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g and achieve various results as shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Figure 4.9. This c<strong>on</strong>cept is taken<br />

even further us<str<strong>on</strong>g>in</str<strong>on</strong>g>g bounded blend nodes, allow<str<strong>on</strong>g>in</str<strong>on</strong>g>g local c<strong>on</strong>trol of blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g (see Figure 4.10).<br />

23


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 />

Figure 4.8: Example of a CSG node used to perform a subtract operati<strong>on</strong><br />

Figure 4.9: Example of the blend node <str<strong>on</strong>g>in</str<strong>on</strong>g> use with different blend values: 1 10 1, 1 50 50,<br />

1 1 10<br />

24


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 />

Figure 4.10: Bounded blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g us<str<strong>on</strong>g>in</str<strong>on</strong>g>g three spheres<br />

Taper, Bend, twist and deform po<str<strong>on</strong>g>in</str<strong>on</strong>g>t<br />

Other operators allow relatively complex operati<strong>on</strong>s with very little effort. All operati<strong>on</strong>s<br />

shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Figure 4.11 and Figure 4.12 are entirely <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> a simple box primitive. Each of<br />

the meshes is therefore produced us<str<strong>on</strong>g>in</str<strong>on</strong>g>g three nodes <strong>on</strong>ly: box node, FRep operati<strong>on</strong> (taper,<br />

bend, twist or deform po<str<strong>on</strong>g>in</str<strong>on</strong>g>t) and the FRep base node for polyg<strong>on</strong>isati<strong>on</strong>.<br />

Figure 4.11: Example of the taper node<br />

25


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 />

Figure 4.12: Examples of bend, twist and deform po<str<strong>on</strong>g>in</str<strong>on</strong>g>t operati<strong>on</strong>s<br />

Sphere sweep<br />

The Sphere sweep node (see Figure 4.13) allows “draw<str<strong>on</strong>g>in</str<strong>on</strong>g>g” three-dimensi<strong>on</strong>al l<str<strong>on</strong>g>in</str<strong>on</strong>g>es by provid<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

a standard Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i curve as <str<strong>on</strong>g>in</str<strong>on</strong>g>put and specify<str<strong>on</strong>g>in</str<strong>on</strong>g>g a radius <str<strong>on</strong>g>in</str<strong>on</strong>g>side the sweep node.<br />

Figure 4.13: Sphere sweep node us<str<strong>on</strong>g>in</str<strong>on</strong>g>g a standard Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i curve as <str<strong>on</strong>g>in</str<strong>on</strong>g>put<br />

Offset<br />

Figure 4.14 shows the offset node which allows to extract a mesh <str<strong>on</strong>g>in</str<strong>on</strong>g>side (Offset value < 1) or<br />

outside the orig<str<strong>on</strong>g>in</str<strong>on</strong>g>al surface (Offset value > 1).<br />

26


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 />

Figure 4.14: Offset node us<str<strong>on</strong>g>in</str<strong>on</strong>g>g different offset values: -0.5 (left), 0 (middle), 0.5 (right)<br />

Metamorphosis<br />

Probably <strong>on</strong>e of the best examples of the benefits of FRep is when morph<str<strong>on</strong>g>in</str<strong>on</strong>g>g two objects<br />

with completely different topologies. Figure 4.15 shows an example of such an operati<strong>on</strong> <str<strong>on</strong>g>in</str<strong>on</strong>g><br />

five steps from alpha = 0 to alpha = 1.<br />

Figure 4.15: Metamorphosis from a c<strong>on</strong>e to a torus<br />

Instancer<br />

The <str<strong>on</strong>g>in</str<strong>on</strong>g>stancer node can output <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> any sort of <str<strong>on</strong>g>in</str<strong>on</strong>g>put geometry. In the example <str<strong>on</strong>g>in</str<strong>on</strong>g><br />

Figure 4.16, a torus is used to create a grid-like structure. Figure 4.17 shows a more complex<br />

example us<str<strong>on</strong>g>in</str<strong>on</strong>g>g two torus objects for the <str<strong>on</strong>g>in</str<strong>on</strong>g>stancer. The result then gets <str<strong>on</strong>g>in</str<strong>on</strong>g>tersected with a<br />

bigger torus.<br />

27


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 />

Figure 4.16: Instancer node output <str<strong>on</strong>g>based</str<strong>on</strong>g> <strong>on</strong> torus<br />

Figure 4.17: More complex example of the <str<strong>on</strong>g>in</str<strong>on</strong>g>stancer node.<br />

28


Chapter 5<br />

Results and analysis<br />

Like traditi<strong>on</strong>al polyg<strong>on</strong> <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g>, FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> offers the same vastness of possibilities.<br />

Virtually anyth<str<strong>on</strong>g>in</str<strong>on</strong>g>g can be created, any attribute of an object can be c<strong>on</strong>trolled and changed<br />

over time. This chapter tries to provide an idea of what is possible by show<str<strong>on</strong>g>in</str<strong>on</strong>g>g some examples,<br />

but also outl<str<strong>on</strong>g>in</str<strong>on</strong>g><str<strong>on</strong>g>in</str<strong>on</strong>g>g some of the limitati<strong>on</strong>s of the current system.<br />

5.1 Modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

To dem<strong>on</strong>strate some of the <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> capabilities, a real-world object (see Figure 5.1) and a<br />

simple character (see Figure 5.2) have been created. As shown <str<strong>on</strong>g>in</str<strong>on</strong>g> the example of the screw,<br />

such an object can be created with very few nodes.<br />

Figure 5.1: Screw model with its corresp<strong>on</strong>d<str<strong>on</strong>g>in</str<strong>on</strong>g>g node network and optimisati<strong>on</strong> for sharp<br />

features<br />

29


5.2 Animati<strong>on</strong><br />

Figure 5.2: Pengu<str<strong>on</strong>g>in</str<strong>on</strong>g> FRep model<br />

5.2 Animati<strong>on</strong><br />

Just like every other node attribute <str<strong>on</strong>g>in</str<strong>on</strong>g> Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i, FRep attributes can be animated us<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

keyframes. In Figure 5.3, a truck was modelled and its backdoor rotated over time around<br />

a pivot po<str<strong>on</strong>g>in</str<strong>on</strong>g>t. The keyframe animati<strong>on</strong> can be c<strong>on</strong>trolled further us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the animati<strong>on</strong> graph<br />

(see Figure 5.4).<br />

Figure 5.3: Truck show<str<strong>on</strong>g>in</str<strong>on</strong>g>g keyframe animati<strong>on</strong><br />

30


5.3 Morph<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

Figure 5.4: Animati<strong>on</strong> graph of the truck animati<strong>on</strong><br />

5.3 Morph<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

The fact that objects are mathematical functi<strong>on</strong>s allows us to <str<strong>on</strong>g>in</str<strong>on</strong>g>terpolate between these<br />

functi<strong>on</strong>s. For the user, all that is needed is to c<strong>on</strong>nect two objects us<str<strong>on</strong>g>in</str<strong>on</strong>g>g a metamorphosis<br />

node. Figure 5.5 shows an example of metamorphosis of two objects with different topologies.<br />

Figure 5.5: Metamorphosis of simple 3D character to a screw<br />

31


5.4 Limitati<strong>on</strong>s<br />

5.4 Limitati<strong>on</strong>s<br />

All of the functi<strong>on</strong>ality the FRep API offers is still not <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrated at this stage. However,<br />

the project has been designed with extendability <str<strong>on</strong>g>in</str<strong>on</strong>g> m<str<strong>on</strong>g>in</str<strong>on</strong>g>d. There is a list of known issues and<br />

limitati<strong>on</strong>s to the current system:<br />

• The node type is currently determ<str<strong>on</strong>g>in</str<strong>on</strong>g>ed by compar<str<strong>on</strong>g>in</str<strong>on</strong>g>g node names (e.g. frep_bend).<br />

Therefore, if the node is renamed, the tree traversal algorithm ceases to recognise it.<br />

However, suffixes can still be added (i.e. frep_bend_arm will work). To solve this,<br />

nodes would have to be identified by their class type which would be <strong>on</strong>e of the first<br />

issues to fix <str<strong>on</strong>g>in</str<strong>on</strong>g> a potential future versi<strong>on</strong>.<br />

• The polyg<strong>on</strong>isati<strong>on</strong> can not be canceled us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the escape key like it is good practice <str<strong>on</strong>g>in</str<strong>on</strong>g><br />

Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i. This has to do with the fact that Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s <str<strong>on</strong>g>in</str<strong>on</strong>g>terrupt has to be placed with<str<strong>on</strong>g>in</str<strong>on</strong>g><br />

the loop of a critical operati<strong>on</strong>. S<str<strong>on</strong>g>in</str<strong>on</strong>g>ce the polyg<strong>on</strong>isati<strong>on</strong> is part of the FRep API, this<br />

is not possible.<br />

• When animat<str<strong>on</strong>g>in</str<strong>on</strong>g>g FRep attributes, like alpha <str<strong>on</strong>g>in</str<strong>on</strong>g> the metamorph node, the nodes are<br />

not refreshed. The current work around is to set two keyframes to an attribute of any<br />

other Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i native node <str<strong>on</strong>g>in</str<strong>on</strong>g> the network (even if it is not chang<str<strong>on</strong>g>in</str<strong>on</strong>g>g values). The reas<strong>on</strong><br />

might lie <str<strong>on</strong>g>in</str<strong>on</strong>g> the evaluati<strong>on</strong> of animatable attributes <str<strong>on</strong>g>in</str<strong>on</strong>g> custom nodes, but needs further<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>vestigati<strong>on</strong>.<br />

• There can <strong>on</strong>ly be <strong>on</strong>e FRep base node per network, so it is not possible to feed a f<str<strong>on</strong>g>in</str<strong>on</strong>g>al<br />

FRep node back <str<strong>on</strong>g>in</str<strong>on</strong>g>to another <strong>on</strong>e. This behaviour is correct, but an appropriate error<br />

message should be displayed.<br />

• Bypass<str<strong>on</strong>g>in</str<strong>on</strong>g>g a node currently has no effect <strong>on</strong> the system. The soluti<strong>on</strong> would be to<br />

query this flag for every node dur<str<strong>on</strong>g>in</str<strong>on</strong>g>g tree traversal and simply ignore bypassed nodes<br />

(c<strong>on</strong>t<str<strong>on</strong>g>in</str<strong>on</strong>g>ue the executi<strong>on</strong> of the recursive functi<strong>on</strong>).<br />

Some open questi<strong>on</strong>s rema<str<strong>on</strong>g>in</str<strong>on</strong>g> <str<strong>on</strong>g>in</str<strong>on</strong>g> terms of deploy<str<strong>on</strong>g>in</str<strong>on</strong>g>g the project to other platforms. One of<br />

the downsides of us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the HDK rather than Pyth<strong>on</strong>, is the requirement for the plug<str<strong>on</strong>g>in</str<strong>on</strong>g> to be<br />

recompiled <strong>on</strong> every platform us<str<strong>on</strong>g>in</str<strong>on</strong>g>g the same compiler Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i was compiled with.<br />

32


Chapter 6<br />

C<strong>on</strong>clusi<strong>on</strong><br />

Bas<str<strong>on</strong>g>in</str<strong>on</strong>g>g a project <strong>on</strong> an external library (which had to be ported first), while at the same time<br />

tackl<str<strong>on</strong>g>in</str<strong>on</strong>g>g a complex SDK like the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i Development Kit was certa<str<strong>on</strong>g>in</str<strong>on</strong>g>ly an ambitious goal. In<br />

retrospect, the objective of br<str<strong>on</strong>g>in</str<strong>on</strong>g>g<str<strong>on</strong>g>in</str<strong>on</strong>g>g FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> capabilities to Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i while respect<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

exist<str<strong>on</strong>g>in</str<strong>on</strong>g>g guidel<str<strong>on</strong>g>in</str<strong>on</strong>g>es and UI paradigms, was achieved. Particularly the degree of <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrati<strong>on</strong><br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>to the Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i envir<strong>on</strong>ment is very promis<str<strong>on</strong>g>in</str<strong>on</strong>g>g for future projects and applicati<strong>on</strong>s.<br />

The FRep API offers a vast set of features. Some nodes and features could not be <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrated<br />

given the short durati<strong>on</strong> of this project. There is also a list of known issues and limitati<strong>on</strong>s<br />

to the system, as discussed <str<strong>on</strong>g>in</str<strong>on</strong>g> Secti<strong>on</strong> 5.4. Choos<str<strong>on</strong>g>in</str<strong>on</strong>g>g the HDK over Pyth<strong>on</strong> was the right<br />

decisi<strong>on</strong> and, apart from hav<str<strong>on</strong>g>in</str<strong>on</strong>g>g performance benefits, offer<str<strong>on</strong>g>in</str<strong>on</strong>g>g a clean and solid foundati<strong>on</strong><br />

for future development.<br />

6.1 Applicati<strong>on</strong>s<br />

The technology can have applicati<strong>on</strong>s <str<strong>on</strong>g>in</str<strong>on</strong>g> <str<strong>on</strong>g>in</str<strong>on</strong>g>dustries like film and games, especially as computers<br />

get faster and more accurate representati<strong>on</strong>s of the real-world are desired. Furthermore,<br />

be<str<strong>on</strong>g>in</str<strong>on</strong>g>g able to blend and morph objects regardless of topology is challeng<str<strong>on</strong>g>in</str<strong>on</strong>g>g us<str<strong>on</strong>g>in</str<strong>on</strong>g>g current<br />

methods.<br />

S<str<strong>on</strong>g>in</str<strong>on</strong>g>ce FReps are resoluti<strong>on</strong>-<str<strong>on</strong>g>in</str<strong>on</strong>g>dependent, they are ideal for use <str<strong>on</strong>g>in</str<strong>on</strong>g> digital manufactur<str<strong>on</strong>g>in</str<strong>on</strong>g>g and<br />

3D pr<str<strong>on</strong>g>in</str<strong>on</strong>g>t<str<strong>on</strong>g>in</str<strong>on</strong>g>g. Additi<strong>on</strong>al nodes could be developed to allow export from Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i to various<br />

file formats like STL.<br />

33


6.2 Future work<br />

6.2 Future work<br />

In additi<strong>on</strong> to address<str<strong>on</strong>g>in</str<strong>on</strong>g>g known issues (see Secti<strong>on</strong> 5.4), there are various nodes <str<strong>on</strong>g>in</str<strong>on</strong>g> the<br />

FRep API that rema<str<strong>on</strong>g>in</str<strong>on</strong>g> to be implemented. Other limitati<strong>on</strong>s are c<strong>on</strong>nected to the nature of<br />

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> itself. For example, it can be very difficult for a user to imag<str<strong>on</strong>g>in</str<strong>on</strong>g>e the<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>fluence of each of the attributes <str<strong>on</strong>g>in</str<strong>on</strong>g> a blend operati<strong>on</strong>. Develop<str<strong>on</strong>g>in</str<strong>on</strong>g>g new tools and techniques<br />

to allow more <str<strong>on</strong>g>in</str<strong>on</strong>g>tuitive FRep <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> and teach<str<strong>on</strong>g>in</str<strong>on</strong>g>g artists to use these appropriately is<br />

another area for further research.<br />

Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i has its own iso surface node to polyg<strong>on</strong>ise implicit functi<strong>on</strong>s. It might be <str<strong>on</strong>g>in</str<strong>on</strong>g>terest<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

to <str<strong>on</strong>g>in</str<strong>on</strong>g>vestigate potential performance benefits when <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrat<str<strong>on</strong>g>in</str<strong>on</strong>g>g Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i’s polyg<strong>on</strong>iser <str<strong>on</strong>g>in</str<strong>on</strong>g>to the<br />

current system. On the other hand, optimisati<strong>on</strong>s to the polyg<strong>on</strong>sier like the support for<br />

sharp features would go miss<str<strong>on</strong>g>in</str<strong>on</strong>g>g.<br />

Performance is still an issue, especially as models become more complex and higher resoluti<strong>on</strong>s<br />

are applied. To leverage multiple CPU cores or the GPU, additi<strong>on</strong>al efforts are needed, as<br />

shown with the CUDA <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrati<strong>on</strong> <str<strong>on</strong>g>in</str<strong>on</strong>g> the Maya plug<str<strong>on</strong>g>in</str<strong>on</strong>g> (Kravtsov 2011).<br />

As further packages are targeted, the <str<strong>on</strong>g>in</str<strong>on</strong>g>tegrati<strong>on</strong> process <str<strong>on</strong>g>in</str<strong>on</strong>g>to other <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> systems can<br />

be automated us<str<strong>on</strong>g>in</str<strong>on</strong>g>g a set of translators <str<strong>on</strong>g>in</str<strong>on</strong>g> order to avoid manual labour-<str<strong>on</strong>g>in</str<strong>on</strong>g>tensive work as<br />

shown <str<strong>on</strong>g>in</str<strong>on</strong>g> Figure 6.1.<br />

Figure 6.1: A set of applicati<strong>on</strong> and platform specific translators (Kravtsov 2011)<br />

34


REFERENCES<br />

References<br />

Adzhiev, V., Pasko, A., and Sarkisov, A. (1996), Hyperjazz project: development of<br />

geometric <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> systems with <str<strong>on</strong>g>in</str<strong>on</strong>g>herent symbolic <str<strong>on</strong>g>in</str<strong>on</strong>g>teractivity. In CSG 96 (W<str<strong>on</strong>g>in</str<strong>on</strong>g>chester,<br />

UK, 17-19 April 1996), Informati<strong>on</strong> Geometers, 183198.<br />

Adzhiev, V., Cartwright, R., Fausett, E., Ossipov, A., Pasko, A., and<br />

Savchenko, V. (1999), Hyperfun project: a framework for collaborative multidimensi<strong>on</strong>al<br />

f-rep model<str<strong>on</strong>g>in</str<strong>on</strong>g>g. Available from: http://hyperfun.org/HF_paper.pdf [Accessed 10 August<br />

2011].<br />

Gamma, E., Helm, R., Johns<strong>on</strong>, R., and Vlissides, J. (1995), Design patterns: elements<br />

of reusable object-oriented software.<br />

Kravtsov, D. (2011), Hybrid <str<strong>on</strong>g>modell<str<strong>on</strong>g>in</str<strong>on</strong>g>g</str<strong>on</strong>g> of time-variant heterogeneous objects. PhD Thesis.<br />

Ohtake, Y., Belyaev, A., and Pasko, A. (2002), Dynamic mesh optimizati<strong>on</strong><br />

for polyg<strong>on</strong>ized implicit surfaces with sharp features. Available from:<br />

http://hyperfun.org/TVC02obp.pdf [Accessed 5 August 2011].<br />

Pasko, A. (2011), What is frep? Available from:<br />

http://hyperfun.org/wiki/doku.php?id=frep:what [Accessed 5 August 2011].<br />

Pasko, A., Adzhiev, V., Sour<str<strong>on</strong>g>in</str<strong>on</strong>g>, A., and Savchenko, V. (1995), Functi<strong>on</strong> representati<strong>on</strong><br />

<str<strong>on</strong>g>in</str<strong>on</strong>g> geometric model<str<strong>on</strong>g>in</str<strong>on</strong>g>g: c<strong>on</strong>cepts, implementati<strong>on</strong> and applicati<strong>on</strong>s. Available from:<br />

http://hyperfun.org/TVC95.pdf [Accessed 5 August 2011].<br />

Pasko, G., Pasko, A., and Kunii, T. (2005), Bounded blend<str<strong>on</strong>g>in</str<strong>on</strong>g>g for functi<strong>on</strong>-<str<strong>on</strong>g>based</str<strong>on</strong>g> shape<br />

model<str<strong>on</strong>g>in</str<strong>on</strong>g>g. Available from: http://www.hyperfun.org/BoundBlend_CGApref<str<strong>on</strong>g>in</str<strong>on</strong>g>al.pdf [Accessed<br />

5 August 2011].<br />

Schmidt, S. H. (2011), Hdk - houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i makefile for mac. Available from:<br />

http://www.subsites.org/484.0.html [Accessed 1 August 2011].<br />

SideFX (2011)a, Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i development kit – architectural overview. Available from:<br />

http://www.sidefx.com/docs/hdk11.0/hdk_opbasics_architecture.html [Accessed 1 August<br />

2011].<br />

SideFX (2011)b, Houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i development kit – geometry <str<strong>on</strong>g>in</str<strong>on</strong>g>troducti<strong>on</strong>. Available<br />

from: http://www.sidefx.com/docs/hdk11.0/hdk_geometry_<str<strong>on</strong>g>in</str<strong>on</strong>g>tro.html [Accessed 1 August<br />

2011].<br />

SideFX (2011)c, Extend<str<strong>on</strong>g>in</str<strong>on</strong>g>g the hou module us<str<strong>on</strong>g>in</str<strong>on</strong>g>g c++. Available from:<br />

http://www.sidefx.com/docs/houd<str<strong>on</strong>g>in</str<strong>on</strong>g>i11.0/hom/extend<str<strong>on</strong>g>in</str<strong>on</strong>g>gwithcpp [Accessed 3 August<br />

2011].<br />

35

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

Saved successfully!

Ooh no, something went wrong!