File Format#

Ignis uses a flat hierarchy of entities specified in a single JSON file. You can include other supported formats within the externals block. The JSON format is not strict and allows comments in the style of // and /* */. Trailing commas are allowed to ease automatic generation of scene files as well.

The included diamond_scene.json is a good example for an Ignis scene.#
{
    "technique": {
        "type": "path",
        "max_depth": 64
    },
    "camera": {
        "type": "perspective",
        "fov": 40,
        "near_clip": 0.1,
        "far_clip": 100,
        "transform": [ -1,0,0,0, 0,1,0,0, 0,0,-1,3.85, 0,0,0,1 ]
    },
    "film": {
        "size": [1000, 1000]
    },
    "bsdfs": [
        {"type":"diffuse", "name": "mat-Light", "reflectance":[0,0,0]},
        {"type":"diffuse", "name": "mat-GrayWall", "reflectance":[0.8,0.8,0.8]},
        {"type":"diffuse", "name": "mat-ColoredWall", "reflectance":[0.106039, 0.195687, 0.800000]},
        {"type":"dielectric", "name": "mat-Diamond", "int_ior": 2.3}
    ],
    "shapes": [
        {"type":"rectangle", "name":"AreaLight", "flip_normals":true, "transform": [0, 0.084366, -0.053688, -0.7, 0, 0.053688, 0.084366, 0.1, 0.1, 0, 0, 0, 0, 0, 0, 1]},
        {"type":"external", "name":"Bottom", "filename":"meshes/Bottom.ply"},
        {"type":"external", "name":"Top", "filename":"meshes/Top.ply"},
        {"type":"external", "name":"Left", "filename":"meshes/Left.ply"},
        {"type":"external", "name":"Right", "filename":"meshes/Right.ply"},
        {"type":"external", "name":"Back", "filename":"meshes/Back.ply"},
        {"type":"external", "name":"Diamond", "filename":"meshes/Diamond.ply"}
    ],
    "entities": [
        {"name":"AreaLight", "shape":"AreaLight", "bsdf":"mat-Light"},
        {"name":"Bottom","shape":"Bottom", "bsdf":"mat-GrayWall"},
        {"name":"Top","shape":"Top", "bsdf":"mat-GrayWall"},
        {"name":"Left","shape":"Left", "bsdf":"mat-ColoredWall"},
        {"name":"Right","shape":"Right", "bsdf":"mat-ColoredWall"},
        {"name":"Back","shape":"Back", "bsdf":"mat-GrayWall"},
        {"name":"Diamond1","shape":"Diamond", "bsdf":"mat-Diamond"},
        {"name":"Diamond2","shape":"Diamond", "bsdf":"mat-Diamond", "transform":[{"translate":[0.6,0,0]}]},
        {"name":"Diamond3","shape":"Diamond", "bsdf":"mat-Diamond", "transform":[{"translate":[-0.6,0,0]}]}
    ],
    "lights": [
        {"type":"area", "name":"AreaLight", "entity":"AreaLight", "radiance":[100,100,100]}
    ]
}

Transformation#

A transformation can be specified for many objects in the scene.

{
    // ...
    "transform": TRANSFORM,
    //
}

The transformation can be specified as a 4x4 matrix:

{
    // ...
    "transform": [ m00, m01, m02, /* ... */, m31, m32, m33],
    //
}

as a 3x4 matrix with last row set to (0, 0, 0, 1) and a 3x3 matrix with also sets the last column (the translation) to (0, 0, 0).

Another way to describe transformation is by using simple operators. The operators will be applied at the order of their appearance from left to right inside the array. The last entry will be applied first to the incoming point.

{
    // ...
    "transform": [{ "translate": [X,Y,Z] }, { "rotate": [RX,RY,RZ] }, { "scale":[SX,SY,SZ] }, /* AND MORE */  ],
    //
}

The available operators are listed below.

Translate (translate)#

Specified with an array of three numbers.

{
    // ...
    "transform": [{ "translate": [X,Y,Z] }],
    //
}

Rotate (rotate)#

Specified with an array of three numbers given in degrees rotating around the respective euler axis.

{
    // ...
    "transform": [{ "rotate": [RX,RY,RZ] }],
    //
}

Each rotation around an axis is applied individually. The rotation above is equal to the following one:

{
    // ...
    "transform": [{ "rotate": [RX,0,0] }, { "rotate": [0,RY,0] }, { "rotate": [0,0,RZ] }],
    //
}

Rotate using a quaternion (qrotate)#

Specified with an array of four numbers representing a quaternion given as [w, x, y, z]. Have a look at your favorite math book to understand what that means.

{
    // ...
    "transform": [{ "qrotate": [RW,RX,RY,RZ] }],
    //
}

Scale (scale)#

Specified with an array of three numbers scaling the respective euler axis or as a single number scaling uniformly.

{
    // ...
    "transform": [{ "scale": [SX,SY,SZ] }, { "scale": S }],
    //
}

Lookat (lookat)#

Specified with multiple parameters. You are able to specify a direction instead of an explicit target location.

{
    // ...
    "transform": [{ "lookat": { "origin": [OX,OY,OZ], "up": [UX,UY,UZ], "target": [TX,TY,TZ], /* or */ "direction": [DX,DY,DZ] } }],
    //
}

Matrix (matrix)#

Specifies a matrix of the size 4x4, 3x4 or 3x3 to be applied to the full transformation.

{
    // ...
    "transform": [{ "matrix": [m00, m01, m02, /*...*/, m31, m32, m33] }],
    //
}