osgoculusviewer icon indicating copy to clipboard operation
osgoculusviewer copied to clipboard

How can I enable stencil functionality?

Open keugbang opened this issue 3 years ago • 4 comments

Hello, I was wondering how to enable the stencil functionality. I simply thought that modifying OculusDevice::createRTTCamera would make it work but failed.

What I did was to add stencil buffer bit to the camera clear mask, and replace depth buffer attachment with the following statement: camera->attach(osg::Camera::PACKED_DEPTH_STENCIL_BUFFER, GL_DEPTH_STENCIL_EXT);

keugbang avatar Jul 07 '21 04:07 keugbang

I am a bit unsure of what you are trying to achieve. However, the Oculus SDK uses the depth buffer for Asynchronous Spacewarp calculations, so modifications of the depth buffer might have unexpected consequences.

bjornblissing avatar Jul 10 '21 15:07 bjornblissing

Could there be a way to add stencil buffer in addition to the existing depth buffer? Please forgive me. I may be asking a silly question since my knowledge in OSG and Oculus is limited. I am trying to implement a Head Up Display where symbols are projected onto the transparent mirror. I was able to achieve this before with general(?) OSG viewer setup and now I am trying to make it work with the Oculus.

keugbang avatar Jul 18 '21 22:07 keugbang

The Oculus SDK have a functionality called layers. There exists a separate layer type called Quad which should be used for HeadUpDisplays and similar head locked graphics: https://developer.oculus.com/documentation/native/pc/dg-render/#layers

bjornblissing avatar Jul 19 '21 10:07 bjornblissing

I am sorry that I didn’t explain in detail. What I meant by Head Up Display was a 3D model of a HUD in a fighter aircraft where information is projected on to the transparent mirror in front of the cockpit. The ‘quad’ layer of Oculus SDK looks like a 2D screen-fixed overlay.

keugbang avatar Jul 19 '21 22:07 keugbang