Geometry
Some nodes in Loki3D create or modify Geometry data. Geometry defines the shape of the objects in Loki3D, from cubes to castles and monsters.
In Loki3D, geometry is created and modified with geometry nodes. The geometry data structure provides a consistent definition for all of the types of geometry that can be created in Loki3D. This allows geometry nodes to all work regardless of the type of geometry it is. A twist deformer can be applied to a sphere or a monster, or even a particle system, because the twist deformer only cares about the point positions of the geometry.
Data Structures
Understanding how Loki3D represents geometry is useful for working with geometry nodes, as well as creating your own nodes. Geometry is a very flexible data structure, allowing for hierarchies of shapes, transformations, materials, and instances. A Geometry structure can render a thousand spheres, whith only one definition of that sphere mesh. A Geometry structure can also contain the entire contents of a GLTF scene. Or a single point.
There are two data types for geometry: Geometry, and GeometryData. The top level object is always a Geometry object.
Geometry
A Geometry object is the container for all geometry. It has a list of elements, each of which can be another Geometry object, or a GeometryData object. A Geometry object can also have an optional transformation matrix, material, and list of instances.
GeometryData
GeometryData is the defenition of a geometry shape. GeometryData can also have a transformation and material. GeometryData defines the geometry shape with the following properties:
Instances
Geometry objects can have a list of instances. An instance is a transformation matrix, and applies to all of the elements of the Geometry structure. Because an element of a Geometry structure can be another Geometry structure, an instance can itself contain other instances. Because of this, complex geometry definitions can be created using very little actual geometry data.
In the example of the plane and the instanced spheres, there are only two GeometryData objects, a plane and a sphere, which can be drawn any number of times with instances.