Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: virtual object occluded by real object

  1. #11
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    20
    Quote Originally Posted by aqnuep View Post
    Presenting your real scene goes to the line I've noted as "render real world picture as a full screen quad", not before glClear. That way it cannot clear your image.

    I have no idea how to do that. For building AR I use ARToolkit library. the real scene is automatically appeared, when the init routine (in ARToolkit) is called . Inside the init routine there are function to create window, open video path, and etc. thanks

  2. #12
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Quote Originally Posted by deduu10 View Post
    I have no idea how to do that. For building AR I use ARToolkit library. the real scene is automatically appeared, when the init routine (in ARToolkit) is called . Inside the init routine there are function to create window, open video path, and etc. thanks
    Well, if you already have your image in the OpenGL back buffer then just proceed with the steps after the the "render real world picture as a full screen quad" step then.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #13
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    20
    Quote Originally Posted by aqnuep View Post
    Well, if you already have your image in the OpenGL back buffer then just proceed with the steps after the the "render real world picture as a full screen quad" step then.

    Hii Aqnuep,

    if you don't mind, I wanna ask another question. Consider I have two objects, let's say a cube and a sphere. I wanna occluded the sphere with my cube. But before doing that, I wanna changed every pixel of the cube to be the pixel of my backgroud. therefore, when my cube occluded my sphere, it displayed the color of my background with the shape of cube. Can you help me how to do that?

    thanks

  4. #14
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Sorry but I don't understand completely what is your scenario.

    So you have a real world image, having a cube in it and a sphere rendered? You want the real world cube to hide the sphere or the other way around? Also, what do you mean by the "color of your background"? You mean the real world image pixels?
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  5. #15
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    20
    Quote Originally Posted by aqnuep View Post
    Sorry but I don't understand completely what is your scenario.

    So you have a real world image, having a cube in it and a sphere rendered? You want the real world cube to hide the sphere or the other way around? Also, what do you mean by the "color of your background"? You mean the real world image pixels?
    Yes, I did. I said the color of my background e.g black, and did not talk about the real scene to simplify the scenario. it is exactly of what you said. I have a real world image, consists of real cube, virtual cube and sphere. as the virtual cube has been accurately registered to real cube, the projective position of virtual cube in the image plane is known. therefore, before occluding the sphere with the cube, I want to change every pixel of the virtual cube with the real one. after that, by making use of OpenGL depth buffer, every pixel of virtual sphere which depth value is less than 1.0 will be replaced by the pixel from the real cube's image.

  6. #16
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Quote Originally Posted by deduu10 View Post
    therefore, before occluding the sphere with the cube, I want to change every pixel of the virtual cube with the real one.
    You don't need to redraw the pixels of the cube, simply don't render it to the color buffer in the first place. When you render your virtual cube, simply disable all components of the color masks as I specified in an earlier post. That's all. Then when you render your cube, only the depth buffer is updated but you don't update any pixels of the screen. Then re-enable the color mask when rendering the sphere so that those pixels will get their way to the color buffer too.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  7. #17
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    20
    Quote Originally Posted by aqnuep View Post
    You don't need to redraw the pixels of the cube, simply don't render it to the color buffer in the first place. When you render your virtual cube, simply disable all components of the color masks as I specified in an earlier post. That's all. Then when you render your cube, only the depth buffer is updated but you don't update any pixels of the screen. Then re-enable the color mask when rendering the sphere so that those pixels will get their way to the color buffer too.
    Well, understood.. but, if I render the sphere after the cube, the depth value of my sphere is less than the cube so that the real scene pixel (from disabling glColorMask) will be occluded by the pixel of the sphere. Is it true according to my knowledge? Please correct me if i'm wrong.. thanks.

Posting Permissions

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