Skip to content

Config file

Lucas Iglesia edited this page May 14, 2023 · 3 revisions

First the config of the camera:

camera : {

lookFrom = { x = 178.0; y = 278.0; z = -700.0; }; # Position of the camera

lookAt = { x = 278.0; y = 278.0; z = 0.0; }; # Point the camera is looking at

up = { x = 0.0; y = 1.0; z = 0.0; }; # Up vector of the camera

ratio = {width = 16.0; height = 16.0;}; # Ratio of the image

fov = 40.0; # Field of view of the camera

focus = 10.0; # Field of view of the camera

aperture = 0.1; # Aperture of the camera

};

Here you can change the settings of the camera

Then the config of the image:

image : {

height = 1000; # Height of the image

samples = 100; # Number of samples per pixel

maxDepth = 50; # Maximum depth of the ray

fps = 20; # Number of frames per second

time = 4; # Number of seconds of the animation

type = "gif"; # Type of the image

background = { x = 0.2, y = 0.2, z = 0.4 }; # Background color of the image

multithreading = false;

loading = false;

};

Here you choose the file settings, which will define the size of the image but also its quality.

You can change the format of the image: ppm if you want an image and gif if you want a video

You can also decide if you want your image to be generated using multithreading or if you want to have the image load in real time

Finally the config of the scene

First of all you define the material of your objects like this

material: { miroir = {type = "metal"; albedo = {x = 0.9; y = 0.9; z = 0.9}; fuzz = 0.0;};

metal = {type = "metal"; albedo = {x = 0.7; y = 0.6; z = 0.5}; fuzz = 0.4;};

red = {type = "lambertian"; albedo = {x = 0.65; y = 0.05; z = 0.05}};

pink = {type = "lambertian"; albedo = {x = 0.65; y = 0.05; z = 0.65}};

green = {type = "lambertian"; albedo = {x = 0.12; y = 0.45; z = 0.15}};

white = {type = "lambertian"; albedo = {x = 0.73; y = 0.73; z = 0.73}};

light = {type = "diffuseLight"; color = {x = 10.0; y = 10.0; z = 10.0};};

yellow = {type = "lambertian"; albedo = {x = 0.65; y = 0.65; z = 0.05}};

blue = {type = "lambertian"; albedo = {x = 0.05; y = 0.35; z = 0.65}};

}

There are only 3 types of materials, lambertian and metal which doesn't emit light and diffuseLight which emit light

You can then define the primitives objects of your scene

primitives: {

sphere = (
    { center = {x = 250.0; y = 100.0; z = 250.0;}; r = 100.0; material="metal"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 3.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}}
)

rectangle = (
    { axis = "YZ"; a = 0.0; b = 555.0; c = 0.0; d = 555.0; k = 555.0;   material = "miroir"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}},
    { axis = "YZ"; a = 0.0; b = 555.0; c = 0.0; d = 555.0; k = 0.0;     material = "red";   rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}},
    { axis = "XY"; a = 0.0; b = 555.0; c = 0.0; d = 555.0; k = 555.0;   material = "yellow"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}},
    { axis = "XY"; a = 0.0; b = 555.0; c = 0.0; d = 555.0; k = 0.0;   material = "green"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}},
    { axis = "XZ"; a = 0.0; b = 555.0; c = 0.0; d = 555.0; k = 0.0;     material = "white"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}},
    { axis = "XZ"; a = 0.0; b = 555.0; c = 0.0; d = 555.0; k = 555.0;   material = "blue"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}}
)

cylinder = (
    { center = {x = 400.0; y = 0.0; z = 300.0;}; radius = 20.0; material = "metal"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}}
)

limitedCylinder = (
    { center = {x = 300.0; y = 0.0; z = 300.0;}; radius = 20.0; height = 500.0; material = "metal"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}}
)

cone = (
    { center = {x = -10.0; y = 300.0; z = 500.0;}; angle = 2.0; material = "metal"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}}
)

triangle = (
    { A = {x = 555.0; y = 0.0; z = 555.0;}; B = {x = 0.0; y = 555.0; z = 555.0;}; C = {x = 0.0; y = 0.0; z = 0.0;}; material = "miroir"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;}; translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}}
)

}

You can define 6 types of primitives, sphere, rectangle, cylinder, limitedCylinder, cone and triangle. Each has its own specificities but each require a material. You can also add transformations to those primitives like translation or rotation

Finally you can add different objects to your scene:

objects: {

ambientLight = { x = 0.0, y = 0.0, z = 0.0 }
directionalLight = (
    { axis = "XZ"; a = 500.0; b = 1000.0; c = 500.0; d = 1000.0; k = 1500.0; material = "sun"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;};  translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}},
    { axis = "XZ"; a = -50.0; b = 50.0; c = -50.0; d = 50.0; k = 185.0; material = "sun"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;};  translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 5.0; z = 0.0;}}
)
box = (
    { max = {x = 50.0; y = 0.0; z = 500.0;}; min = {x = 150.0; y = 300.0; z = 350.0;}; material = "miroir"; rotation = {x = 0.0; y = 0.0; z = 0.0;}; move = {x = 0.0; y = 0.0; z = 0.0;};  translation = {x = 0.0; y = 0.0; z = 0.0;}; turn = {x = 0.0; y = 0.0; z = 0.0;}}
)

}

Here you can chose the color of the ambientLight which is a light that light up the entire scene You can also add directionalLights and boxes which can also translate or rotate.