Skip to content

Primitives

Lucas Dupont edited this page May 14, 2023 · 2 revisions

This page specifies all the parameters necessary for the primitives

Sphere

sphere = (
        {
            position = {x = 0.0; y = -101.0; z = -3.0};
            radius = 100.0;
            material = {
                type = "lambertian";
                color = {r = 202; g = 11; b = 11}; # big red
            };
        }
)
  • position: Position of object
  • radius: Sphere radius
  • material: Define of sphere material, see materials page for more informations

Plan

plan = (
        {
            position = {x = 0.0; y = -1.0; z = 0.0};
            normal = {x = 0.0; y = 1.0; z = 0.0};
            material = {
                type = "reflective";
                reflectivity = 0.8;
                roughness = 0.01;
                color = {r = 118; g = 118; b = 118};
            };
        }
)
  • position: Position of object
  • normal: Plan normal
  • material: Define of sphere material, see materials page for more informations

Triangle

triangle = (
        {
            vertice1 = {x = 1.0; y = 1.0; z = -3.0};
            vertice2 = {x = -1.0; y = 1.0; z = -3.0};
            vertice3 = {x = -1.0; y = 1.0; z = 0.0};
            material = {
                type = "lambertian";
                color = {r = 150; g = 150; b = 150};
            };
        }
)
  • vertice1: First position of triangle
  • vertice2: Second position of triangle
  • vertice3: Third position of triangle
  • material: Define of sphere material, see materials page for more informations

Quad

quad = (
        {
            vertice1 = {x = 1.0; y = 1.0; z = -3.0};
            vertice2 = {x = -1.0; y = 1.0; z = -3.0};
            vertice3 = {x = -1.0; y = 1.0; z = 0.0};
            vertice4 = {x = 1.0; y = 1.0; z = 0.0};
            material = {
                type = "lambertian";
                color = {r = 150; g = 150; b = 150};
            };
        }
)
  • vertice1: First position of quad
  • vertice2: Second position of quad
  • vertice3: Third position of quad
  • vertice4: Fourth position of quad
  • material: Define of sphere material, see materials page for more informations

Cone

cone = (
        {
            position = {x = 0.0; y = 0.0; z = -5.0};
            rotation = {x = 0.0; y = 0.0; z = -90.0};
            direction = {x = 0.0; y = 1.0; z = 0.0};
            radius = 1.0;
            angle = 45.0;
            material = {
                type = "lambertian";
                color = {r = 11; g = 202; b = 202}; # big blue
            };
        }
)
  • position: Cone position
  • rotation: Cone rotation
  • direction: Cone direction
  • radius: Cone base radius
  • angle: Cone angle
  • material: Define of sphere material, see materials page for more informations

Cylinder

cylinder = (
        {
            position = {x = 0.0; y = 0.0; z = -5.0};
            rotation = {x = 0.0; y = 0.0; z = 0.0};
            direction = {x = 0.0; y = 1.0; z = 0.0};
            radius = 1.0;
            material = {
                type = "lambertian";
                color = {r = 11; g = 202; b = 202};
            };
        }
)
  • position: Cylinder position
  • rotation: Cylinder rotation
  • direction: Cylinder direction
  • radius: Cylinder base radius
  • material: Define of sphere material, see materials page for more informations

Limited cone

cone = (
        {
            position = {x = 0.0; y = 0.0; z = -5.0};
            rotation = {x = 0.0; y = 0.0; z = -90.0};
            direction = {x = 0.0; y = 1.0; z = 0.0};
            radius = 1.0;
            angle = 45.0;
            height = 2.0;
            material = {
                type = "lambertian";
                color = {r = 11; g = 202; b = 202}; # big blue
            };
        }
)
  • position: Cone position
  • rotation: Cone rotation
  • direction: Cone direction
  • radius: Cone base radius
  • angle: Cone angle
  • height: Cone height
  • material: Define of sphere material, see materials page for more informations

Limited Cylinder

cylinder = (
        {
            position = {x = 0.0; y = 0.0; z = -5.0};
            rotation = {x = 0.0; y = 0.0; z = 0.0};
            direction = {x = 0.0; y = 1.0; z = 0.0};
            radius = 1.0;
            height = 2.0;
            material = {
                type = "lambertian";
                color = {r = 11; g = 202; b = 202};
            };
        }
)
  • position: Cylinder position
  • rotation: Cylinder rotation
  • direction: Cylinder direction
  • radius: Cylinder base radius
  • height: Cylinder height
  • material: Define of sphere material, see materials page for more informations

OBJ

Raytracer can also load OBJ, material cannot be load in this version but it still needs to be clarified

obj = (
        {
            path = "obj/facet_mask.obj";
            position = {x = 0.0; y = -1.0; z = -2.0};
            rotation = {x = 0.0; y = 40.0; z = 0.0};
            scale = {x = 0.3; y = 0.3; z = 0.3};
            material = {
                type = "lambertian";
                color = {r = 255; g = 255; b = 255};
            };
        }
)
  • path: Path to .obj to load
  • position: OBJ position
  • rotation: OBJ rotation
  • scale: OBJ scale
  • material: Soon
Clone this wiki locally