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

Submitting project #12

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
335 changes: 67 additions & 268 deletions README.md

Large diffs are not rendered by default.

190 changes: 190 additions & 0 deletions data/scenes/sampleScene - Copy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
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

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
frame 0
TRANS 0 0 0
ROTAT 0 0 90
SCALE .01 10 10

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

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

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

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

OBJECT 5
sphere
material 4
frame 0
TRANS 0 2 0
ROTAT 0 180 0
SCALE 3 3 3

OBJECT 6
sphere
material 3
frame 0
TRANS 2 5 2
ROTAT 0 180 0
SCALE 2.5 2.5 2.5

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


OBJECT 8
cube
material 8
frame 0
TRANS 0 10 0
ROTAT 0 0 90
SCALE .3 3 3
22 changes: 11 additions & 11 deletions data/scenes/sampleScene.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MATERIAL 3 //red glossy
RGB .63 .06 .04
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFL 1
REFR 0
REFRIOR 2
SCATTER 0
Expand All @@ -50,21 +50,21 @@ MATERIAL 4 //white glossy
RGB 1 1 1
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFL 1
REFR 0
REFRIOR 2
SCATTER 0
ABSCOEFF 0 0 0
RSCTCOEFF 0
EMITTANCE 0

MATERIAL 5 //glass
RGB 0 0 0
MATERIAL 5 //blue glass
RGB .5 1 1
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFR 1
REFRIOR 2.2
REFRIOR 1.2
SCATTER 0
ABSCOEFF .02 5.1 5.7
RSCTCOEFF 13
Expand All @@ -74,7 +74,7 @@ MATERIAL 6 //green glossy
RGB .15 .48 .09
SPECEX 0
SPECRGB 1 1 1
REFL 0
REFL 1
REFR 0
REFRIOR 2.6
SCATTER 0
Expand Down Expand Up @@ -108,11 +108,11 @@ EMITTANCE 15

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

Expand Down Expand Up @@ -168,8 +168,8 @@ OBJECT 6
sphere
material 3
frame 0
TRANS 2 5 2
ROTAT 0 180 0
TRANS 2 5 -4
ROTAT 75 180 20
SCALE 2.5 2.5 2.5

OBJECT 7
Expand All @@ -187,4 +187,4 @@ material 8
frame 0
TRANS 0 10 0
ROTAT 0 0 90
SCALE .3 3 3
SCALE .3 3 3
Binary file added images/140 iters 20 depth compaction.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 images/Another cool picture.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 images/Cleaned up normal calculation.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 images/CornellBoxesSimpleColoring.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 images/Depth Cube Intersection.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 images/Depth Sphere Intersection.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 images/Diffuse Spheres More Light.png
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 images/Fixed Bug with Ordering.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 images/Increased Light.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 images/Low Light 15 Iters.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 images/Thumbs.db
Binary file not shown.
Binary file added images/active rays.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 images/another blue sphere.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 images/blue glass.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 images/depth 2.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 images/fixed bug with normals.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 images/stream compaction performance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 26 additions & 7 deletions src/interactions.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ __host__ __device__ glm::vec3 calculateReflectionDirection(glm::vec3 normal, glm
__host__ __device__ Fresnel calculateFresnel(glm::vec3 normal, glm::vec3 incident, float incidentIOR, float transmittedIOR, glm::vec3 reflectionDirection, glm::vec3 transmissionDirection);
__host__ __device__ glm::vec3 calculateRandomDirectionInHemisphere(glm::vec3 normal, float xi1, float xi2);

// TODO (OPTIONAL): IMPLEMENT THIS FUNCTION
__host__ __device__ glm::vec3 calculateTransmission(glm::vec3 absorptionCoefficient, float distance) {
return glm::vec3(0,0,0);
return (1.0f - absorptionCoefficient)*distance;
}

// TODO (OPTIONAL): IMPLEMENT THIS FUNCTION
Expand All @@ -38,15 +37,35 @@ __host__ __device__ bool calculateScatterAndAbsorption(ray& r, float& depth, Abs
return false;
}

// TODO (OPTIONAL): IMPLEMENT THIS FUNCTION
__host__ __device__ glm::vec3 calculateTransmissionDirection(glm::vec3 normal, glm::vec3 incident, float incidentIOR, float transmittedIOR) {
return glm::vec3(0,0,0);
// Calculate the IOR ratio
float b = incidentIOR / transmittedIOR;

// Flip the normal if it is going in the same direction as the incident
if (glm::dot(normal, incident) > 0.0f) {
normal = -normal;
}

// Get the transverse direction
glm::vec3 tr = glm::normalize(incident - normal*glm::dot(incident,normal));

// Get the transverse component magnitude
float transv = sqrt(1.0f - pow(glm::dot(normal,incident), 2.0f));

// Get the new transverse component magnitude
float transv_new = transv * b;

// Get the new normal component
float norm_new = sqrt(1.0f - pow(transv_new, 2.0f));

return glm::normalize(-norm_new * normal + transv_new * tr);
}

// TODO (OPTIONAL): IMPLEMENT THIS FUNCTION
__host__ __device__ glm::vec3 calculateReflectionDirection(glm::vec3 normal, glm::vec3 incident) {
//nothing fancy here
return glm::vec3(0,0,0);
glm::vec3 direction = incident;
direction -= 2.0f*glm::dot(incident, normal)*normal;
direction = glm::normalize(direction);
return direction;
}

// TODO (OPTIONAL): IMPLEMENT THIS FUNCTION
Expand Down
Loading