Michael Recachinas
Software Engineer by day, Puppy dad by night
Not done yet!!!!
Image RayCast(Camera camera, Scene scene, int width, int height) {
Image img = new Image(width, height);
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
Ray ray = ConstructRayThroughPixel(camera, i, j);
Intersection hit = FindIntersection(ray, scene);
img[i][j] = GetColor(hit);
}
}
return img;
}
Intersection FindIntersection(Ray ray, Scene scene) {
min_t = inf;
min_shape = NULL;
for each primitive in scene {
t = Intersect(ray, primitive);
if (t > 0 and t < min_t) {
min_shape = primitive;
min_t = t;
}
}
return Intersection(min_t, min_shape);
}
http://www.cs.virginia.edu/~gfx/Courses/2014/IntroGraphics/lectures/6-Ray%20Casting.pdf
http://www.cs.virginia.edu/~gfx/Courses/2014/IntroGraphics/lectures/7-Accelerate.pdf
http://www.cs.virginia.edu/~gfx/Courses/2014/IntroGraphics/lectures/8-DirectIllum.pdf
http://www.cs.virginia.edu/~gfx/Courses/2014/IntroGraphics/lectures/9-GlobalIllum.pdf
By Michael Recachinas