Project Plan for May08-38 - Interactive Ray Tracer on the Playstation 3
Total Page:16
File Type:pdf, Size:1020Kb
Project Plan for May08-38 - Interactive Ray Tracer on the PlayStation 3 Brendan Campbell, Daniel Risse, Aaron Westphal, Sean Godinez November 25, 2007 Figure 1: IBM's iRT Produces beautiful results Abstract The PlayStation 3 uses a new processor called the Cell Broadband Engine, developed by IBM. This report discusses a software application to run on the PlayStation 3 that utilizes the computational performance-enhancing features of the Cell Broadband Engine for the purposes of ray tracing. Terms: CBE Cell Broadband Engine A processor developed by IBM that is the CPU of Sony's PlayStation 3 gaming console. It is also referred to as the Cell Processor. SIMD Single Instruction, Multiple Data. A SIMD command is an instruction that tells a processor to work on several data items with the same operation applied to each. This is also sometimes known as a vector operation. PPE Power Processing Element. This is the main core of the Cell Processor. SPE Synergistic Processing Element. This is a co-processor that specializes in SIMD instructions and is a supplemental part of the Cell Processor. IBM's iRT A team at IBM produced an interactive ray tracer to showcase the capabilities of the Cell Broadband Engine. Their ray tracer is known as iRT. 1 Contents 1 Design and Requirements Specication 4 1.1 Problem Statement . 4 1.2 Solution Concept . 5 1.3 System Description . 5 1.4 Operating Environment . 7 1.5 User Interface Description . 7 1.6 Market and Literature Survey . 7 1.6.1 Desirable Features for an Interactive Ray Tracer . 7 1.6.1.1 High Frame Rate . 7 1.6.1.2 Low-latency from user input . 7 1.6.1.3 Color . 8 1.6.1.4 Diuse Shading . 8 1.6.1.5 Specular Shading . 8 1.6.1.6 Shadows . 8 1.6.1.7 Reections . 8 1.6.1.8 Refraction . 8 1.6.1.9 Anti-aliasing . 9 1.6.1.10 Textures . 9 1.6.1.11 Bump-mapping . 9 1.6.1.12 Ambient Occlusion . 9 1.6.1.13 Global Illumination . 9 1.6.2 Means to Achieve Features . 10 1.6.2.1 Hierarchies . 10 1.6.2.2 Grouping of Similar Tasks. 10 1.6.2.3 Iterative vs. Recursive Design . 10 1.6.3 Impact for This Project . 10 1.6.4 Originality . 11 1.7 Requirements . 11 1.7.1 Functional Requirements: . 11 1.7.2 Non-Functional Requirements . 12 1.8 Deliverables . 12 2 2 Project Plan 13 2.1 Work Breakdown Structure . 13 2.2 Budget . 14 2.3 Project Schedule . 14 3 Chapter 1 Design and Requirements Specication 1.1 Problem Statement Our client, Dr. Joseph Zambreno, is interested in achieving a real-time Ray Tracing Graphics application on a PlayStation 3 (PS3). Traditionally, Ray Tracing is a very computationally intensive process, often requiring highly par- allelized supercomputers or clusters for real-time interactivity. The PlayStation 3 uses a parallel processing architecture of IBM's design known as Cell Broad- band Engine. Implementing interactive ray tracing on the Cell architecture is an area of only limited research so far, and it is believed that there is room improvement in ² the detail of renders the number of features implemented, ² the speed of interaction and frame-rate of image generation, and ² the scalability of such applications through clustering. ² There is also room for taking greater advantage of the parallelism inherent in the Cell's multiple SPE (Synergistic Processing Element) design, and SIMD (Single Instruction Multiple Data) vector handling. Our client's goal for us is to implement a well-featured interactive Ray Tracer for Linux on the PS3. This includes producing a working end program, ecient and readable source code for future development, and complete documentation. It is also desired to make it scalable to multiple PS3s, and potentially publish this work in an academic journal. We will be approaching the problem by taking the following steps: 1 Thorough research, studying the previous implementations and the Cell Broadband Engine Architecture 4 2 Implementing a prototype that uses modular code for a Ray Tracer. 3 Iteratively add features. 4 Testing, optimization and documentation. 1.2 Solution Concept Ray Tracing is a set of algorithms that simulate the interactions of light rays with objects within a given, possibly dynamic, scene. It is based on the inverse of how actual light rays behave: instead of tracing all rays from luminous sources, it traces each pixel of a camera window to objects visible in the scene, and from each of those backwards, almost recursively (but implemented more eciently), until some termination point or recursion-depth limit. Many aspects of physical phenomena are common in typical Ray Tracing applications, including reec- tion, refraction, shading, shadows, textured and/or bump-mapped surfaces, and others. Scenes to render can be specied using natural shapes such as spheres and not just triangles as in common but faster rasterization algorithms. This can result in far more realistic looking models than rasterization, however the time to compute the render is typically orders of magnitude greater for Ray Tracing. Nonetheless, with parallel architectures, fast processors, ecient and optimized code, achieving real-time renders with low-latency user input to move the camera or objects in the scene is close at hand. 1.3 System Description The purpose of the program is to take a model le into the PPE and divide its ray tracings into each SPE for side-by-side run time. The PPE and SPEs use real-time interactive ray tracing algorithms to generate output which is sent to the frame buer for viewing. When a new model le or the camera angle is changed, the algorithm must be run again with a new origin for the tracing rays. The generated image uses shadows, refraction, reection, and illumination to simulate life-like scenes. 5 Figure 1.1: System Block Diagram. Shows the ow of actions and data as the software runs. Camera Input Device Scene File File Load Raytrace PS3 PPE Raytrace Raytrace Raytrace SPE SPE Raytrace Raytrace SPE SPE SPE SPE Memory Bus Memory Output The program takes in a model le to the PPE, which is then divided into tasks to be traced by the individual SPEs. Each SPE and the PPE have access to a shared memory bus, as well as the output buer, to which each SPE sends its results. The input controller sends a new origin for the rays of the ray-tracing to the PPE, which then updates each SPE as necessary. 6 1.4 Operating Environment The operating environment for our application will be a PS3 console connected to some type of display and having a USB keyboard input. There will be a distribution of Linux already installed and running on the PS3, and this will be the software environment in which our application will run. There are constraints of hardware availability within the Linux environment on the PS3, for instance, many dedicated graphics capabilities of the hardware are crippled when not using the PS3s native OS. However, Ray Tracing is not well suited to this kind of processing hardware and will instead run on the Cell Processor?s Primary Processing Element (PPE) and the 5 available SPEs. The application will be written to take advantage of these units by running sequences in parallel, in addition to using SIMD instructions to parallelize vector and array operations. 1.5 User Interface Description The user interface for our application will be very simple. The display will consist entirely of the scene to be rendered, being sent through the PS3s video outputs to a compatible display. The interactivity will be achieved through a USB keyboard, for which Linux on the PS3 already has support. Key controls will enable such actions as moving the camera window around, and potentially manipulating the scene being rendered. The interface will not allow editing of the original scene data. Scene les will have to be created and modied with existing design tools. 1.6 Market and Literature Survey 1.6.1 Desirable Features for an Interactive Ray Tracer 1.6.1.1 High Frame Rate Interactive Ray Tracers, by denition, have to be able to display an ever- changing 3D scene at a frame-rate that is fast enough to seem smooth (20+ fps). The greatest obstacle to achieving such frame-rates is the amount of com- putation required to render a single frame. At a normal resolution (720x1280 aka 720p)[2], nearly one million rays are generated initially, and these rays have to do several intersection tests each. Furthermore, each ray must spawn more rays in order to calculate shadows and reections. It's easy to tell that the number of calculations is on the order of several million, per frame. 1.6.1.2 Low-latency from user input An Interactive Ray Tracer must be able to provide near-immediate response to user input. Otherwise, the utility of the input, as well as the pace at which a user manipulates the scene, decrease substantially. The sort of changes based on user input can include: 7 ² Changing the geometries (shape/distances of objects in the scene) ² Changing Lights ² Moving the camera Of these changes, changing the geometry is generally the most dicult to do quickly. This is due to the techniques that are traditionally used to speed up ray tracing. 1.6.1.3 Color Full-color renders (24-bit, usually) are generally expected from Ray Tracers. Interactive Ray Tracers are no exception. 1.6.1.4 Diuse Shading Diuse shading is calculated based on the angle at which a light source hits a surface.