Skip to content

Pull request for Project 1 #4

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

Open
wants to merge 8 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
8 changes: 4 additions & 4 deletions PROJ1_WIN/565Raytracer/565Raytracer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="..\Build\CUDA 4.0.props" />
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 4.2.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
Expand All @@ -78,7 +78,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\inc;../shared/glew/include;../shared/freeglut/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\inc;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.2\C\common\inc;../shared/glew/include;../shared/freeglut/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -91,7 +91,7 @@
</Link>
<CudaCompile>
<CompileOut>$(ProjectDir)$(Platform)/$(Configuration)/%(Filename)%(Extension).obj</CompileOut>
<Include>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include;C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.0/C/common/inc;../shared/glew/includes;../shared/freeglut/includes</Include>
<Include>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include;C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.0/C/common/inc;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include;C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/C/common/inc;../shared/glew/includes;../shared/freeglut/includes</Include>
</CudaCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -121,6 +121,6 @@
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\Build\CUDA 4.0.targets" />
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 4.2.targets" />
</ImportGroup>
</Project>
4 changes: 4 additions & 0 deletions PROJ1_WIN/565Raytracer/565Raytracer.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
<LocalDebuggerCommandArguments>scene="../../scenes/sampleScene.txt"</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>frame=0 scene="C:\Users\wjboone\Documents\GitHub\Project1-Raytracer\scenes\sampleScene.txt"</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
Binary file added PROJ1_WIN/Debug/565Raytracer.exe
Binary file not shown.
Binary file added PROJ1_WIN/Debug/freeglut.dll
Binary file not shown.
Binary file added PROJ1_WIN/Debug/glew32.dll
Binary file not shown.
Binary file added PROJ1_WIN/Debug/glut32.dll
Binary file not shown.
165 changes: 13 additions & 152 deletions README.md

Large diffs are not rendered by default.

229 changes: 229 additions & 0 deletions scenes/sampleScene.old.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
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 renders/sampleScene.bmp
frame 0
EYE 0 4.5 12
VIEW 0 0 -1
UP 0 1 0
frame 1
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
frame 1
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
frame 1
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
frame 1
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
frame 1
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
frame 1
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
frame 1
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
frame 1
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
frame 1
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
frame 1
TRANS 0 10 0
ROTAT 0 0 90
SCALE .3 3 3
14 changes: 7 additions & 7 deletions scenes/sampleScene.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ RSCTCOEFF 0
EMITTANCE 15

CAMERA
RES 800 800
RES 400 400
FOVY 25
ITERATIONS 5000
FILE renders/sampleScene.bmp
FILE sampleScene.bmp
frame 0
EYE 0 4.5 12
VIEW 0 0 -1
UP 0 1 0
frame 1
EYE 0 4.5 12
EYE 0 4.5 15
VIEW 0 0 -1
UP 0 1 0

Expand Down Expand Up @@ -182,11 +182,11 @@ SCALE .01 10 10

OBJECT 5
sphere
material 4
material 8
frame 0
TRANS 0 2 0
TRANS 0 2 3
ROTAT 0 180 0
SCALE 3 3 3
SCALE 2 2 2
frame 1
TRANS 0 2 0
ROTAT 0 180 0
Expand Down Expand Up @@ -220,7 +220,7 @@ OBJECT 8
cube
material 8
frame 0
TRANS 0 10 0
TRANS 0 9.84 0
ROTAT 0 0 90
SCALE .3 3 3
frame 1
Expand Down
13 changes: 10 additions & 3 deletions src/interactions.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,23 @@ __host__ __device__ glm::vec3 calculateRandomDirectionInHemisphere(glm::vec3 nor
//Now that you know how cosine weighted direction generation works, try implementing non-cosine (uniform) weighted random direction generation.
//This should be much easier than if you had to implement calculateRandomDirectionInHemisphere.
__host__ __device__ glm::vec3 getRandomDirectionInSphere(float xi1, float xi2) {
return glm::vec3(0,0,0);

//using Archimedes theorem (thanks to a paper from '96 published bu our own Norm Badler (http://repository.upenn.edu/cgi/viewcontent.cgi?article=1188&context=cis_reports) )
xi1 *= 2;
xi1 -= 1;
float r = sin( acos( xi1 ) );
xi2 *= TWO_PI;
return glm::vec3(r*cos(xi2),r*sin(xi2),xi1);
}

//TODO (PARTIALLY OPTIONAL): IMPLEMENT THIS FUNCTION
//returns 0 if diffuse scatter, 1 if reflected, 2 if transmitted.
__host__ __device__ int calculateBSDF(ray& r, glm::vec3 intersect, glm::vec3 normal, glm::vec3 emittedColor,
AbsorptionAndScatteringProperties& currentAbsorptionAndScattering,
glm::vec3& color, glm::vec3& unabsorbedColor, material m){
glm::vec3& color, glm::vec3& unabsorbedColor, material m)
{

return 1;
return 1;
};

#endif
Expand Down
Loading