Neon lights glow through the science of excited atoms. When electricity passes through a sealed tube of neon gas, electrons jump to higher energy levels. As they return, they release energy as vibrant light, creating dazzling displays in cities worldwide.


Ray Tracing


This 3D pipeline was conducted to showcase Ray Tracing techniques that could potentially be used to achieve photorealistic effects. Ray Tracing as it’s name suggests consists on throwing rays from the camera’s point of view to later make them bounce along the geometry, simulating the behavior of the light. Due to this it’s considered a PBR (Physically Based Rendering)technique.

I will explain several scenes that were specifically created to showcase how different materials behave: Diffuse, Metalic and Translucent materials, with an addition of a personal project about SubSurface Scattering.

1-Infraestructure & colors


This first part of the project consisted on creating the pipeline from scratch and integrating how light behaves in a scenario fully composed by opaque objects. Here I developed the parser that would interpret the information read from a .txt for easy testing and multple scenes. I then added how to trace plain colors and output them to a single image using recursion. This part was mainly doing the infraestructure.

2- Diffuse material


During this part of the project I added how Diffuse materials would behave. I considered the material fully opaque and made the light bounce according to the normal of the surface, fully reflecting the ray to the outside. With a threshold of bounces per sample I achieved a limit for performance to ensure that recursion would not go infinitely on, also achieving correct representation of the material.

3- Metallic materials & complex geometry


Metallic materials were next. They mostly defer from diffuse objects due to the way in which light acts on their surface. Metallic materials make light deviate from a “symmetric” bounce, which gives them that reflective look. For this I coded a random generator and then used it to create random vectors in a sphere that encapsulated the point of intersection between the ray and the object. This randomly generated vector would act as an offset to the reflected vector, and with the radius of the sphere I would control the roughness of the metal, creating different effects.

In the same way I added tinyobj loader to be able to render more complex geometry apart from the one I generated by code.

4- Translucency and accelerators


For the final step of the pipeline I added translucent materials. In this materials light reflects and refracts based on a probability function established randomly, which approximates the behavior of light in Dielectric materials pretty accurately. Depending on the output of the probability function light would reflect or refract, creating an effect of translucency. However this is not cheap at all, and fpr greater geometry it could be very poorly performant. That’s why I added KD-Trees as space partitioning accelerator for complex objects. Since KD-Trees shine in what ray intersection is concerned it was the best choice for this problem, and it reduced the computing time significantly. In the same way I added multithreading to speed up the process.

5- subsurface scattering


For my final project I tried to conduct a personal implementation of subsurface scattering in ray tracing, based on the papers by Stanford University on A Practical Model for Subsurface Light Transport and University of Coppenhagen on Dipole Subsufrace Scattering.

For the full process that I followed I wrote a memoir that explain it pretty completely. Although the project was not a succes for me, it gave me an idea of how hard it is to write and understand a paper: