260 likes | 388 Views
Ray Tracing POV. Oz Levy Yulia Shnaider 06.01.2014. What is Ray Tracing?. A method of creating visual art in which a description of an object or scene is mathematically converted into a picture
E N D
Ray Tracing POV Oz Levy YuliaShnaider 06.01.2014
What is Ray Tracing? • A method of creating visual art in which a description of an object or scene is mathematically converted into a picture • Ray tracing is capable of simulating a wide variety of optical effects, such as reflection and refraction, scattering, and dispersion phenomena
Persistence Of Vision – Ray (POV-Ray) • A three dimensional rendering free and open source software • The program derives information from an external text file, that contains the description of the scene • Scenes in ray tracing are described mathematically by a programmer or may also incorporate data from digital photography
Example for input: • To create a scene we will need: objects, light sources, camera • The objects are defined mathematically or using an image, several types of cameras, sources of lights • Examples for types of light sources: point light, spotlight, cylindrical, spotlight, parallel light, area light, soft shadows
Surface patterns: wrinkles bumps • Atmospheric effects: fog, clouds, haze, mist, rainbows and skies • Show and hide options: shadows, reflection, no image, no body background { blue 1 } camera { location <0.0, 0.5, -4.0> look_at <0.0, 0.0, 0.0> } light_source { <-30, 30, -30> color rgb <1, 1, 1> } plane { <0, 1, 0>, -1 pigment { color rgb <0, 1, 0> } } sphere { <0, 0, 0>, 1 texture { pigment { color rgb <1, 1, 0> } finish{ specular 0.6 } } }
Next stage - Rendering • Calculating per pixel • The algorithm works line by line with an horizontal scan of each pixel • The direction of the rays is opposite to the physical direction – no calculations for the rays that will not reach our point of sight
Illustration For each pixel in the image we “shoot” a ray through the pixel until it heats one of the objects, from there we direct rays to all the light sources and use superposition to get the final value for that specific pixel.
Work flow Input file Parsing Tracing Video\file Output line Last line? Distant shores by Christoph Gerber End
A few examples: Norbert Kern for the International Ray Tracing Competition
Still with Bullets by Jaime Vives Piqueres Call of the Wild by Gilles Tran
Problems and SolutionsMotivation to Parallelization • Determining the color of each pixel requires a large amount of calculations depending on the complexity of the scene • Antialiasing – a method of calculation in which we consider not only basic calculations but also the relationship and compatibility of the pixel to the nearby pixels • The algorithm we described enables working in an embarrassingly parallel method
Now that the motivation is cleared… • What are we going to talk about now ? • Approaches to parallelize • Results
Static Partitioning • Each node is assigned a section of the line to elaborate • They send it to a master processor that, after processing its section, reconstructs the complete line • This procedure is repeated up to the last line of the image
This approach assumes that all processors are similar… • In fact a line is completed only when the slowest processor finishes the computation of its section while the faster processors remain idle • Wasting useful time of elaboration…
Second Approach • The load of each process is dynamically balanced • More work is assigned to the faster processes • In this way we try to find a solution to the slower process limitation, optimizing the use of each processor
Each line of the image is now divided into a number of sections greater than the number of the available processes • Initially each processor is assigned a single section of the line to be computed • Here, the master process does not have any section to elaborate. It has the task to assign a new section to the first process that end its work • The procedure is iterated, also in this case, line after line
Disadvantages… • In antialiasing approach, each slave has to know the complete line previously elaborated and some information concerning the antialiasing of the same line (all this is sent from the master) • Getting complicated…
Tests and Results • The examples have been tested on: • The distributed architecture ParMa2(composed of four Dual Pentium II 450 MHz interconnected by a 100Mbit/s switched Fast Ethernet network, forming an 8-processor system) • A commercial multiprocessor machine: SGI Onix2 (with 8 R10000 195 MHz processors).
:FOR THE STATIC PARTITIONING - Linear speedup -The best time is obtained with ParMa2.
:FOR THE DYNAMIC - speedup and performances are better for the Onix2
Additional aspects to Parallel Computing • Divide by frames (in video, animation) • Divide by areas in the image (depends on optical/graphical parameters) • “Superposition” of two light sources..
REFERENCES 1) MPIPOV: a Parallel Implementation of POV-Ray Based on MPI Alessandro Fava1, Emanuele Fava1, and Massimo Bertozzi21 Dipartimento di Ingegneria Industriale, Universit`a di Parma Parco Area delle Scienze 181/A, I-43100 Parma, Italy 2) Dipartimento di Ingegneria dell’Informazione, Universit`a di Parma Parco Area delle Scienze 181/A, I-43100 Parma, Italy bertozzi@ce.unipr.it 3) Wikipedia