question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebGLRenderer: background is not set to transparent on 0.137.0 version

See original GitHub issue

Describe the bug We upgrades the threejs version recently from 0.131.3 to 0.137.0 https://github.com/tensorflow/tensorboard/commit/420916a6e4c80740432f1e2bd0c83d6dd145da10. It breaks our repo by not setting the background to black. (see screenshots before) After debugging we found the cause is from the background is not set to transparent by “alpha: true”. (which means, we can fix our issue by adding renderer.setClearColor(0x000000, 0);) Is there any changes from the version that makes this stop working?

To Reproduce You can reproduce the issue by clone our repo. Checkout to the upgrade comment and run TensorBoard (https://github.com/tensorflow/tensorboard). However it requires some demo data to run the card. Let me know how I can assist.

Code code point

//ts
   this.renderer = new THREE.WebGLRenderer({
      canvas: canvas as HTMLCanvasElement,
      context: canvas.getContext('webgl2', {
        antialias: true,
        precision: 'highp',
        alpha: true,
      } as WebGLContextAttributes) as WebGLRenderingContext,
    });

Screenshots before (0.131.3) Screen Shot 2022-02-14 at 3 50 06 PM

after (0.137.0) Screen Shot 2022-02-14 at 4 04 13 PM

Platform:

  • Device: Desktop
  • OS: MacOS
  • Browser: Chrome
  • Three.js version: 0.131.3 (works) 0.137.0 (breaks)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Feb 16, 2022

Correct. I recommend the first one though. Creating a rendering context manually should only be done if there is a compelling reason.

1reaction
japie1235813commented, Feb 15, 2022

Thanks for the reply! Moving the params out of context fixes the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Set WebGLRender background to transparent
If you want a transparent background with WebGLRenderer , you need to set alpha = true in the WebGLRenderer constructor. You can then...
Read more >
WebGLRenderer – three.js docs
The WebGL renderer displays your beautifully crafted scenes using WebGL. ... If you do not require dynamic lighting / shadows, you may set...
Read more >
Scene Background Transparent - Google Groups
I am looking to remove the background from the scene, in other words make it transparent. The regular WebGL technique does not work....
Read more >
Changing three.js background to transparent or another color ...
If you want a transparent background in three.js, you need a pass in the alpha parameter to the WebGLRenderer constructors in the ...
Read more >
The Big List of three.js Tips and Tricks!
Set the background color to something other than black#. Staring at a black canvas? It's hard to tell whether something is happening or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found