Skip to content

How To Use The JSON Interface

Valtteri Koskivuori edited this page May 31, 2018 · 16 revisions

A brief overview on using the JSON scene definition format.

Broken down into sections, as they can be found in the default scene.json At this time, you should provide all the configuration options in the JSON until I've implemented sane defaults to override instead.

version

Leave at 1.0. Just futureproofing in case I add features later that are not backwards-compatible.

renderer

  • threadCount - Amount of threads to render with. 0 defaults to system logical core count.
  • sampleCount - Amount of samples to render. More samples -> Smoother image with less noise.
  • antialiasing - Enable or disable antialiasing. (Reduces jagged edges)
  • newRenderer - Enable or disable the new recursive (but buggy!) rendering algorithm.
  • tileWidth - Width of the tiles the image is quantised into.
  • tileHeight - Height of the tiles the image is quantised into.
  • tileOrder - Order the tiles are rendered in. Doesn't affect render time, mostly just helps with debugging when you can decide roughly which part of the image is rendered first. Available options are: normal, random, topToBottom, fromMiddle, toMiddle.

display

  • isFullscreen - Enable or disable fullscreen mode for SDL render preview window
  • isBorderless - Enable or disable window borders for SDL render preview window.
  • windowScale - Adjust the size of the SDL render preview window. This is a multiplier from 0.0->1.0 (i.e. 0.5 is one half the size of 1.0)

camera

  • FOV - Camera field of vision. The smaller the value, the narrower the field of vision.
  • aperture - Aperture of the camera. So far there is no 'focal plane', so everything just sort of becomes blurry if this is above 0.0
  • transforms - Array of transforms for the camera. (For now, make sure the translate transform is first in this list!)

scene

  • filePath - The file path in which the output image will be written to, relative to the working directory (Usually the project root)
  • fileName - Name prefix of the output image file
  • count - The number postfix of the image file
  • width - Width of the image in pixels
  • height - Height of the image in pixels
  • fileType - File type of the output image file. Available options are: png and bmp (Stick to PNG as it's losslessly compressed)
  • ambientColor - This color to every pixel in the final image where the ray didn't hit anything within 20k distance units. It's a dark turquoise by default.
  • contrast - Currently unused
  • bounces - The amount of times a ray can bounce in the scene. This determines reflection depth.
  • areaLights - Enable or disable approximated area lights (And thus, soft shadows)
  • inputFilePath - The file path from which the source files (OBJ meshes, MTL files) are to be retrieved from, relative to the working directory (Usually the project root)
  • lights - Array of lights to be placed in the scene
  • spheres - Array of spheres to be placed in the scene
  • OBJs - Array of 3D models to be placed in the scene
Clone this wiki locally