Skip to content

abhishekingit/RayTracingInOneWeekend

Repository files navigation

Fun with RayTracing

Generating a ppm image

image.png

Generating a basic Portable Pixmap file and used ImageMagick to convert to png

Generating a linearly blended gradient by sending rays into the scene

RTgradient.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)

Ray and Sphere Intersection

RTSphere.png

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')

Surface Normals and Shaded Sphere

ShadedSphere.png

Adding surface normals for the sphere and computing the hit points of the ray and calculating surface normals and color mapping it

Adding abstraction for world objects

World.png

Creating abstractions for objects in the world and some more abstractions

Adding Antialiasing and generating a high definition image

antiAliased.png

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.

Diffused Materials by generating random hemisphere vectors

diffusedmaterial.png

Generating random hemisphere vectors

Lambertian distribution

scatteringComparison.png

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.

Gamma correction

gammaCorrected.png

Basic gamma transform

Materials and rendering Reflections

materials.png

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.

Adding Fuzziness in Reflection

fuzzSpheres.png

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 and simple refraction

fuzzSpheres.png

Glass sphere with dielectric material and basic snell's law for refraction

Dielectric spheres with Total internal reflection

dielectricRefSphere.png

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.

Reposition Camera

reposCam.png

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.

Glass sphere render

GlassCam.png

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.

About

Experimental Stuff from the book RayTracingInOneWeekend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors