Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 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
139 changes: 139 additions & 0 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>

import os
import ycm_core

# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-lglut',
'-lGL',
'-lGLEW',
'-Wall',
'-Wextra',
'-Werror',
'-Wc++98-compat',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
'-DUSE_CLANG_COMPLETER',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++11',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-I/usr/local/cuda/samples/common/inc',
'-I/usr/local/cuda/include'
]

# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''

if compilation_database_folder:
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None


def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )


def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag

if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )

for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break

if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break

if new_flag:
new_flags.append( new_flag )
return new_flags


def FlagsForFile( filename ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = database.GetCompilationInfoForFile( filename )
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )

# NOTE: This is just for YouCompleteMe; it's highly likely that your project
# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
# ycm_extra_conf IF YOU'RE NOT 100% YOU NEED IT.
'''
try:
final_flags.remove( '-stdlib=libc++' )
except ValueError:
pass
'''
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )

return {
'flags': final_flags,
'do_cache': True
}
2 changes: 1 addition & 1 deletion PROJ1_WIN/565Raytracer/565Raytracer.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>scene=../../scenes/sampleScene.txt</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>scene=../../scenes/testScene.txt</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release (v5.5)|Win32'">
Expand Down
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,70 @@ Fall 2013
Due Thursday, 09/19/2013
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
PROJECT UPDATES:
-------------------------------------------------------------------------------
09/24/2013:
* Configured a linux machine for CUDA development, woo!!!
* Added soft shadows and fixed box collisions based off of implementation in project2-pathtracer code
* Started the process of cleaning up code / added debug modes so that I can effectively work towards a pathtracer
* I'm definitely looking forwad to implementing anti-aliasing
* A set of screenshots with various debug-modes to come soon!

Image with corrected box intersections, soft-shadows, refections, etc ...
![screenshot](https://raw.github.com/uriahjb/Project1-RayTracer/master/renders/soft_shadows.bmp)



09/20/2013 Part 2:
* Added shadows
* Ran into quite a few issues with my code crashing the GPU and even Windows kernel on the Moore100 computers ( I think there is a div/0 somewhere in by box detector)
* I still need to create a video and do a performance evaluation. It looks like the Moore100 computers lack the software needed for this.
* So far I have fulfilled:
* Raycasting from a camera into a scene through a pixel grid
* Phong lighting for one point light source
* Diffuse lambertian surfaces
* Raytraced shadows
* Cube intersection testing ( tentatively, depending on the location of the bug mentioned above )
* Sphere surface point sampling
* Specular reflection


Showing off reflections, shadows, etc ..
![screenshot](https://raw.github.com/uriahjb/Project1-RayTracer/master/renders/lighting_reflections_shadows.png)


A simple example to show off shadows
![screenshot](https://raw.github.com/uriahjb/Project1-RayTracer/master/renders/shadow_example.png)


09/20/2013:
* Added reflections
* Debugging code for shadows ( having some issues getting my collision detector
to detect objects obscuring the light ).
![screenshot](https://raw.github.com/uriahjb/Project1-RayTracer/master/renders/lighting_plus_reflections.png)


09/15/2013:
* Fixed logic bug causing only one object to render at a time
* Added Phong lighting ( ambient, diffuse, and specular ) as per:
http://en.wikipedia.org/wiki/Phong_reflection_model
* At the moment my code implements all functionality in a single raytracer
thread per pixel, its probably not very efficient. My goal is first to fulfill
the requirements of the project and then improve efficiency. My current
naive implementation will hopefully provide a nice baseline.

![screenshot](https://raw.github.com/uriahjb/Project1-RayTracer/master/renders/phong_lighting.png)

09/14/2013:
* Implemented raytrace from camera and tested that the raytracing was working
by sending out a ray per thread and checking for sphere collisions. At the moment
I have a funky issue whereby only one sphere is ever detected even though
multiple may be in view.

![screenshot](https://raw.github.com/uriahjb/Project1-RayTracer/master/renders/first_steps.png)


-------------------------------------------------------------------------------
NOTE:
-------------------------------------------------------------------------------
Expand Down
Binary file added renders/first_steps.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 renders/lighting_plus_reflections.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 renders/lighting_reflections_shadows.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 renders/phong_lighting.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 renders/shadow_example.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 renders/soft_shadows.bmp
Binary file not shown.
134 changes: 134 additions & 0 deletions scenes/cubeScene.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
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 400 400
FOVY 25
ITERATIONS 1
FILE test.bmp
frame 0
EYE 0 0 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 1 1 1

OBJECT 1
sphere
material 0
frame 0
TRANS 2 0 0
ROTAT 0 0 90
SCALE 1 1 1

Loading