Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 3 submission. #18

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
354 changes: 85 additions & 269 deletions README.md

Large diffs are not rendered by default.

Binary file added data/readme_pics/aa_with.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/readme_pics/aa_without.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/readme_pics/chart_block_size_comparison.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/readme_pics/fresnel_refractions.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/readme_pics/fun_01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/readme_pics/fun_02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/readme_pics/texture_mapping.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/readme_pics/texture_mapping_02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
225 changes: 225 additions & 0 deletions data/scenes/sampleScene_02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
MATERIAL 0 //white diffuse
RGB 1 1 1
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 0
REFRIOR 0
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 0

MATERIAL 1 //red diffuse
RGB .63 .06 .04
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 0
REFRIOR 0
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 0

MATERIAL 2 //green diffuse
RGB .15 .48 .09
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 0
REFRIOR 0
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 0

MATERIAL 3 //red glossy
RGB .63 .06 .04
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 0
REFRIOR 2
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 0

MATERIAL 4 //white glossy
RGB 1 1 1
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 0
REFRIOR 2
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 0

MATERIAL 5 //glass
RGB 0 0 0
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 1
REFRIOR 2.2
SCATTER 0
ABSCOEFF .02 5.1 5.7
RSCTCOEFF 13
EMITTANCE 0

MATERIAL 6 //green glossy
RGB .15 .48 .09
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 0
REFRIOR 2.6
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 0

MATERIAL 7 //light
RGB 1 1 1
SPECEX 0
SPECRGB 0 0 0
REFL 0
REFR 0
REFRIOR 0
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 1

MATERIAL 8 //light
RGB 1 1 1
SPECEX 0
SPECRGB 0 0 0
REFL 0
REFR 0
REFRIOR 0
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 15

TEXTURE 0
FILE world_map_256x128.bmp

TEXTURE 1
FILE stripes_256x128.bmp

TEXTURE 2
FILE black_and_white_tiles_256x256.bmp

CAMERA
RES 800 800
FOVY 25
ITERATIONS 5000
FILE test.bmp
frame 0
EYE 0 4.5 12
VIEW 0 0 -1
UP 0 1 0

OBJECT 0
cube
material 0
texture 2
frame 0
TRANS 0 0 0
ROTAT 0 0 90
SCALE .01 10 10

OBJECT 1
cube
material 0
texture 1
frame 0
TRANS 0 5 -5
ROTAT 0 90 0
SCALE .01 10 10

OBJECT 2
cube
material 0
texture -1
frame 0
TRANS 0 10 0
ROTAT 0 0 90
SCALE .01 10 10

OBJECT 3
cube
material 1
texture -1
frame 0
TRANS -5 5 0
ROTAT 0 0 0
SCALE .01 10 10

OBJECT 4
cube
material 2
texture -1
frame 0
TRANS 5 5 0
ROTAT 0 0 0
SCALE .01 10 10

OBJECT 5
sphere
material 5
texture -1
frame 0
TRANS 0 2 0
ROTAT 0 90 0
SCALE 3 3 3

OBJECT 6
sphere
material 3
texture -1
frame 0
TRANS 2 5 2
ROTAT 0 0 0
SCALE 2.5 2.5 2.5

OBJECT 7
sphere
material 3
texture 0
frame 0
TRANS -2 5 -2
ROTAT 0 180 0
SCALE 3 3 3

OBJECT 8
cube
material 8
texture -1
frame 0
TRANS 0 10 0
ROTAT 0 0 90
SCALE .3 3 3

//OBJECT 9
//sphere
//material 8
//texture -1
//frame 0
//TRANS 2 2 16
//ROTAT 0 180 0
//SCALE 1 1 1

//OBJECT 10
//cube
//material 0
//texture -1
//frame 0
//TRANS 0 5 5
//ROTAT 0 90 0
//SCALE .01 10 10
Binary file added data/textures/black_and_white_tiles.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/textures/black_and_white_tiles_256x256.bmp
Binary file not shown.
Binary file added data/textures/stripes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/textures/stripes_256x128.bmp
Binary file not shown.
Binary file added data/textures/world_map_1024x512.bmp
Binary file not shown.
Binary file added data/textures/world_map_128x64.bmp
Binary file not shown.
Binary file added data/textures/world_map_256x128.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-02_01_starting_point.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-03_01_ray_direction_test.bmp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added renders/bmp/2014-10-03_05_box_intersections.bmp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added renders/bmp/2014-10-05_01_first_image.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-05_02_second_image.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-05_03_perfect_specular.bmp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added renders/bmp/2014-10-09_03_diffuse_with_aa.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-09_04_glass_with_aa.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-11_01_texture_mapping_01.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-11_02_texture_mapping_02.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-11_03_texture_mapping_03.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-12_01_texture_mapping.bmp
Binary file not shown.
Binary file added renders/bmp/2014-10-12_02_cube_map_test.bmp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added renders/bmp/random_numbers_mod_10.bmp
Binary file not shown.
Binary file added renders/bmp/random_numbers_mod_100.bmp
Binary file not shown.
Binary file added renders/bmp/random_numbers_mod_1000.bmp
Binary file not shown.
Binary file added renders/bmp/random_numbers_mod_10000.bmp
Binary file not shown.
Binary file added renders/bmp/random_numbers_mod_100000.bmp
Binary file not shown.
Binary file added renders/bmp/random_numbers_mod_1000000.bmp
Binary file not shown.
Binary file added renders/jpg/2014-10-02_01_starting_point.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-03_01_ray_direction_test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-03_05_box_intersections.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-05_01_first_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-05_02_second_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-05_03_perfect_specular.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-11_01_texture_mapping_01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-12_01_texture_mapping.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added renders/jpg/2014-10-12_02_cube_map_test.jpg
44 changes: 44 additions & 0 deletions src/SimpleTimer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "SimpleTimer.h"


SimpleTimer::SimpleTimer()
{
}


SimpleTimer::~SimpleTimer()
{
}


void SimpleTimer::start()
{
start_time = GetTimeMs64();
}


float SimpleTimer::stop()
{
__int64 end_time = GetTimeMs64();
return ( float )( end_time - start_time );
}


__int64 SimpleTimer::GetTimeMs64()
{
/* Windows */
FILETIME ft;
LARGE_INTEGER li;

/* Get the amount of 100 nano seconds intervals elapsed since January 1, 1601 (UTC) and copy it
* to a LARGE_INTEGER structure. */
GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;

__int64 ret = li.QuadPart;
ret -= 116444736000000000LL; /* Convert from file time to UNIX epoch time. */
ret /= 10000; /* From 100 nano seconds (10^-7) to 1 millisecond (10^-3) intervals */

return ret;
}
23 changes: 23 additions & 0 deletions src/SimpleTimer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#ifndef _SIMPLE_TIMER
#define _SIMPLE_TIMER

#include <Windows.h>

class SimpleTimer
{
public:
SimpleTimer( void );
~SimpleTimer( void );

void start( void );
float stop( void );

private:
__int64 GetTimeMs64( void );

__int64 start_time;
};

#endif
2 changes: 2 additions & 0 deletions src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
image::image(int x, int y){
xSize = x;
ySize = y;

redChannel = new float[x*y];
greenChannel = new float[x*y];
blueChannel = new float[x*y];
alphaChannel = new float[x*y];

for(int i=0; i<(x*y); i++){
redChannel[i] = 0;
greenChannel[i] = 0;
Expand Down
9 changes: 6 additions & 3 deletions src/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define Raytracer_image_h

#include "glm/glm.hpp"
//#include <cuda.h>

using namespace std;

Expand All @@ -26,13 +27,12 @@ class image{
int ySize;
gammaSettings gamma;
public:
image(int x, int y);
image(int x=0, int y=0);
~image();

//------------------------
//-------GETTERS----------
//------------------------
glm::vec3 readPixelRGB(int x, int y);
glm::vec4 readPixelRGBA(int x, int y);
float readPixelR(int x, int y);
float readPixelG(int x, int y);
Expand All @@ -44,8 +44,11 @@ class image{
float* getAlphaChannel();
glm::vec3* getRGBChannels();
glm::vec4* getRGBAChannels();
glm::vec2 getDimensions();
gammaSettings getGammaSettings();

glm::vec3 readPixelRGB(int x, int y);
glm::vec2 getDimensions();


//------------------------
//-------SETTERS----------
Expand Down
Loading