0

I created a skybox on a Three.js canvas like this:

var urls = [
  'pos-x.jpg',
  'neg-x.jpg',
  'pos-y.jpg',
  'neg-y.jpg',
  'pos-z.jpg',
  'neg-z.jpg'
]
window.cubemap = THREE.ImageUtils.loadTextureCube(urls);
cubemap.format = THREE.RGBFormat;
window.shader = THREE.ShaderLib['cube']; 
shader.uniforms['tCube'].value = cubemap; 

window.skyBoxMaterial = new THREE.ShaderMaterial( {
  fragmentShader: shader.fragmentShader,
  vertexShader: shader.vertexShader,
  uniforms: shader.uniforms,
  depthWrite: false,
  side: THREE.BackSide
});

window.skybox = new THREE.Mesh(
  new THREE.BoxGeometry(1000, 1000, 1000),
  skyBoxMaterial
);

skybox.position.set(0, 0, 0);

scene.add(skybox);

My problem is that any 'div' I try to add above the canvas is hidden behind the skybox whatever z-index I give it. They show up if I do not add the skybox. Does anybody know why and how to fix it?

4

1 回答 1

0

我在 HTML 正文中的 Three.js 画布标记之后添加了 div,它起作用了。

于 2015-02-10T11:42:31.280 回答