1 / 17

Applied Spatial Hash Function in Ray Tracing

Applied Spatial Hash Function in Ray Tracing. By : Jaruwan Mesit. Optimized ray tracing. In class, we have learned two methods Bounding Volume Hierarchy Grid New method Spatial Hash function (My project). Bounding Volume Hierarchy. Sort all objects in the scene

dyllis
Download Presentation

Applied Spatial Hash Function in Ray Tracing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Applied Spatial Hash Function in Ray Tracing By : Jaruwan Mesit

  2. Optimized ray tracing In class, we have learned two methods • Bounding Volume Hierarchy • Grid New method • Spatial Hash function (My project)

  3. Bounding Volume Hierarchy • Sort all objects in the scene • Create the tree from sorted objects • Create the bounding boxes to bound the objects in the same leave • Find the intersection between ray and bounding volume

  4. Grid (1) • Create grid from the scene • Create bounding box in every object in scene • Create the list of the object in the grid by comparing minimum and maximum points of bounded objects and grid (complex) • If ray pass through the grid • Check if the ray also pass the objects Some case is better than Bounding Volume Hierarchy but some case not. ******** We can do something easier********

  5. Grid (2)

  6. Spatial Hash Function (1) • Simple and no comparison • Using hash function and hash table

  7. Spatial Hash Function (2) • Create grid • Give the index to grid by using spatial hash function which hashes to minimum point of Grid Index = ( floor(Grid.min.x / length) * xprime+ floor(Grid.min.y / height) * yprime + floor(Grid.min.z / width) * zprime) % bucketsize; length = Grid length height = Grid height width = Grid width xprime, yprime, zprime = any prime number for x, y, and z • Now we have Grid with the index.

  8. Spatial Hash Function (3) Grid 1 Index 1 Grid 2 Index 2 Grid 3 Index 3 Grid 4 Index 4 Grid 5 Index 5

  9. Spatial Hash Function (4) • Create the bounding box to bound every object in scene • Create hash table by using the same hash function

  10. Spatial Hash Function (5) • = point[1..8] • HashIndex = ( floor(point[1..8].min.x /length) • * xprime+ • floor(point[1..8].min.y /height) • * yprime + floor(point[1...8].min.z /width) • * zprime) % bucketsize; • Put the object name into the hash index

  11. Spatial Hash Function (6) Hash Index Object 1 Object 2 Object4 1 • Now We have • Hash table • List of Grid • and Index 2 Object 1 Object 4 3 Object 3 4 Object 4 Grid 1 Index 1 Grid 2 Index 2 Grid 3 Index 3 Grid 4 Index 4 Grid 5 Index 5

  12. Spatial Hash Function (7) Ray Pass Through Grid 1 Grid 1 Index 1 Grid 2 Index 2 Grid 3 Index 3 Grid 4 Index 4 Grid 5 Index 5 Hash Index Object 1 Object 2 Object4 1 Find Intersection with object 1, 2, and 4

  13. Experiments Spatial Hash Function (8)

  14. ProblemGrid and hashing function These two girds have to be compute for intersection. This is the problem why hashing function and grid spend time more than bounding volume hierarchy in some case.

  15. Distributed objects If the objects are distributed among grid, hashing function and grid are better than bounding volume hierarchy.

  16. Images

  17. End • Question?

More Related