Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Speeding Up Ray Tracing Images from Virtual Light Field Project www.cs.ucl.ac.uk/vlf ©Slides Anthony Steed 1999 & Mel Slater 2004.

Similar presentations


Presentation on theme: "1 Speeding Up Ray Tracing Images from Virtual Light Field Project www.cs.ucl.ac.uk/vlf ©Slides Anthony Steed 1999 & Mel Slater 2004."— Presentation transcript:

1 1 Speeding Up Ray Tracing Images from Virtual Light Field Project www.cs.ucl.ac.uk/vlf ©Slides Anthony Steed 1999 & Mel Slater 2004

2 2 Optimisations n Limit the number of rays n Make the ray test faster for shadow rays –the main drain on resources in there are several lights for primary rays for all rays over 90% of the cost of raytracing is in ray-object intersection tests

3 3 Primary Rays n Use a z-buffer! n Instead of writing colour write and object identifier Easy to support in OpenGL - turn off lighting, do flat shading and encode object id within 24bit colour n Difficult technique to use elsewhere because rays are no longer spatially coherent and evenly spaced

4 4 General Rays n Techniques to use bounding volumes hierarchical bounding volumes space subdivision –regular –adaptive ray coherence

5 5 Bounding Volume n Find a tight bounding volume and use it for a first reject test n If hit volume then test full object Axis aligned Bounding Box Bounding Sphere

6 6 Fast BV Tests n Box-Ray test a box is three sets of parallel planes, each set orthogonal to the other two –Calculate t near for each of the three plane pairs –find max of the 3 t near –Calculate t far for each of the three plane pairs –find min of the 3 t far If max t near is greater that min t far, then the box is not intersected

7 7 Fast BV Tests (EG) t near x t far y t far x t near x t near y t far x

8 8 Choosing a Volume n Choice depends on the cost of the test and the fit of the shape The “void” area can be very large n More efficient fitting shapes are possible (this is still a research area e.g. k-dops)

9 9 Hierarchical Bounding Volumes r1 r2

10 10 Choosing a HBV n Scene graph might not map to a decent space partitioning group BVs based on proximity rather than scene graph position n You would sort the HBV using a BSP tree anyway...

11 11 Regular Spatial Subdivision n Regular 3D grid of “voxels”

12 12 Details on the RSS n Testing Each voxel keeps a list of objects that intersect this voxel Need for a ‘mailbox’ system where voxel also keeps track of what has already intersected it to avoid duplications. n Size of voxels Obvious trade off on granularity of voxels

13 13 Adaptive Spatial Subdivision n The octree idea (illustrated with a quadtree!)

14 14 Building the Octree n Recursively split the cells into eight, until each cell meets some criteria e.g. previous diagram was “only one object intersects each cell” n Advantage is clear - cells are not wasted on void areas

15 15 Tracing an Octree n Find octree cell containing start point n If no intersection, find intersection (I) of ray with cube that surround the octree n Find (I) in the octree it is moved a little along the ray n Repeat

16 16 kD-tree / BSP Tree n Similar to octree, but orthogonal splitting planes are chosen to provide a good search tree Split based on balancing object numbers and minimising volume disparity

17 17 Ray Coherence Methods n Light Buffer n Ray Classification Scheme

18 18 Light Buffer n Haines and Greenberg, 1986 n Problem with shadow rays is that for every intersection we trace and additional n rays for each light r l0l0 l1l1

19 19 Light Buffer n Enclose light in a box. n Cells of box faces store objects

20 20 Construction - 2D Analogue A B C1 - C2 - A, B, C C3 - A C4 - C1 C2 C3 C4 C

21 21 Ray Classification n Arvo and Kirk, 1987 n Group together similar rays (rather than similar objects) n Similar rays should intersect the same groups of objects n Very elegant method

22 22 Ray Classification - Rays are Points n Every ray is represented as a point in 5D space (R 5 ) (x,y,z,u,v) where (u,v) is the directional component, and (x,y,z) is the origin (x,y,z) (u,v) -Y +X This ray is (x,y,z) inside box in direction (u,v) on +X plane There are 6 planes -X,+X,-Y,+Y,-Z,+Z

23 23 Ray Classification – 5 Tasks n E is the subset of R 5 containing every possible ray in the scene n E 1, E 2, …, E n is a partition of E formed as a 32-tree –The 5D hypercube can be split along each of its axis to form 32 children, and so on… n For each E i there will be a C i - a set of objects intersected by at least one of the ray s in E i n For any ray find the E i to which it belongs n Then intersect it with the objects in C i n (see details in the book – the important aspect to undrestand is the idea of ray classification – similar rays will intersect similar groups of objects!).

24 24 Virtual Light Field Approach n Very recent development n For a fixed ‘uniformly distributed’ set of rays, find for each ray all of its intersections with objects in the environment n Each ray maintains a list of objects it intersects (and where along the ray) n Given any arbitrary ray that emerges in ray tracing, find the closest ray in the ray set, and use the rays that this intersects as a candidate set of objects. n Several complications – but the idea is clear.

25 25 Summary n Ray intersection is computationally expensive and we need to reduce it n Methods used fall into 3 classes Bound the objects Partition the object space Partition the ray space n Ray tracing can be tremendously speeded up by appropriate use of modern hardware (see papers of Ward et al, and also UCL’s Virtual Light Field project www.cs.ucl.ac.uk/vlf ).


Download ppt "1 Speeding Up Ray Tracing Images from Virtual Light Field Project www.cs.ucl.ac.uk/vlf ©Slides Anthony Steed 1999 & Mel Slater 2004."

Similar presentations


Ads by Google