Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Mesh Intersecton

  1. #1
    Intern Contributor
    Join Date
    Mar 2008
    Posts
    91

    Mesh Intersecton

    I have a vrml model (wml file) that I need to shoot some rays at to get the distance from a point (similar to ray tracing, but i just need the coordinates of the intersection, nothing about the light). Do I have to determine the intersection of the ray with every triangle in the mesh, then take the closest one? or is there a better way to do this?

    Thanks,

    Dave

  2. #2

  3. #3
    Intern Contributor
    Join Date
    Mar 2008
    Posts
    91

    Re: Mesh Intersecton

    Right right, I am familiar with some of those methods for determining if a ray intersects a triangle, but if I am shooting thousands of rays at a mesh made of thousands of triangles, it seems like there should be some built in method of intersecting a ray with the whole mesh, ie.

    Ray.Intersect(Mesh)

    or something, so I don't have to implement the actual loop to go through the triangles. Am I way off base here?

    Thanks,

    Dave

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    767

    Re: Mesh Intersecton

    You can optimize the process by first testing against the Bounding box (or sphere) of each object. You could also implement something like an Oct Tree to "split up" your mesh (so you test against the various levels of the Oct tree until you get to the lowest level, then you test against the poly's in that Oct Tree). But ultimately, if you want to know where your ray hits your mesh, then you'll have to test against each of the poly's in the mesh. The only "built in" method is to use Picking (which I've never done) - but that has it's own set of issues when dealing with individual poly's (as I understand it).

  5. #5
    Intern Contributor
    Join Date
    Mar 2008
    Posts
    91

    Re: Mesh Intersecton

    Does anyone have/know where I can get some canned c++ code to do some of this stuff (loading an obj file, triangle intersection, mesh intersection, etc)?

Posting Permissions

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