Stencil Buffer and Vr

Description of the problem

I’m trying to use the stencil buffer with ThreeJs and webvr. The problem is the render call always does submitFrame to the vr device which then clears the drawing buffer.

My code is basically doing:

  1. Setup the stencil buffer by rendering my “stencil” scene
  2. Draw to the “true” value of the stencil buffer using the scene that goes inside the stencil
  3. Draw to the “false” value of the stencil buffer using the scene that goes outside the stencil buffer.

But unless I have preserveDrawingBuffer set to true, I get a lot of flicker and only the last scene shown.

Looking at the ThreeJS render code there is:
if ( vr.enabled ) {
vr.submitFrame();
}

Which clears the drawing buffer.

Is there another supported way to do this? Or can the vr submit frame be de-coupled from the render call (Through a flag that defaults to true I’m guessing)

Three.js version

r88

Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

1 thought on “Stencil Buffer and Vr

  1. This is no longer an issue in v.114 (possibly even earlier). Stencils now work without the suggested PR too.

Comments are closed.