Ray Tracing Through Functional Programming Language Using OCaml with Comparative Performance Analysis - Mukherjee, Poulomi; Raj, Aditya; Tewari, Babul P. (2025 International Conference on Computing, Intelligence, and Application (CIACON), 2025)
This paper explores the theory and implementation of ray tracing in OCaml. We discuss the mathematical concepts and algorithms that drive the rendering process, followed by implementation using OCaml's functional programming paradigm. Our analysis compares the merits and challenges of functional versus object-oriented (OO) approaches, highlighting the advantages of code clarity, static type safety, and ease of debugging in a functional style. With the development of functional programming module, it has been established that the debugging cost is higher in object oriented module. In this context the functional module can identify the errors at the time of compilation and we establish this fact with the development of code using OCaml. We also address performance considerations related to recursive function calls and state management complexities. Ultimately, we advocate for implementing a basic ray tracer in a functional style, demonstrating that this approach enhances code quality while aligning with the principles of immutability and strong typing.