Skip to content

argha0x/glTrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scene File Example :
    $ mv input/input.json.example input/input.json
Compile :
    project_path>$ g++ src/main.cpp -std=c++11 -lglfw -lGL -lm -lXrandr -lXi -lX11 -lXxf86vm -lpthread -lGLEW
Run :
    ./a.out ./input/input.json
Rendered Output

screenshot from 2019-02-11 03 15 03

Example Input 1 :
{
    "height" : 400,
    "width" : 700,
    "camera" :{
        "position" : [3, 1.5, -20],
        "lookat" : [8, 6, 0]
    },
    "ambient_light" : 0.2,
    "scene" : [
        {
            "Sphere" : {
                "radius" : 1,
                "color" : [0.0, 1.0, 0.0, 0.5],
                "position" : [0, 0, 1]
            }
        },
        {
            "Sphere" : {
                "radius" : 2,
                "color" : [0,0,0,1],
                "position" : [5.75, 4.75, -10]
            }
        },    
        {
            "Sphere" : {
                "radius" : 0.5,
                "color" : [0.0, 0.0, 1.0, 0.4],
                "position" : [2.75, -0.80, 0]
            }
        },
        {
            "Plane" : {
                "normal" : [0.2, 1, 0.1],
                "color" : [1.0, 1.0, 1.0, 0.0]
            }
        },
        {
            "Quadric" : {
                "color" : [1.0, 1.0, 0.0, 0.4],
                "A": 10,
                "B": 0.5,
                "C": 0.4,
                "D": 0,
                "E": 0,
                "F": 0,
                "G": -20,
                "H": -10,
                "I": -0.8,
                "J": 10.4
            }
        },
        {
            "Triangle" : {
                "pos_x" : [8, 0, 0],
                "pos_y" : [12, 0, 0],
                "pos_z" : [10, 4, 0],
                "color" : [0, 0.1, 0.8, 0] 
            }
        }
    ],
    "light" : [
        {
            "position" :[-7, 10, -10],
            "color" :[1.0, 1.0, 0.0, 0.0]
        },
        {
            "position" :[-7, 10, 10],
            "color" :[1.0, 0, 1.0, 0.0]
        }
    ]
}
Example Input 2 :
{
    "height" : 600,
    "width" : 600,
    "camera" :{
        "position" : [0, 0, -4],
        "lookat" : [0, 1, 0]
    },
    "ambient_light" : 0.2,
    "scene" : [
        {
            "Sphere" : {
                "radius" : 0.5,
                "color" : [0.0, 0.1, 0.0, 0.5],
                "position" : [-0.5, 0, 0]
            }
        },
        {
            "Sphere" : {
                "radius" : 0.5,
                "color" : [0.5, 0.5, 0.0, 0.5],
                "position" : [0.5, 0, 0]
            }
        },
        {
            "Plane" : {
                "normal" : [0, 0.5, 0],
                "color" : [1.0, 1.0, 1.0, 0.0]
            }
        }
    ],
    "light" : [
        {
            "position" :[-7, 10, -10],
            "color" :[1.0, 1.0, 1.0, 0.0]
        },
        {
            "position" :[7, 10, 10],
            "color" :[1.0, 1.0, 1.0, 0.0]
        }
    ]
}

About

Ray Tracer Assignment (COL781) in c++ and GLFW

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages