ModelFormat
Description
- Derived from
-
FileFormat abstract
- Extended by
-
AssimpModelFormat sealed
OpenFlightModelFormat sealed
The supported 3D model file formats.
Public / Constants
Any
The file format is unknown and will be determined automatically.
Use IFileFormat.Next to walk through all registered formats.
CMH
The CMH model file format ('Compiled Model Hierarchy', proprietary):
https://manual.tinman3d.com/STABLE-PREVIEW/file-formats.html#_compiled_model_hierarchy_cmh
Write supported: yes
IANA media type: none
File extensions: .cmh
Prefix sequence: yes
This file format is self-contained, i.e. all resources are embedded in the model file. Lazy loading is applied for all model geometry objects and all model texture resources.
The ReadModel method of this file format returns a IModelReader object that ignores all options (see IModelReader.Options).
The WriteModel method of this file format always returns a IModelWriterCmh object.
This model format supports ModelFlags.ComplexGeometry and IModel.Bounds.
GLB
The GL Transmission Format Version 2.0 - Binary
https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html
glTF Sample Viewer
https://github.khronos.org/glTF-Sample-Viewer-Release/
Write supported: no
IANA media type: model/gltf-binary
File extensions: .glb
Prefix sequence: no
The binary JSON .glb
file format may be self-contained, i.e. all resources are embedded in the model file. Lazy loading is applied for all model geometry objects and all model texture resources. These glTF extensions are supported:
-
KHR_materials_emissive_strength
-
KHR_materials_ior
-
KHR_materials_pbrSpecularGlossiness
-
KHR_materials_specular
-
KHR_materials_transmission
-
KHR_materials_unlit
The following glTF features are not supported:
-
3.7.3. Skins
-
3.10. Cameras
-
3.11. Animations
The ReadModel method of this file format returns a IModelReader object that supports the following options:
GLTF
The GL Transmission Format Version 2.0 - JSON
https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html
glTF Sample Viewer
https://github.khronos.org/glTF-Sample-Viewer-Release/
Write supported: no
IANA media type: model/gltf+json
File extensions: .gltf
Prefix sequence: no
The JSON .gltf
file format is not necessarily self-contained, i.e. some resources may be present as external files, which are referenced by the model file. Lazy loading is applied for all model geometry objects and all model texture resources. These glTF extensions are supported:
-
KHR_materials_emissive_strength
-
KHR_materials_ior
-
KHR_materials_pbrSpecularGlossiness
-
KHR_materials_specular
-
KHR_materials_transmission
-
KHR_materials_unlit
The following glTF features are not supported:
-
3.7.3. Skins
-
3.10. Cameras
-
3.11. Animations
The ReadModel method of this file format returns a IModelReader object that supports the following options:
LAS
The LAS model file format.
Write supported: no
IANA media type: application/vnd.las
File extensions: .las
Prefix sequence: yes
The ReadModel method of this file format returns a IModelReader object that supports the following options:
OBJ
The OBJ model file format.
Write supported: yes
IANA media type: model/obj
File extensions: .obj
Prefix sequence: no
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, d = 1 - Tr) -
Tr V
(material transparency, Tr = 1 - d) -
Ni V
(index of refraction) -
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) -
map_Tr NAME
(transparency texture map)
When writing *.obj
files, the following information will be lost:
-
IModel.ChildAt, child models will be ignored.
-
IModel.Flags, will become ModelFlags.None.
-
IModel.Name, will become the last name part (without suffix) of the file path.
-
IModel.Unit, will become ModelReaderOptions.RootUnit.
-
IModelPart.Flags, will become ModelPartFlags.FrontFaces.
-
IModelPart.Material, will become ModelReaderOptions.RootMaterial.
-
IModelGeometry.ReadVertices except the Semantic.Position, Semantic.TextureCoords, Semantic.Normal and Semantic.Texture vertex data arrays, other vertex arrays will be ignored.
-
IModelGeometry.InstanceBuffer, will become
null
.
The ReadModel method of this file format returns a IModelReader object that supports the following options:
Public / Methods
ReadModel
Reads the given 3D model.
- IOException
-
If an I/O error has occurred while opening the 3D model data.
- ValidatingException
-
If a validation error has occurred on data in or the returned 3D model reader.
- See also
WriteModel
Writes a 3D model to the given file.
- IOException
-
If an I/O error has occurred while writing the 3D model data.
- See also
Protected / Methods
CannotWrite
Creates a new instance of IOException for the case when a file format cannot be used for writing a 3D model.
DoReadModel
Reads the given 3D model.
- IOException
-
If an I/O error has occurred while opening the 3D model.
DoWriteModel
Writes a 3D model to the given file.
- IOException
-
If an I/O error has occurred while writing the 3D model.
- IOException
-
If this model format does not support writing (i.e. IFileFormat.CanWrite would return
false
).