XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

GPU Collision Detection

Last post 11/13/2008 12:22 AM by skytigercube. 2 replies.
  • 11/12/2008 2:10 AM

    GPU Collision Detection


    has anybody done any work on this?

    I am considering this:

    on xbox - large index buffer containing vertex index pairs

    0,1 means compare item 0 with item 1
    0,2 etc.
    0,3 no duplicates
    1,2
    1,3
    2,3

    one vertex buffer containing: world position, radius, objectid

    then render to mip mapped texture with 1 pixel per comparison

    if collision then render index# (packed) to pixel color otherwise (0, 0, 0, 0)



    then using layers of mip map as fast index to find collision pairs

    if top layer is black - no collisions
    if top layer is grey - go to next layer and check

    this should allow 1 collision in 1,000,000 pairs to be found in only 20 pixel reads from the texture


    idea for solving gpu stall on readback:
    render to three textures in a cycle - read back texture 3 frames late just before start of new frame
    do not re-use vertexbuffer slot for 3 frames - ignore duplicate collisions


    this also works for me as I have alot of particles whose positions are calculated from formulas
    based on elapsed time - the cpu has no idea where they are and does not care until they collide
    (although it can perform the same calculation as the gpu to find out)




  • 11/12/2008 9:38 PM In reply to

    Re: GPU Collision Detection

    There is a nice article on the front page of gamedev.net about this right now.
  • 11/13/2008 12:22 AM In reply to

    Re: GPU Collision Detection


    Brilliant article!

    http://www.gamedev.net/reference/programming/features/gpuBoundingSphere/

    Thanks for pointing that out.



Page 1 of 1 (3 items) Previous Next