- It was taking to long.
- Computer chips are made from silicon, not silicone.
Because of the large amount of information in the ray traced (image) file... it is probably not possible to fit a high resolution (image) file onto a standard 360K floppy disk.
My first two choices were 1) what language to implement the ray tracer in and 2) what file format to output to. Given the performance requirements needed for ray-tracing, and need for an output format that would eventually store large images, I choose Ruby as the language and ASCII-mode ppm as the output format.
Next, I typed in all the vector and matrix math from the book, carefully converting to Ruby syntax. By the end, I expected this to be the largest effort of the entire project, although this did not end up being the case.
After all of the math was entered, I then added the sphere intersection logic. After verifying that this functioned correctly, I added the main rendering loop, which is almost entirely original code. I adjusted this loop several times, but could not yet get the perspective to come out right.
x /= @viewport_size
y /= @viewport_size
#film_point = vec(x, y,0)
film_point = vec(x, y,-@viewport_z)
#film_point = vec(x, y,@viewport_z)
#film_point = vec(0, 0, 0)
#film_point = vec(0, 0, -@viewport_z)
# My original way, causes distortion
ray_dir = vec(-x, -y, @viewport_z)
# Books way, causes way worse distortion
#eye = vec_lin_comb(x, @u_vec, y,@v_vec)
#ray_dir = vec_add(@view_vec, eye)
ray_dir_normal = vec_normalize( ray_dir )
hit = cast_ray(film_point, ray_dir_normal)
image_buffer[ix][iy] = hit[0].get_color if(hit[0] != nil)
This is used to render this image.
Notice several things about the picture above:
- The spheres are all different colors, instead of all being purple-ish.
- I've already posted code, yeah I'm talking to you, brailsmt.
- There are no rendered light sources in the image.
1 comment:
LOL! C++ R4y TR4c3r5 are teh r0x0rz!!!1
Post a Comment