Model.Read

Description

Name

class Tinman.Model.Read

Derived from

Model

Reads the given 3D model file.

Fields / Required

data

Type

Data

Constraint

# != null

The 3D model file to read.

Fields / Optional

format

Type

string

Default

null

The 3D model file format. If unknown, the format is inferred from the data stream.
The following default model file formats are available:

  • 'Any'

    Automatic model format

  • 'CMH'

    The CMH model file format ('Compiled Model Hierarchy', proprietary)

    Write supported: yes
    IANA media type: none
    File extensions: .cmh

  • 'GLB'

    The GL Transmission Format Version 2.0 - Binary

    Write supported: no
    IANA media type: model/gltf-binary
    File extensions: .glb

  • 'GLTF'

    The GL Transmission Format Version 2.0 - JSON

    Write supported: no
    IANA media type: model/gltf+json
    File extensions: .gltf

  • 'LAS'

    The LAS model file format.

    Write supported: no
    IANA media type: application/vnd.las
    File extensions: .las

  • 'OBJ'

    The OBJ model file format.

    Write supported: yes
    IANA media type: model/obj
    File extensions: .obj

    The following commands are supported in *.obj files:

    • v X Y Z (vertex coordinates)

    • v X Y Z R G B (vertex coordinates with color)

    • vn X Y Z (vertex normal vector)

    • vt X Y (vertex texture coordinates)

    • s N (smoothing group for normal vectors)

    • f A1 B1 C1 …​ (polygon face)

    • f A1/A2 B1/B2 C1/C2 …​ (polygon face)

    • f A1/A2/A3 B1/B2/B3 C1/C2/C3 …​ (polygon face)

    • mtllib NAME (select material library)

    • usemtl NAME (select material)

    The following commands are supported in *.mtl files:

    • newmtl NAME (define new material)

    • Ka R G B (ambient reflectivity)

    • Kd R G B (diffuse reflectivity)

    • Ks R G B (specular reflectivity)

    • Tf R G B (transmission filter)

    • d V (material dissolve)

    • sharpness V (glossiness)

    • map_Ka NAME (ambient texture map)

    • map_Kd NAME (diffuse texture map)

    • map_Ks NAME (specular texture map)

    • map_d NAME (dissolve texture map)

  • 'ASSIMP5'
    Uses Open Asset Import Library (v5.*), if installed.


winding

Type

number

Default

0

Fix vertex winding of indexed triangle list primitives:
Given a triangle (a,b,c), vertex winding is fixed using the face normal N and the cross product X=(b-a)x(c-a):
> 0: Fix triangle winding so that dot(N,X) is positive.
< 0: Fix triangle winding so that dot(N,X) is negative.
= 0: Do not fix triangle winding.

If the model does not have normal vectors, vertex winding will never be fixed. This fix is applied after Read.Flags.FlipWinding.


flags

Type

Read.Flags[]

Default

[None]

The model reader flags to use.


glossiness

Type

number

Default

1

Scale factor to apply to Model.Material.glossiness of all read materials.


reflectivity

Type

Tinman.Color

Default

{Color.Name: White}

Modulation color to apply to Model.Material.reflectivity of all read materials.


material

Type

Model.Material

Default

null

The material to use for the model root node.


unit

Type

Unit

Default

null

The unit of measure to use for the model root node.


texturePath

Type

path

Constraint

# != null

Default

<.>

The base directory to use for resolving relative texture file paths in the 3D model.

The given base directory can be relative; in this case, it will be resolved using the path of the directory that contains the model file. If there is no path info for the model data, the current filesystem directory is used instead.


transform

Type

Mat4

Default

{Mat4: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]}

Optional transformation matrix to apply to the model geometry.

The transformation matrix is applied as the last transformation step, before the custom post processors are invoked.


textureName

Type

Read.Name[]

Default

null

Specifies substitutions for texture names.


textureFile

Type

Read.File[]

Default

null

Specifies replacements for texture files.


modelNames

Type

string[]

Default

null

Names of the model nodes to keep, including their hierarchical structure.

If Read.Flags.ModelNames is present, this property is ignored.