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

HW03: Path Tracer #30

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ set(headers
src/sceneStructs.h
src/preview.h
src/utilities.h
src/tiny_obj_loader.h
src/ImGui/imconfig.h

src/ImGui/imgui.h
Expand Down
434 changes: 429 additions & 5 deletions README.md

Large diffs are not rendered by default.

Binary file added img/bloops/bad_diffuse0.PNG
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 img/bloops/bad_diffuse1.PNG
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 img/bloops/bad_shared_mem.PNG
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 img/bloops/bloop.PNG
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 img/bloops/bloopmat.PNG
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 img/bloops/bloopmat2.PNG
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 img/bloops/bloopy.PNG
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 img/bloops/blue.PNG
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 img/bloops/boopep.PNG
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 img/bloops/dfg.PNG
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 img/bloops/diffuse_almost_works.PNG
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 img/bloops/diffuse_almost_works_still.PNG
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 img/bloops/fresnel.PNG
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 img/bloops/io2.PNG
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 img/bloops/io3.PNG
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 img/bloops/lotsadragons.PNG
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 img/bloops/notquire.PNG
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 img/bloops/oi.PNG
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 img/bloops/refractiondoesntwork.PNG
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 img/bloops/thinlens.PNG
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 img/figures/LTE.png
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 img/figures/RRclosedruntime.png
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 img/figures/RRopenruntime.png
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 img/figures/aa.png
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 img/figures/aa_fig.PNG
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 img/figures/aadof.png
Binary file added img/figures/bvhruntime.png
Binary file added img/figures/firstbounce.png
Binary file added img/figures/matsort4.png
Binary file added img/figures/matsort8.png
Binary file added img/figures/no_aa.png
Binary file added img/figures/no_aa_fig.PNG
Binary file added img/figures/streamcompactclosedruntime.png
Binary file added img/figures/streamcompactopenruntime.png
Binary file added img/figures/streamcompactrays.png
Binary file added img/figures/streamcompactraysopen.png
Binary file added img/renders/bsdf_weight.PNG
Binary file added img/renders/cornell_561.PNG
Binary file added img/renders/depth_1.PNG
Binary file added img/renders/depth_2.PNG
Binary file added img/renders/depth_3.PNG
Binary file added img/renders/depth_4.PNG
Binary file added img/renders/depth_5.PNG
Binary file added img/renders/depth_8.PNG
Binary file added img/renders/depth_of_field.PNG
Binary file added img/renders/diffuse.PNG
Binary file added img/renders/dragon.PNG
Binary file added img/renders/dragons.PNG
Binary file added img/renders/dragons2.PNG
Binary file added img/renders/dragons2_clipped.png
Binary file added img/renders/hdr_no_gamma.PNG
Binary file added img/renders/iter_1.PNG
Binary file added img/renders/iter_10.PNG
Binary file added img/renders/iter_100.PNG
Binary file added img/renders/iter_100_bsdf_mis.PNG
Binary file added img/renders/iter_100_light_mis.PNG
Binary file added img/renders/iter_100_mis.PNG
Binary file added img/renders/iter_5.PNG
Binary file added img/renders/iter_50.PNG
Binary file added img/renders/light_weight.PNG
Binary file added img/renders/no_aa.PNG
Binary file added img/renders/no_hdr_gamma.PNG
Binary file added img/renders/no_hdr_no_gamma.PNG
Binary file added img/renders/objs.PNG
Binary file added img/renders/objs_clipped.png
Binary file added img/renders/plastic.PNG
Binary file added img/renders/spec_brdf.PNG
Binary file added img/renders/spec_btdf.PNG
Binary file added img/renders/spec_glass.PNG
Binary file added img/renders/spec_plastic.PNG
Binary file added img/renders/teapot.PNG
Binary file added img/renders/teapot_clipped.png
Binary file added img/renders/teapots.PNG
Binary file added img/renders/two_bunnies.PNG
Binary file added img/renders/wireframe.PNG
182 changes: 182 additions & 0 deletions scenes/BSDFs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
// Emissive material (light)
MATERIAL 0
R_COLOR 20 30 40
T_COLOR 0 0 0
DIFFUSE_BRDF
IOR 0
EMITTANCE 1

// Diffuse white
MATERIAL 1
R_COLOR 0.24 0.25 0.42
T_COLOR 0 0 0
DIFFUSE_BRDF
IOR 0
EMITTANCE 0

// Diffuse red
MATERIAL 2
R_COLOR 0.14 0.12 0.1
T_COLOR 0 0 0
DIFFUSE_BRDF
IOR 0
EMITTANCE 0

// Diffuse green
MATERIAL 3
R_COLOR 0.9 0.3 0.1
T_COLOR 0 0 0
DIFFUSE_BRDF
IOR 0
EMITTANCE 0

// Specular white
MATERIAL 4
R_COLOR 0.72 0.71 0.75
T_COLOR 0.35 0.95 0.95
DIFFUSE_BRDF
IOR 1.8
EMITTANCE 0

// Specular white
MATERIAL 5
R_COLOR 0.72 0.71 0.75
T_COLOR 0.95 0.95 0.95
SPEC_BRDF
IOR 1.55
EMITTANCE 0

// Camera
CAMERA
RES 1920 1080
FOVY 19.5
ITERATIONS 100
DEPTH 8
FILE cornell
FOCAL_DISTANCE 14
LENS_RADIUS 0.0
EYE 0.0 -4.5 14
LOOKAT 0 0 0
UP 0 1 0


// Ceiling light
OBJECT 0
squareplane
material 0
TRANS 0 5.45 0
ROTAT 90 0 0
SCALE 3 3 1

// Floor
OBJECT 1
squareplane
material 1
TRANS 0 -2.5 0
ROTAT 270 0 0
SCALE 20 10 10

// Ceiling
OBJECT 2
squareplane
material 1
TRANS 0 7.5 0
ROTAT 90 0 0
SCALE 20 10 10

// Back wall
OBJECT 3
squareplane
material 2
TRANS 0 2.5 -5
ROTAT 0 0 0
SCALE 20 10 10

// Left wall
OBJECT 4
squareplane
material 2
TRANS -10 2.5 0
ROTAT 0 90 0
SCALE 10 10 10

// Right wall
OBJECT 5
squareplane
material 2
TRANS 10 2.5 0
ROTAT 0 270 0
SCALE 10 10 10

// front wall
OBJECT 6
squareplane
material 2
TRANS 0 2.5 5
ROTAT 180 0 0
SCALE 20 10 10

// OBJTEST
OBJECT 7
mesh
../scenes/BSDFs/coney.obj
material 4
TRANS 0 2 0
ROTAT 0 0 0
SCALE 6 6 6

// OBJTEST
OBJECT 8
cube
material 3
TRANS 6 -1 -3
ROTAT 0 0 0
SCALE 3 3 3

// OBJTEST
OBJECT 9
cube
material 3
TRANS -6 -1 -3
ROTAT 0 0 0
SCALE 3 3 3

// OBJTEST
OBJECT 10
cube
material 3
TRANS 6 -1.5 -0.25
ROTAT 0 0 0
SCALE 2 2 2

// OBJTEST
OBJECT 11
cube
material 3
TRANS -6 -1.5 -0.25
ROTAT 0 0 0
SCALE 2 2 2

// OBJTEST
OBJECT 12
cube
material 3
TRANS 6 -2.0 1.5
ROTAT 0 0 0
SCALE 1 1 1

// OBJTEST
OBJECT 13
cube
material 3
TRANS -6 -2.0 1.5
ROTAT 0 0 0
SCALE 1 1 1

// OBJTEST
OBJECT 14
cube
material 3
TRANS 0 0 -5
ROTAT 0 0 0
SCALE 7 5 0.5
102 changes: 63 additions & 39 deletions scenes/cornell.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Emissive material (light)
MATERIAL 0
RGB 1 1 1
RGB 40 40 40
SPECEX 0
SPECRGB 0 0 0
REFL 0
REFR 0
REFRIOR 0
EMITTANCE 5
EMITTANCE 1

// Diffuse white
MATERIAL 1
RGB .98 .98 .98
RGB 0.85 0.81 0.78
SPECEX 0
SPECRGB 0 0 0
REFL 0
Expand All @@ -20,7 +20,7 @@ EMITTANCE 0

// Diffuse red
MATERIAL 2
RGB .85 .35 .35
RGB 0.63 0.065 0.05
SPECEX 0
SPECRGB 0 0 0
REFL 0
Expand All @@ -30,7 +30,7 @@ EMITTANCE 0

// Diffuse green
MATERIAL 3
RGB .35 .85 .35
RGB 0.14 0.45 0.091
SPECEX 0
SPECRGB 0 0 0
REFL 0
Expand All @@ -40,77 +40,101 @@ EMITTANCE 0

// Specular white
MATERIAL 4
RGB .98 .98 .98
RGB 0.85 0.81 0.78
SPECEX 0
SPECRGB .98 .98 .98
REFL 1
SPECRGB 0 0 0
REFL 0
REFR 0
REFRIOR 0
EMITTANCE 0

// Camera
CAMERA
RES 800 800
FOVY 45
RES 1024 1024
FOVY 19.5
ITERATIONS 5000
DEPTH 8
DEPTH 5
FILE cornell
EYE 0.0 5 10.5
LOOKAT 0 5 0
EYE 0.0 2.5 18
LOOKAT 0 2.5 0
UP 0 1 0


// Ceiling light
OBJECT 0
cube
squareplane
material 0
TRANS 0 10 0
ROTAT 0 0 0
SCALE 3 .3 3
TRANS 0 7.45 0
ROTAT 90 0 0
SCALE 3 3 1

// Floor
OBJECT 1
cube
squareplane
material 1
TRANS 0 0 0
ROTAT 0 0 0
SCALE 10 .01 10
TRANS 0 -2.5 0
ROTAT 270 0 0
SCALE 10 10 10

// Ceiling
OBJECT 2
cube
squareplane
material 1
TRANS 0 10 0
ROTAT 0 0 90
SCALE .01 10 10
TRANS 0 7.5 0
ROTAT 90 0 0
SCALE 10 10 10

// Back wall
OBJECT 3
cube
squareplane
material 1
TRANS 0 5 -5
ROTAT 0 90 0
SCALE .01 10 10
TRANS 0 2.5 -5
ROTAT 0 0 0
SCALE 10 10 10

// Left wall
OBJECT 4
cube
squareplane
material 2
TRANS -5 5 0
ROTAT 0 0 0
SCALE .01 10 10
TRANS -5 2.5 0
ROTAT 0 90 0
SCALE 10 10 10

// Right wall
OBJECT 5
cube
squareplane
material 3
TRANS 5 5 0
ROTAT 0 0 0
SCALE .01 10 10
TRANS 5 2.5 0
ROTAT 0 270 0
SCALE 10 10 10

// Sphere
// front wall
OBJECT 6
sphere
squareplane
material 1
TRANS 0 2.5 5
ROTAT 180 0 0
SCALE 10 10 10

// long cube
OBJECT 7
cube
material 4
TRANS -2 0 -3
ROTAT 0 27.5 0
SCALE 3 6 3

// short cube
OBJECT 8
cube
material 4
TRANS 2 -1 -0.75
ROTAT 0 -17.5 0
SCALE 3 3 3


// OBJTEST
OBJ_OBJECT 9 ../scenes/bunny.obj
material 4
TRANS -1 4 -1
ROTAT 0 0 0
Expand Down
Loading