Generating a basic Portable Pixmap file and used ImageMagick to convert to png
Sending rays into the scene and using lerp for blend creating a gradient (Tweaked some values myself in rayColor to create this indigo-green gradient)
A rudimentary image of Ray and Sphere Intersection without shading and reflection (Color separation logic in rayColor is based on discriminant of the equation for Ray and Sphere for a common 't')
Adding surface normals for the sphere and computing the hit points of the ray and calculating surface normals and color mapping it
Creating abstractions for objects in the world and some more abstractions
Using Localized supersampling for anti aliasing. Also tried a higher resolution (1920 x 1080) for this image Given that a PPM file is inefficient due to its large size caused by uncompressed pixel data, and that the book uses this format to generate the image because it is simple to create, there is some potential to parallelize the render loop to make this approach faster for high-resolution images.
Generating random hemisphere vectors
Non uniform scattering of rays or Lambertian distribution (R) and uniform scattering (L) The result on the right is a much accurate representation of diffuse reflection. It also has a tint of the background gradient consisting of blue and white.
Basic gamma transform
Materials are classes in the raytracer program with each having a unique scatter method and an albedo value(this determines the attenuation or strength of the scattered ray color, dark materials will absorb most of the light while white materials will reflect most of the light) In this image there are 2 material types diffuse and metal. The high definition image shows a very clean reflection of the blue sphere as of now.
Fuzziness is a quality of specific materials which we see in real life. Like metals dont usually have a clean reflection like a glass/mirror but rather this blurred reflection. In this program we are just specifying the fuzziness of the material in main and based on that we are multiplying this fuzz factor with a random unit vector and adding to our normalised reflected ray.
Glass sphere with dielectric material and basic snell's law for refraction
Dielectric sphere with total internal reflection and schlick approximation for adding fresnel reflectance to the dielectric sphere. the dielectric sphere consists of another hollow sphere.
Added vertical fov and defined camera frame vectors to view the scene from different positions. Repositioning camera is simple by changing the 'lookFrom' and 'lookAt' vectors in the main.
Rendered the refracting glass sphere. This is a much better render of the glass sphere and also a better vfov which makes the details visible.














