Based on the book Ray Tracing in One Weekend
For the theory behind the renders and example code, see the link above.
- The first render output, in a
.ppmfile - A simple gradient
- A circle (a sphere?)
- We can render objects on the screen too by adding objects to the 3D environment
- If we add a sphere to the environment, we can change the colour of pixels depending on if the ray intersects with the 3D object
- We can also add an outline by checking if the intersection is near the edge
- The result is a circle that represents a sphere

- Normals colouring
- More spheres
- Anti-Aliasing
- Diffuse materials
- We can model light bounces from our spheres to simulate light in real life
- For diffuse materials, light bounces randomly with a probability distribution, generating a "matte" look
- We simulate multiple light bounces per pixel and average them out to get this:

- Gamma correction can be applied to correct the overly dark spheres:

- We can also use different probability distributions to model light bounces
- Heres a lambertian reflectance sphere:
- Note: At this point a slight error is made in my renders where the co-ordinate system of the shadows is slightly off, leading to left-skewing shadows
- This is fixed later on
- Note: At this point a slight error is made in my renders where the co-ordinate system of the shadows is slightly off, leading to left-skewing shadows
- Metals
- Glass








