Version

A geometry resource file uses the ".geo" extension. It can be loaded as a Geometry using LoadGeometry and created by using SaveGeometry.

The geometry is stored as structured document in the resource file. This document can be saved as JSON, XML or binary (see Resource file format).

Note: Examples are provided as JSON on this page.

Document structure

A geometry document must contain a single root scope named Geometry containing the following required child scopes:

Mandatory scopes

  • Materials: A list of materials referenced by the geometry polygons. Contains a Material child scope per entry, each Material scope holds a Name value containing the path to the material resource file.
{
        "Materials": {
            "Material": {
                "Name": "@core/materials/default.mat"
            },...
        }
}
  • Vertex: A list of vertices stored in Vector scopes. A Vector scope holds three x, y and z floating point values.
{
    "Vertex": {
        "Vector": {
            "x": -0.5,
            "y": 0.5,
            "z": 0.5
        },...
    }
}
  • Polygon: A list of Shape scopes containing the number of vertices of the polygon as Size and an index into the Materials table as Material.
{
    "Polygon": {
        "Count": 6,
        "Shape": {
            "Size": 4,
            "Material": 0
        },...
    }
}
  • PrimitiveBinding: Sequential list of indexes into the Vertex list for each polygon. The size of this list is the sum of the vertex count of all polygons in the geometry.
{
    "PrimitiveBinding": {
        "Index": {
            "value": 0
        },
        "Index": {
            "value": 1
        },
        "Index": {
            "value": 2
        },
        "Index": {
            "value": 3
        },...
    },
}

Optional scopes

  • VertexNormal: A list of vertex normals stored in Vector scopes. A Vector scope holds three x, y and z floating point values.

    Note: These values are stored per vertex of each polygon to allow discontinuous values between polygons sharing the same vertex.

{
    "VertexNormal": {
        "Vector": {
            "x": -0.0,
            "y": 1.0,
            "z": 0.0
        },...
    }
}
  • VertexTangentFrame: A list of tangent frames stored in Frame scopes. A Frame scope holds two vector scopes T and B specifying the frame tangent and binormal vectors.

    Note: These values are stored per vertex of each polygon to allow discontinuous values between polygons sharing the same vertex.

{
    "VertexTangentFrame": {
        "Frame": {
            "T": {
                "x": -1.0,
                "y": 0.0,
                "z": -0.0
            },
            "B": {
                "x": 0.0,
                "y": -0.0,
                "z": 1.0
            }
        },...
    }
}
  • PrimitiveNormal: A list of polygon normals stored in Vector scopes.
{
    "PrimitiveNormal": {
        "Vector": {
            "x": -0.0,
            "y": 1.0,
            "z": 0.0
        },...
    }
}
  • UV: A list of UV channels for the geometry stored in Set scopes. A Set holds a list of UV scopes containing two floating point UV coordinates as x and y.
{
    "UV": {
        "Count": 1,
        "Set": {
            "UV": {
                "x": 0.5,
                "y": 0.0
            },...
        }
    }
}

Complete example

Cube geometry resource saved as a JSON document.

{
    "Geometry": {
        "Polygon": {
            "Count": 6,
            "Shape": {
                "Size": 4
            },
            "Shape": {
                "Size": 4
            },
            "Shape": {
                "Size": 4
            },
            "Shape": {
                "Size": 4
            },
            "Shape": {
                "Size": 4
            },
            "Shape": {
                "Size": 4
            }
        },
        "Vertex": {
            "Vector": {
                "x": -0.5,
                "y": 0.5,
                "z": 0.5
            },
            "Vector": {
                "x": 0.5,
                "y": 0.5,
                "z": 0.5
            },
            "Vector": {
                "x": 0.5,
                "y": 0.5,
                "z": -0.5
            },
            "Vector": {
                "x": -0.5,
                "y": 0.5,
                "z": -0.5
            },
            "Vector": {
                "x": -0.5,
                "y": -0.5,
                "z": 0.5
            },
            "Vector": {
                "x": 0.5,
                "y": -0.5,
                "z": 0.5
            },
            "Vector": {
                "x": 0.5,
                "y": -0.5,
                "z": -0.5
            },
            "Vector": {
                "x": -0.5,
                "y": -0.5,
                "z": -0.5
            }
        },
        "PrimitiveBinding": {
            "Index": {
                "value": 0
            },
            "Index": {
                "value": 1
            },
            "Index": {
                "value": 2
            },
            "Index": {
                "value": 3
            },
            "Index": {
                "value": 3
            },
            "Index": {
                "value": 2
            },
            "Index": {
                "value": 6
            },
            "Index": {
                "value": 7
            },
            "Index": {
                "value": 7
            },
            "Index": {
                "value": 6
            },
            "Index": {
                "value": 5
            },
            "Index": {
                "value": 4
            },
            "Index": {
                "value": 4
            },
            "Index": {
                "value": 5
            },
            "Index": {
                "value": 1
            },
            "Index": {
                "value": 0
            },
            "Index": {
                "value": 2
            },
            "Index": {
                "value": 1
            },
            "Index": {
                "value": 5
            },
            "Index": {
                "value": 6
            },
            "Index": {
                "value": 0
            },
            "Index": {
                "value": 3
            },
            "Index": {
                "value": 7
            },
            "Index": {
                "value": 4
            }
        },
        "VertexNormal": {
            "Vector": {
                "x": -0.0,
                "y": 1.0,
                "z": 0.0
            },
            "Vector": {
                "x": -0.0,
                "y": 1.0,
                "z": 0.0
            },
            "Vector": {
                "x": -0.0,
                "y": 1.0,
                "z": 0.0
            },
            "Vector": {
                "x": -0.0,
                "y": 1.0,
                "z": 0.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": -1.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": -1.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": -1.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": -1.0
            },
            "Vector": {
                "x": 0.0,
                "y": -1.0,
                "z": 0.0
            },
            "Vector": {
                "x": 0.0,
                "y": -1.0,
                "z": 0.0
            },
            "Vector": {
                "x": 0.0,
                "y": -1.0,
                "z": 0.0
            },
            "Vector": {
                "x": 0.0,
                "y": -1.0,
                "z": 0.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": 1.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": 1.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": 1.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": 1.0
            },
            "Vector": {
                "x": 1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": 1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": 1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": 1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": -1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": -1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": -1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": -1.0,
                "y": 0.0,
                "z": -0.0
            }
        },
        "VertexTangentFrame": {
            "Frame": {
                "T": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 1.0,
                    "y": -0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 1.0,
                    "y": -0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 1.0,
                    "y": -0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 1.0,
                    "y": -0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": 1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 1.0,
                    "y": 0.0,
                    "z": -0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": -0.0
                },
                "B": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": -0.0
                },
                "B": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": -0.0
                },
                "B": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": -0.0
                },
                "B": {
                    "x": -1.0,
                    "y": 0.0,
                    "z": 0.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": -0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": 0.0,
                    "z": 1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": -1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": -1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": -1.0
                }
            },
            "Frame": {
                "T": {
                    "x": 0.0,
                    "y": 1.0,
                    "z": 0.0
                },
                "B": {
                    "x": 0.0,
                    "y": -0.0,
                    "z": -1.0
                }
            }
        },
        "PrimitiveNormal": {
            "Vector": {
                "x": -0.0,
                "y": 1.0,
                "z": 0.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": -1.0
            },
            "Vector": {
                "x": 0.0,
                "y": -1.0,
                "z": 0.0
            },
            "Vector": {
                "x": 0.0,
                "y": 0.0,
                "z": 1.0
            },
            "Vector": {
                "x": 1.0,
                "y": 0.0,
                "z": -0.0
            },
            "Vector": {
                "x": -1.0,
                "y": 0.0,
                "z": -0.0
            }
        },
        "UV": {
            "Count": 1,
            "Set": {
                "UV": {
                    "x": 0.5,
                    "y": 0.0
                },
                "UV": {
                    "x": 0.5,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.25,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.25,
                    "y": 0.0
                },
                "UV": {
                    "x": 0.0,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.25,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.25,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.0,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.25,
                    "y": 1.0
                },
                "UV": {
                    "x": 0.25,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.5,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.5,
                    "y": 1.0
                },
                "UV": {
                    "x": 0.75,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.5,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.5,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.75,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.25,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.5,
                    "y": 0.3301
                },
                "UV": {
                    "x": 0.5,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.25,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.75,
                    "y": 0.3301
                },
                "UV": {
                    "x": 1.0,
                    "y": 0.3301
                },
                "UV": {
                    "x": 1.0,
                    "y": 0.6601
                },
                "UV": {
                    "x": 0.75,
                    "y": 0.6601
                }
            }
        },
        "Materials": {
            "Material": {
                "Name": "@core/materials/default.mat"
            }
        }
    }
}