Skip to content

Latest commit

 

History

History
131 lines (97 loc) · 4.12 KB

Config.md

File metadata and controls

131 lines (97 loc) · 4.12 KB

Configuration

Rendering can be configured from Json files. Only the configuration file neet to be passed to the programm as a parameter.

Rendering

  • scene (string): The path to the scene.json configuration file.
    • Default: "apps/scene.json".
  • filename (string): The output filename. Supported extension: Only ppm.
    • Default: "render/render.ppm"
    • Special values:
      • "console": print in the console.
  • max_bounces (int): Maximum bounce that a ray can make before it is considered to be coming from nowhere.
    • Default: 50
    • Range: from 0 to infinity
  • view_distance (float): The maximum distance that a ray can travel before it is considered to be coming from infinity, can allow a kind of fog.
    • Default: 0
    • Range: from 0 to infinity
    • Special values:
      • 0: set view distance to infinity. Each surface will be returned according to the resolution.
  • debug (Optional: bool): Debug mode (verbose).
  • filters (Json): A json object that contains the different filters.

Filters

These fields are to be filled in the filters object.

  • antialiasing (Json):

    • enable (bool): enable filter.
    • sample_per_pixel ('int'): number of rays averaged on a pixel.
      • Default: 100
      • Range: from 1 to infinty
  • gamma (Json):

    • enable (bool): enable filter.
    • value (float): gamma value
      • Default: 2.0
      • Range: from epsilon to infinity
      • Special values:
        • 2.0: Computed with square root instead of power.

Scene

  • camera (Json):

    • origin (Point3D<double>): eye position.
      • Default: [0, 0, 0]
    • height (int): height ratio.
      • Default: 4
      • Range: from 0 to infinity
    • width (int): width ratio.
      • Default: 6
      • Range: from 0 to infinity
    • focus_dist (double): the focus distance of the camera, i.e. the focus distance of the virtual lens.
      • Default: 1
    • aperture (double): the diameter of the virtual lens, i.e. it controls the amount of light that can be catch.
      • Default: 2
      • Range: from 0 (no defocus blur) to infinity
    • view_dir (Vect3D<double>): the direction of view of the camera.
      • Default: [0, 0, 1] (along z axis)
  • background (string): The style of the background.

    • Values : "day" | "night" | "dark"
  • materials (Json[]): A list of materials.

  • objects (Json[]): A list of objects.

Materials

Each material contains a name field that allows it to be referenced by objects. The following fields are to be put in a json object.

  • name (string): reference name.
  • type (string): material type.
    • Values: "matte" | "metal" | "light" | "dielectric"
  • coeffs (Vect3D<double>): Reflection coefficients
    • Range: from 0 to 1
    • Exemple: [1, 0, 0] is a red object

Some materials needs additional fields:

  • Metal:

    • fuzziness (double): valeur de flou
      • Range: from 0 to 1
  • Dielectric:

    • index_refraction (double): refraction index of material

Objects

The following fields are to be put in a json object.

  • type (string): object type.
    • Values: "sphere" | "plane" | "cuboid" | "disk" | "triangle"
    • Incoming values : "object" | "cylinder"
  • material (string): the reference name of the material

All objects needs additional fields:

  • Sphere:

    • origin (Point3D<double>): center of the sphere
    • radius (double): radius of the sphere
  • Cuboid:

    • origin (Point3D<double>): center of the cube or corner (cf mode)
    • mode (string): change the origin mode
      • Values: "corner" | "center"
    • vectx (Vect3D<double>): The bases vectors of the cuboid
    • vecty (Vect3D<double>):
    • vectz (Vect3D<double>):
  • Plane:

    • origin (Point3D<double>): center of the plane or corner (cf mode)
    • mode (string): change the origin mode
      • Values: "corner" | "center"
    • vectx (Vect3D<double>): The bases vectors of the plane
    • vecty (Vect3D<double>):
  • Disk:

    • origin (Point3D<double>): center of the circle
    • radius (Vect3D<double>): radius of the cicle
    • normal_dir (Vect3D<double>): normal vector of the circle
  • Triangle:

    • vertices (Json<Point3D<double>>[3]): a list with the 3 vertices