#Ray tracer (week 1)

**rayTrace** : main call to create a complete image  

- generate framebuffer   
- load scene data  
- compute camera data  
- for each pixel  
	- generate rays for pixel  
	- for each ray  
		- getRayColor()  
		- write color to buffer  
- save image


**getRayColor** : compute color from objects this ray hit

- testRay()
- if hit
	- compute surface details
	- shadeHit()
	- return color
- else is miss
	- return background color

**testRay** : should return enough information for shading

- for each object in scenelist
	- test intersect closer
- return hit data

-----------------

#Shading (week 2+3)

**shadeHit** : compute a color based on hit data

- for each light
	- create shadow ray to light
	- testRay()
	- if hit light
	-   compute light contribution
	- else is miss
	-   no light contribution
- if reflecting
	- create new ray
	- recursive ray trace
- if translucent
	- create new ray
	- recursive ray trace
- sum all contributions
- return color

-----------------

#Acceleration (week 3+4)

**createSceneTree** : create a BVH tree from an object list as part of scene load

- add all objects to BB
- find max dimension
- sort along max dimension
- split list into 2
- recurse createSceneTree on each half
- set node contents
	- parent BB
	- split details
	- left+right child
- return node

**traverseSceneTree** : intersect a ray against a BVH tree. This becomes part of testRay

- intersect root node
- if hit
	- recurse traverse left
	- recurse traverse right
	- return hit value
- else is miss
	- return miss value