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 3 of 3

Thread: Object Tagging in color buffer

  1. #1
    Intern Contributor
    Join Date
    Sep 2008
    Posts
    65

    Object Tagging in color buffer

    Hi,

    I am reading the article on object Tagging in color buffer.

    http://www.opengl.org/resources/code...es/node36.html

    I didnt get what is stored in the 24 bit buffer??? color??If so if an object entirely consists of a same color,how can i select a particular fragment,If I want to edit it.

    Thanks & Regards,
    brett.

  2. #2
    Advanced Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    556

    Re: Object Tagging in color buffer

    That's not really the intention of this method, or the article you link to.

    The idea is that an entire object, or individual surfaces in an object, are drawn in their own unique colour. (The "uniqueness" of the colour is limited by the colour buffer's resolution. So in theory you could use ranges on surfaces or many slightly different colours for individual faces - up to the limit of the current colour depth's resolution.) You then read back from the colour buffer after drawing is complete and the unique colour you get back for a specific pixel identifies the object (or surface).

    Blending, depth buffering etc. all have an affect on the results you get from the colour buffer, and which object (if any) that you end up "picking". Blending (for example) would almost definitely break this method as it is described above.

    It's summed up in the final paragraph:

    One disadvantage of using the color buffer is that the color buffer can only hold a single identifier at each pixel. If depth buffering is used, then the pixel will hold the object name corresponding to a visible surface. If depth buffering is not used, then a pixel hold the name of the last surface drawn. The OpenGL selection mechanism can return a hit record for all objects that intersect a given region. The application is free to choose one of the intersecting objects using a separate policy, e.g. the object closest to the viewer, iterate through all of the objects one at a time, etc.

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882

    Re: Object Tagging in color buffer

    This is a lot like Damian's Light Indexed Deferred Rendering. You might read over his write-up for more details on how rendering can work differently when you store "ID"s in the color buffer. The main difference between this and his technique is that light indices instead of object indices are stored.

Posting Permissions

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