Procedural Objects

From VRwiki
Jump to: navigation, search
Screenshot from the demo program

Procedural objects are XVR entities whose geometry is specified via script instead of loading an AAM file. This leads to interesting possibilities, since objects with a high degree of regularity can be created in a bunch of code lines, and/or modified interactively.

Procedural Objects in XVR

Requirements

Procedural Objects are currently implemented in the 0002 version of the engine. After some testing it will be integrated in engine version 0143.

Author

Released August 31st, 2006 by Marcello Carrozzino.

Demo program

This is a tutorial program to show how to use procedural objects in XVR. Detailed specifications and comments may be found in the source code itself, available here.

The source code includes:

  • ProceduralTest: main application and sample code which shows step-to-step generation of complex objects
  • ProceduralObj: hi-level class built on top of the new XVR procedural objects
  • MarcelloUtils: collection of utility functions and classes

Sample procedural objects

In the sample application, five different procedural objects are generated:

  • Fonte Battesimale and Torre di Pisa are architectural objects, to show how complex geometry can be on-the-fly generated rather than storing huge geometry files. For network distributed applications, this can be an option. As the scripts are a porting of a previous C++ implementation of the library, not always objects are specified in the easiest way. An alternative (for instance for boxes) may be to generate unitary size building blocks and use scale, rotation and translation.
  • Acquedotto is a sample object, useful to understand the power of repeating entities along pre-defined directions.
  • Quad shows how to directly embed a custom mesh creation in the source code, by specifying vertices, faces, subsets etc.
  • Footprint shows how to create a mesh by extruding a specified contour.

All in all you have surprisingly decent objects, with high polygonal details, at the cost of... 45 Kb including textures!

Future developments

Planned future developments include:

  • (Hi-level) Adding other layout patterns in addition to linear and circular placing, like curves or pseudo-random distributions
  • (Lo-level) Adding more building blocks

Download

You can download the example application here.

See Also