YAML Raytracer - greati/omg GitHub Wiki

YAML omg Raytracer

This document describes the YAML description of the omg raytracer.

A quick-start example

raytracer:
    camera:
        width: 800
        height: 600
        position: [0.0, 0.0, 0.0]       
        target: [0.0, 0.0, -10.0]       
        up: [0.0, 1.0, 1.0]    
        fdist: 1.0             
        v_angle: 45.0
    background:
        type: solid
        color: [255, 0, 0]
    scene:
        materials:
            - type: flat
              label: redish
              color: [255, 0, 0]
        objects:
            - type: sphere
              center: [0, 0, 2]
              radius: 0.4
              material: redish
    settings:
        integrators:
            - type: flat
            - type: normal_map

Syntax

raytracer

This is the main section of the description. It has all top level elements to produce a 3D image, like camera and background. The quick-start example is a good view of this construction.

Attributes

  • camera
  • background
  • scene
  • settings

camera

This represents a camera.

Attributes

  • type: [orthographic | perspective]
  • width: the image width
  • height: the image height
  • position: camera location
  • target: direction to which the camera is looking
  • up: vector normal to the top of the camera
  • view_normal: the normal vector with respect to the view plane (for oblique views)

Type-specific attributes

  • orthographic
    • vpdims: l r b t
  • perspective
    • defining the field of view
      • fdist: focal distance
      • v_angle: vertical angle of view
      • aspect_ratio: the aspect ratio, otherwise computed as width/height
    • defining the view port
      • fdist: focal distance
      • vpdims: l r b t

background

The scene background.

Attributes

  • type: [solid | gradient]

Type-specific attributes

  • solid
    • color
  • gradient
    • colors: up to 4 colors (more than that will be ignored), given clock-wise from the top left corner. Less than 4 colors will make the last one to be repeated in the remaining corners.

scene

The scene elements.

lights

  • intensity: light color, 3D vector in [0,255]
  • type: [point, spot, directional]
Type-specific attributes
  • point
    • position: light position, 3D vector
  • spot
    • position: light position, 3D vector
    • point_at: to where the source is pointing, 3D vector
    • cutoff: main focus angle, float
    • falloff: total angle, float
  • directional
    • direction: light direction

materials

  • type: [flat, blinn]
Type-specific attributes
  • flat
    • color: the material color
  • blinn
    • ambient: influence of the ambient light, 3D vector in [0,1]
    • diffuse: influence of diffuse light, 3D vector in [0,1]
    • specular: influence of specular light, 3D vector in [0,1]
    • glossiness: plastic aspect, 3D vector in [0,1]
    • mirror: how much this material reflects light (mirror-like effect), 3D vector in [0,1]

objects

  • type: [sphere, triangle_mesh, aggregate]
  • material: a label of some declared material
  • transform: a list of transforms to be applied in the object (check misc elements for details)
Type-specific attributes
  • sphere
    • radius: radius (float)
    • center: a vector
  • triangle_mesh
    • obj_file: o .obj file having a mesh description
    • clockwise: if triangles specified in clockwise orientation
    • compute_normals: force the computation of normals (applicable for obj_file specification)
    • ntriangles: number of triangles
    • indices: 2*ntriangles indices for the vertices of each triangle
    • vertices: list of vertices
    • normals: list of vertex normals
  • aggregate
    • structure: a description of the acceleration structure (see below)
    • objects: a list of objects
    • label: a label

settings

Running settings of the raytracer.

integrators

The integrators to be run over the description. At least the following attributes must be specified:

  • type: [flat | normal_map | depth | blinn]
Type-specific attributes
  • depth:
    • near_color: the color of the nearest objects
    • far_color: the color of the fartest objects

Misc elements

structure

  • type: [bvh, list]

type-specific attributes

  • bvh
    • max_prim_nodes: the maximum number of primitives in a leaf
    • split_method: [middle, equal_counts]
  • list

transform

  • type: [scale, rotation_x, rotation_y, rotation_z, rotation, translation]

type-specific attributes

  • scale
    • xyz: scale factors in each axis
  • rotation_x
    • angle
  • rotation_y
    • angle
  • rotation_z
    • angle
  • rotation
    • axis: rotation axis
    • angle
  • translation
    • delta: translation delta in each axis