The following table lists the format of most of the resource types used by Harfang during development.

Type Format
Scene Document
Geometry Document (see Geometry document structure)
Material Document
Shader & SurfaceShader Custom JSON like format (see Shader and Surface shader).
Texture Development file format (any supported picture file format such as tga, jpg, psd, etc...)


When packing your project for distribution most resource format will change to a format that is optimized for the target platform. These formats are not suited for development and usually not portable.

Document format

Complex types are serialized from the reflection layer using the DocumentReader and DocumentWriter interfaces.

The document system supports three different storage backend: XML, JSON and binary.

Documents can be read from any supported storage format transparently. For convenience, human-friendly formats are selected whenever possible. However, due to the potential size and performance problems text-based formats can cause geometries are usually exported through the binary backend.

Converting between document format

Converting from a document backend to another is easy. The following code converts a document from XML to binary.

import harfang as hg

# provide direct access to the file system

# input/output format is detected from the file extension
geo = hg.LoadCoreGeometry("d:/geometry.xml")
hg.SaveCoreGeometry("d:/geometry.bin", geo)

Note: Changing the document format of large resources from binary to XML or JSON might use more memory and cause performance issues.