Dynamic per Object Ray Caching Textures for Real-Time Ray Tracing Christian F. Ruff, Esteban W. G. Clua, and Leandro A. F. Fernandes Instituto de Computac ¸˜ ao, Universidade Federal Fluminense (UFF) CEP 24210-240 Niter´ oi, RJ, Brazil Email: {cruff, esteban, laffernandes}@ic.uff.br (a) 128 × 128 (b) 256 × 256 (c) 512 × 512 (d) Conventional Ray Tracing Fig. 1. Images produced by ray tracing two scenes while using the proposed ray-caching textures for real-time rendering (a)-(c), and without our caching mechanism (d). The quality of the resulting images increases as the resolution of the proposed caching structures increases. Notice that caching textures having 512 × 512 texels (c) generated images equivalent to the standard ray tracing (d). As can be seen in Table I for the images on the bottom, our approach has the advantage of producing results like (a)-(c) at 42 fps, while (d) is rendered at 12 fps. Abstract—Ray tracing allows the rendering of scenes with very complex light interactions. It is based on the idea that reflection, refraction and shadows can be modeled by recursively following the path that light takes as it bounces through an environment. However, despite its conceptual simplicity, tracing rays is a computationally intensive task. Also, optimizing memory management to increase efficiency is hard since coherent access in 3D space would not generate coalescent memory patterns. We present a new caching-like strategy suitable for real-time ray tracing which is capable to store data generated in previous frames in such a way that coherent memory access is achieved while data is reused by subsequent frames. By storing light bounce results of previously traced rays in a cubemap attached to each scene object, we show that it is possible to explore the efficient memory sampling mechanism provided by the graphics hardware to increase frame rate. Our approach is suitable for static scenes and may prevent deep interactions of rays with the scene as well as enable synchronous computation of rays in parallelized architectures, and it can be easily integrated to any existing ray tracing solutions. Keywords-ray tracing; cache memory; cubemap; real time. I. I NTRODUCTION Computer-generated images having outstanding quality and unsurpassed realism have been created through the use of ray tracing [1]. It is based on the idea of tracing the path of individual light rays from the eye into the scene, and calculating the effect of its interaction with the environment. The recursive task of tracing a ray consists of traversing the 3-dimensional space until the ray hits an object and generates up to three new types of ray leaving the intersection point: a reflected ray continues on in the mirror-reflection direc- tion from a shiny surface; a transmitted ray travels through transparent materials; and a shadow ray is used to test if a surface is visible to a light source. At each ray-surface interaction, an intensity is computed, added to the color of the pixel related to the ray, and some energy is lost. The creation of reflected and transmitted rays stops when the computed intensity becomes less than a certain threshold. While the technique is capable of producing a high degree of visual 2013 XXVI Conference on Graphics, Patterns and Images 1530-1834/13 $26.00 © 2013 IEEE DOI 10.1109/SIBGRAPI.2013.43 258