Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
A-Frame - rendering to a RenderTarget causes screen flickering, in VR mode only

I wrote a custom shader for Conway's Game of Life, using three.js and A-Frame, which does all processing in the fragment shader. It works perfectly in a web browser on desktop. It also appears to work in the Quest browser, but when entering VR mode, the entire screen begins to flicker between the scene and a black screen.

I suspect that the problem is with the RenderTarget settings, or the way in which I switch between render targets, but I am not sure. The relevant code occurs within an A-Frame component tick function, which periodically switches between two render targets and back to the main scene as follows:

this.el.sceneEl.renderer.setRenderTarget(this.renderTarget0);
this.el.sceneEl.renderer.render(this.rtScene0, this.rtCamera);

this.el.sceneEl.renderer.setRenderTarget(this.renderTarget1);
this.el.sceneEl.renderer.render(this.rtScene1, this.rtCamera);

this.el.sceneEl.renderer.setRenderTarget(null);

If it is relevant, I have also disabled the depth buffer on the RenderTarget objects. The full code is available on GitHub at https://github.com/stemkoski/A-Frame-Examples/blob/master/conway-shader.html and a live version is at https://stemkoski.github.io/A-Frame-Examples/conway-shader.html.

My question is: how can I stop the screen from flickering in VR mode, while using RenderTargets in A-Frame?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you follow Mugen87 comment quoted by Marquizzo ( " The idea is to disable xr, perform the rendering and then enable xr again"). All is working fine in VR. To disable XR and shadow map before the gpgpu computation do:

this.el.sceneEl.renderer.xr.enabled = false;
this.el.sceneEl.renderer.shadowMap.autoUpdate = false;

And reactivate it after with (if in vr):

this.el.sceneEl.renderer.xr.enabled = true;
this.el.sceneEl.renderer.shadowMap.autoUpdate = true;

Working A-Frame source code :

https://glitch.com/edit/#!/experienced-political-share?path=index.html%3A204%3A12

Demo:

https://experienced-political-share.glitch.me/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!