Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 1 of 1

Thread: Efficient way to return all boxes hit by a ray.

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2016

    Efficient way to return all boxes hit by a ray.

    Im not sure if Im right in this forum because my question is not realy about openGL.
    I have an idea how I could solve the problem in the title but I want to know your oppinion about that before I waste time In programming something not working.

    Basicly the idea is to have a grid of boxes with height = width, all of these boxes are the same size and they don't have a gap between each other, I also have a function to calculate the box index which belongs to a point.

    Now I calculate a box around the grid and calculate the hit points of a ray with it.
    So I know the intersection points and of course the rays direction, now I take the direction, normalize it and devide it by 2. ( Im not realy sure if I need /2 but I feel better with it)
    The resulting vector is now my "step size". (I call this vector v)
    So if I take now my first intersection point add v, calculate the box which belongs to the resulting point and do this again and again until I reach my second intersection point I shouldn't miss any box. (rigth ?)

    But Im not sure about that so I ask for your oppinion.

    Last edited by _NoName_; 05-25-2017 at 03:15 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts