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

Pull request for Project 2 #9

Open
wants to merge 6 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
16 changes: 9 additions & 7 deletions PROJ1_WIN/565Raytracer/565Raytracer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
<ClCompile Include="..\..\src\utilities.cpp" />
</ItemGroup>
<ItemGroup>
<CudaCompile Include="..\..\src\raytraceKernel.cu" />
<CudaCompile Include="..\..\src\raytraceKernel.cu">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
</CudaCompile>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FF21CA49-522E-4E86-B508-EE515B248FC4}</ProjectGuid>
Expand All @@ -56,7 +58,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="..\Build\CUDA 4.0.props" />
<Import Project="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\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 +80,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.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 +93,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.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 All @@ -103,7 +105,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_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.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 @@ -116,11 +118,11 @@
</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.2\include;C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/C/common/inc;../shared/glew/includes;../shared/freeglut/includes</Include>
</CudaCompile>
</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>
74 changes: 56 additions & 18 deletions PROJ1_WIN/565Raytracer/565Raytracer.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,42 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\src\glslUtility.cpp" />
<ClCompile Include="..\..\src\image.cpp" />
<ClCompile Include="..\..\src\main.cpp" />
<ClCompile Include="..\..\src\scene.cpp" />
<ClCompile Include="..\..\src\utilities.cpp" />
<ClCompile Include="..\..\src\stb_image\stb_image.c">
<Filter>stb_image</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stb_image\stb_image_write.c">
<Filter>stb_image</Filter>
</ClCompile>
<ClCompile Include="..\..\src\glslUtility.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\src\image.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\src\main.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\src\scene.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\src\utilities.cpp">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\cudaMat4.h" />
<ClInclude Include="..\..\src\glslUtility.h" />
<ClInclude Include="..\..\src\image.h" />
<ClInclude Include="..\..\src\interactions.h" />
<ClInclude Include="..\..\src\intersections.h" />
<ClInclude Include="..\..\src\main.h" />
<ClInclude Include="..\..\src\raytraceKernel.h" />
<ClInclude Include="..\..\src\scene.h" />
<ClInclude Include="..\..\src\sceneStructs.h" />
<ClInclude Include="..\..\src\utilities.h" />
<ClInclude Include="..\..\src\stb_image\stb_image_write.h">
<Filter>stb_image</Filter>
</ClInclude>
<ClInclude Include="..\..\src\stb_image\stb_image.h">
<Filter>stb_image</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CudaCompile Include="..\..\src\raytraceKernel.cu" />
<ClInclude Include="..\..\src\cudaMat4.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\glslUtility.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\image.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\interactions.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\intersections.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\main.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\raytraceKernel.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\scene.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\sceneStructs.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\src\utilities.h">
<Filter>Header</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="stb_image">
<UniqueIdentifier>{011aa553-95e8-4e59-b7ff-1bb89aebe21d}</UniqueIdentifier>
</Filter>
<Filter Include="Source">
<UniqueIdentifier>{b6af916f-7350-4c57-81e3-fd26535c112b}</UniqueIdentifier>
</Filter>
<Filter Include="Header">
<UniqueIdentifier>{8b6462cf-94cd-461a-94b7-6d56a9a513e8}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<CudaCompile Include="..\..\src\raytraceKernel.cu">
<Filter>Source</Filter>
</CudaCompile>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion PROJ1_WIN/565Raytracer/565Raytracer.vcxproj.user
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>scene="../../scenes/sampleScene.txt"</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>scene="../../scenes/portalScene.txt"</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
Binary file added PROJ1_WIN/Release/565Raytracer.exe
Binary file not shown.
Binary file added PROJ1_WIN/Release/565Raytracer.pdb
Binary file not shown.
Binary file added PROJ1_WIN/Release/freeglut.dll
Binary file not shown.
Binary file added PROJ1_WIN/Release/glew32.dll
Binary file not shown.
Binary file added PROJ1_WIN/Release/glut32.dll
Binary file not shown.
106 changes: 7 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,109 +7,17 @@ Due Friday, 10/12/2012
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
NOTE:
Path Tracer
-------------------------------------------------------------------------------
This project requires an NVIDIA graphics card with CUDA capability! Any card after the Geforce 8xxx series will work. If you do not have an NVIDIA graphics card in the machine you are working on, feel free to use any machine in the SIG Lab or in Moore100 labs. All machines in the SIG Lab and Moore100 are equipped with CUDA capable NVIDIA graphics cards. If this too proves to be a problem, please contact Patrick or Karl as soon as possible.
For this project I've extended the ray tracer into a path tracer. All of the base requirements have been met and I have added in camera controls and a fancy new primitive: the portal!

-------------------------------------------------------------------------------
INTRODUCTION:
-------------------------------------------------------------------------------
In this project, you will extend your raytracer from Project 1 into a full CUDA based global illumination pathtracer.

For this project, you may either choose to continue working off of your codebase from Project 1, or you may choose to use the included basecode in this repository. The basecode for Project 2 is the same as the basecode for Project 1, but with some missing components you will need filled in, such as the intersection testing and camera raycasting methods.

How you choose to extend your raytracer into a pathtracer is a fairly open-ended problem; the supplied basecode is meant to serve as one possible set of guidelines for doing so, but you may choose any approach you want in your actual implementation, including completely scrapping the provided basecode in favor of your own from-scratch solution.

-------------------------------------------------------------------------------
CONTENTS:
-------------------------------------------------------------------------------
The Project2 root directory contains the following subdirectories:

* src/ contains the source code for the project. Both the Windows Visual Studio solution and the OSX makefile reference this folder for all source; the base source code compiles on OSX and Windows without modification.
* scenes/ contains an example scene description file.
* renders/ contains two example renders: the raytraced render from Project 1 (GI_no.bmp), and the same scene rendered with global illumination (GI_yes.bmp).
* PROJ1_WIN/ contains a Windows Visual Studio 2010 project and all dependencies needed for building and running on Windows 7.
* PROJ1_OSX/ contains a OSX makefile, run script, and all dependencies needed for building and running on Mac OSX 10.8.

The Windows and OSX versions of the project build and run exactly the same way as in Project0 and Project1.

-------------------------------------------------------------------------------
REQUIREMENTS:
-------------------------------------------------------------------------------
In this project, you are given code for:

* All of the basecode from Project 1, plus:
* Intersection testing code for spheres and cubes
* Code for raycasting from the camera

You will need to implement the following features. A number of these required features you may have already implemented in Project 1. If you have, you are ahead of the curve and have less work to do!

* Full global illumination (including soft shadows, color bleeding, etc.) by pathtracing rays through the scene.
* Properly accumulating emittance and colors to generate a final image
* Supersampled antialiasing
* Parallelization by ray instead of by pixel via string compaction (see the Physically-based shading and pathtracing lecture slides from 09/24 if you don't know what this refers to)
* Perfect specular reflection

You are also required to implement at least two of the following features. Some of these features you may have already implemented in Project 1. If you have, you may NOT resubmit those features and instead must pick two new ones to implement.

* Additional BRDF models, such as Cook-Torrance, Ward, etc. Each BRDF model may count as a separate feature.
* Texture mapping
* Bump mapping
* Translational motion blur
* Fresnel-based Refraction, i.e. glass
* OBJ Mesh loading and rendering without KD-Tree
* Interactive camera
* Integrate an existing stackless KD-Tree library, such as CUKD (https://github.com/unvirtual/cukd)
* Depth of field
Camera controls demoed in the video.

Alternatively, implementing just one of the following features can satisfy the "pick two" feature requirement, since these are correspondingly more difficult problems:
Portals, like the ones in the scene are comprised of a planar colliding surface defined by a Julia set the parameters of which are defined in the scene file (circles are a special case of the Julia set with C set to 0). Each portal is linked to another portal, allowing for a ray to enter portal A and exit portal B. I have added the functionality that input and output portals need not be the same size, this allows for scaling effects that make objects appear larger or smaller or in some way warped. Portals may map to any other portal. This means that you can have one portal be the output of many different inputs, i.e. portals A, B, and C all lead to portal D. I use this characteristic to create the back lighting on the circular and fractal portals in the scene by adding a duplicate of the portals behind the main viewing ones that all map to a portal placed outside of the bounding box facing a light source.

* Physically based subsurface scattering and transmission
* Implement and integrate your own stackless KD-Tree from scratch.
* Displacement mapping
* Deformational motion blur

As yet another alternative, if you have a feature or features you really want to implement that are not on this list, let us know, and we'll probably say yes!

-------------------------------------------------------------------------------
NOTES ON GLM:
-------------------------------------------------------------------------------
This project uses GLM, the GL Math library, for linear algebra. You need to know two important points on how GLM is used in this project:

* In this project, indices in GLM vectors (such as vec3, vec4), are accessed via swizzling. So, instead of v[0], v.x is used, and instead of v[1], v.y is used, and so on and so forth.
* GLM Matrix operations work fine on NVIDIA Fermi cards and later, but pre-Fermi cards do not play nice with GLM matrices. As such, in this project, GLM matrices are replaced with a custom matrix struct, called a cudaMat4, found in cudaMat4.h. A custom function for multiplying glm::vec4s and cudaMat4s is provided as multiplyMV() in intersections.h.

-------------------------------------------------------------------------------
BLOG
-------------------------------------------------------------------------------
As mentioned in class, all students should have student blogs detailing progress on projects. If you already have a blog, you can use it; otherwise, please create a blog using www.blogger.com or any other tool, such as www.wordpress.org. Blog posts on your project are due on the SAME DAY as the project, and should include:

* A brief description of the project and the specific features you implemented.
* A link to your github repo if the code is open source.
* At least one screenshot of your project running.
* A 30 second or longer video of your project running. To create the video use http://www.microsoft.com/expression/products/Encoder4_Overview.aspx

-------------------------------------------------------------------------------
THIRD PARTY CODE POLICY
-------------------------------------------------------------------------------
* Use of any third-party code must be approved by asking on Piazza. If it is approved, all students are welcome to use it. Generally, we approve use of third-party code that is not a core part of the project. For example, for the ray tracer, we would approve using a third-party library for loading models, but would not approve copying and pasting a CUDA function for doing refraction.
* Third-party code must be credited in README.md.
* Using third-party code without its approval, including using another student's code, is an academic integrity violation, and will result in you receiving an F for the semester.
As can be seen by comparing this video to the last, I have upgraded my hardware to an Nvidia GTX 680 and have seen substantial speed boosts.

-------------------------------------------------------------------------------
SELF-GRADING
BLOG:
-------------------------------------------------------------------------------
* On the submission date, email your grade, on a scale of 0 to 100, to Karl, [email protected], with a one paragraph explanation. Be concise and realistic. Recall that we reserve 30 points as a sanity check to adjust your grade. Your actual grade will be (0.7 * your grade) + (0.3 * our grade). We hope to only use this in extreme cases when your grade does not realistically reflect your work - it is either too high or too low. In most cases, we plan to give you the exact grade you suggest.
* Projects are not weighted evenly, e.g., Project 0 doesn't count as much as the path tracer. We will determine the weighting at the end of the semester based on the size of each project.

-------------------------------------------------------------------------------
SUBMISSION
-------------------------------------------------------------------------------
As with the previous project, you should fork this project and work inside of your fork. Upon completion, commit your finished project back to your fork, and make a pull request to the master repository.
You should include a README.md file in the root directory detailing the following

* A brief description of the project and specific features you implemented
* At least one screenshot of your project running, and at least one screenshot of the final rendered output of your pathtracer
* Instructions for building and running your project if they differ from the base code
* A link to your blog post detailing the project
* A list of all third-party code used
http://liamboone.blogspot.com/2012/10/project-2-pathtracer.html
Loading