0

A picture being worth a thausand words :

enter image description here

I would like to have the black background replaced with the fog color (the violet color). Here is some code :

var fogColor = 0xeab5ef

//...

renderer = new THREE.WebGLRenderer();
renderer.setClearColor(fogColor);
element = renderer.domElement;
container = glFrame;
container.appendChild(element);
effect = new THREE.StereoEffect(renderer);

// ...
camera = new THREE.PerspectiveCamera(90, window.innerWidth / window.innerHeight, 0.001, 800);

// ...
scene.fog = new THREE.FogExp2(fogColor, .0029)

On the DOM side, every parent of the canvas and itself has background:transparent

Any ideas why this happens ?

Marcel Falliere
  • 1,884
  • 21
  • 39
  • Use various methods http://stackoverflow.com/questions/16177056/changing-three-js-background-to-transparent-or-other-color maybe depending on version. – Leroy Thompson Jul 22 '16 at 00:36

1 Answers1

0

have you tried renderer.setClearColor(fogColor,1);?

it might be black because your alpha value is zero

Thomasn
  • 483
  • 3
  • 7
  • I tried it all and finally gave up, pasted the terrain with fog example, then migrated my code to this skeleton and ... bouya! it works. So I don't know what caused the black background, but now it works. – Marcel Falliere Jul 24 '16 at 14:27