Loading...
 
Procedural Objects        

Procedural Objects

Procobj

Procedural objects are objects that are randomly spawned on a physical material. This firstly allows to save some time as the objects don't have to be placed by hand. Secondly it allows some variety between different visits to the same area, useful for e.g. trash, leaves, and other mobile clutter.

Properties

These are the available properties and their default values.

 procedural_object "MyProceduralObject" {
     class = "MyClass",
     density = 0.01,
     minSlope = 0, maxSlope = 180,
     rotate = false,
     alignSlope = false,
     noZ = false,
     seed = false,
 }

The procedural object definition starts with the name that the physical material will use, to denote that procedural objects of this kind should be spawned on its surfaces.

The name of the classes (including path if necessary) of the object to spawn has to be given.

The property 'density' is the number of objects to create per square metre (don't go mad here, these objects have some performance cost).

One can place a minimum and maximum bound on the slope gradient between which procedural objects will be spawned. This allows to avoid (or only permit) spawning on walls / ceilings, etc. Values range from 0 (the floor) to 90 (a vertical wall) to 180 (the ceiling).

The option 'rotate' determines whether the object is randomly rotated about z on spawn, either true or false.

The option 'alignSlope' determines whether the object's z axis should be tilted to the normal of the triangle it is spawned on. This allows the procedural objects to 'flow' around the terrain, either true or false.

The option 'noZ' makes spawning more frequent at the lower end of the slope range, i.e. makes the distribution of procedural objects favour flatter ground. Useful to avoid the 'straight line' cut off effect with the absolute minimum/maximum slope properties above.

The property 'seed' makes spawning consistent between revisits to the same area and runs of the engine. This can be useful for objects that really ought not to move, like rocks and plants. The seed defaults to 'false' which means the procedural objects are randomised each time the mesh spawns in. To change this behaviour, give a number between 0 and 65535.

Performance notes

For overdraw reason, you should keep the shader as simple as it can, and the polycount shouldn't be high.

Examples

 procedural_object "GrassTuft1" {
     class = "veg/GrassTuft1",
     density = 0.1,
     minSlope = 0, maxSlope = 50,
     rotate = true,
     alignSlope = true,
     noZ = true,
     seed = 42,
 }

Category:Mapping?
Category:Physics?