Results 1 to 4 of 4

Thread: An alpha-based visibility test?

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    28

    An alpha-based visibility test?

    Hi,
    Here is what I am trying to do:
    Let's say I have CUBE_A and CUBE_B and a CAMERA (at some pre-specified position), and CUBE_A and CUBE_B are located in the scene such that CUBE_A is in front of (and blocks the visibility of) CUBE_B.

    Let's say then that I want to allow the user to perform a translation on CUBE_B but before doing so test whether the visibility of CUBE_A will change as a result.

    So, if I move CUBE_B in front of CUBE_A, CUBE_A will no longer be visible, and in such a case, this translation of CUBE_B is not allowed.

    More specifically, I want to test not only whether CUBE_A is still visible but whether the same portion of CUBE_A is visible (since there may be cases of partial visibility blocking).

    I was thinking one way to achieve this might be to render an alpha image of CUBE_A where the portion of the cube that is visible to the camera is white and everything else is black. Then compare this image with another alpha image of CUBE_A after the translation of CUBE_B and if the two alpha images are the same, then the translation of CUBE_B is legal.

    There may be another way to do this, can anyone provide guidance? Thanks!


  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: An alpha-based visibility test?

    If your hardware supports it, ARB_occlusion_query extension might interest you.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2008
    Posts
    28

    Re: An alpha-based visibility test?

    Hey,
    thanks - that is a great idea... test the number of visible pixels rather than testing each pixel. In some very rare circumstances, the test could have a false negative I suppose, but almost always would be reliable... and would cut down on the overhead of checking each pixel.
    But I'm not certain that my hardware does support this.
    Anything more generally supported that might be useful?

  4. #4
    Senior Member Regular Contributor remdul's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands
    Posts
    346

    Re: An alpha-based visibility test?

    Occlusion queries should be supported on virtually all modern graphics hardware.

Similar Threads

  1. vertex visibility test
    By jinho89 in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 02-24-2004, 02:26 PM
  2. vertex visibility test
    By jinho89 in forum OpenGL: General
    Replies: 3
    Last Post: 02-24-2004, 01:52 PM
  3. An idea: Hardware accelerated tree-based visibility test
    By Toxigun in forum OpenGL: Advanced Coding
    Replies: 28
    Last Post: 03-18-2002, 11:52 AM
  4. visibility test
    By elmargo in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 07-22-2000, 04:48 PM
  5. Test for visibility
    By Shayde in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 04-09-2000, 01:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean