ModelScanner

Description

sealed class Tinman.Engine.Models.ModelScanner

Derived from

Disposable abstract
IValidatable

The ModelScanner class converts a 3D model to a heightmap.

Public / Constructors

Model​Scanner


public constructor ModelScanner → ()

Creates a new instance of ModelScanner.

Public / Methods

Scan


[OwnerReturn]
public method Scan → ()

returns → IOperation

The background operation.

Creates a background operation than scans the 3D model and generates a heightmap dataset.

The following work is performed by the model scanner operation:

  1. The 3D model is loaded from ModelReader, if necessary.

  2. The 3D model is analysed in order to determine a suitable base geometry for subsequent scanning. Currently, the only supported base geometry is Geometry.Sphere.

  3. The output dataset is created, using the given heightmap Size, the base geometry and a geo-reference for a spherical planetary terrain.

  4. For each sample of the output dataset, a ray is cast along the inverted up-direction of the base geometry. Based on the intersection with the surface of the 3D model, a terrain elevation value is computed and stored in a temporary elevation dataset.

  5. The temporary elevation dataset is copied to the output dataset, using a copy operation that blurs elevation values according to BlurElevation.

  6. For each sample of the output dataset, a ray is cast along the normal vector of the terrain surface defined by the blurred elevation values. Based on the intersection with the surface of the 3D model, a terrain displacement value is computed and stored in a temporary displacement dataset.

  7. The temporary displacement dataset is copied to the output dataset, using a copy operation that blurs displacement values according to BlurDisplacement.

  8. The temporary elevation and displacement datasets are deleted.

ValidatingException

If the model scanner settings are invalid.

Public / Attributes

Blur​Displacement


public attribute BlurDisplacement → (get,set)

value : int32

[>=1]
The blur amount (see CopySamplesOp.Blur).

Amount of blurring to apply to the generated displacement values before copying them to the output dataset.

Defaults to 5.

Blur​Elevation


public attribute BlurElevation → (get,set)

value : int32

[>=1]
The blur amount (see CopySamplesOp.Blur).

Amount of blurring to apply to the generated elevation values before generating displacement values and before copying them to the output dataset.

Defaults to 50.

Heightmap


public attribute Heightmap → (get,set)

value : Path

The output path.

Output path of the heightmap dataset that uses elevation and displacement to represent the scanned surface of the 3D model.

Defaults to null.

Model​Reader


[OwnerValue]
public attribute ModelReader → (get,set)

value : IModelReader

The model to convert.

The 3D model to convert.

Child models are not processed.

Size


public attribute Size → (get,set)

value : int32

[pow2+1]
The heightmap size.

The size of the generated heightmap datasets.

Defaults to 257.