0

How to change the canvas black color to white. This is the code. I want to change its color to white or transparent.

I tried suggestions from this question but nothing has worked from the suggested answers.

var renderer = new THREE.WebGLRenderer({ alpha: true });

renderer.setClearColor( 0xffffff, 0);

Can someone help me how to change the color to white or transparent

Community
  • 1
  • 1
Owais Ahmed
  • 1,364
  • 1
  • 30
  • 62
  • The problem with the code you posted to is the sphere that is being added. If you add the code in your post for white background, then remove the line `scene.add(sphereMesh);` you will get a white background. – 2pha Dec 04 '15 at 00:39
  • i tried this but it is still black – Owais Ahmed Dec 04 '15 at 00:41
  • if i remove this line then i cant see the image – Owais Ahmed Dec 04 '15 at 00:42
  • https://jsfiddle.net/78r60zar/2/. See what image? I don't see any image – 2pha Dec 04 '15 at 00:43
  • jsfiddle is blocking the image due to cross domain – Owais Ahmed Dec 04 '15 at 01:05
  • please check this https://jsfiddle.net/78r60zar/4/ – Owais Ahmed Dec 04 '15 at 01:10
  • Check it for what? I see a rotating scene of an abandoned building. What am I meant to be checking? – 2pha Dec 04 '15 at 01:28
  • by removing scene.add(sphereMesh); i cannot see that building image do you get my point?https://jsfiddle.net/78r60zar/6/ – Owais Ahmed Dec 04 '15 at 01:30
  • Why would you need a transparent background if you are covering it with sphere environment anyway? Your transparent background was probably working all along, it was just covered with the sphere environment. – 2pha Dec 04 '15 at 01:32
  • i want to remove the black background and i want that backgound to be transparent or white. – Owais Ahmed Dec 04 '15 at 01:35
  • 1
    ?? But you have the panorama as a background. You cant have a panorama and a transparent background. I really don't understand – 2pha Dec 04 '15 at 01:43
  • The black color appears before loading the panorama and i simply need to make that black color to white. – Owais Ahmed Dec 04 '15 at 02:54
  • to add on what @2pha already told you, just get your camera farther and you'll see that the background is actually transparent : https://jsfiddle.net/78r60zar/7/ – Kaiido Dec 04 '15 at 05:10
  • in this one https://jsfiddle.net/78r60zar/4/ how can i remove the black color? – Owais Ahmed Dec 04 '15 at 05:11
  • that's exactly the one I tweaked... Just set the `renderer.setClearColor( 0xffffff, 0);`and move your camera away from your sphere Mesh. – Kaiido Dec 04 '15 at 05:45

0 Answers0