Skip to content

if scene use skybox , then mesh material disable depthTest and depthWrite no show #15304

@dytmh

Description

@dytmh

If the scene uses skybox via scene.background, it's not possible to see the mesh when depthTest and depthWrite of its materials is set to false.

envMap = new THREE.CubeTextureLoader()
.setPath( 'textures/cube/skyboxsun25deg/')
.load( [ 'px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg' ] );
scene.background = envMap;

var lineMaterial = new THREE.MeshBasicMaterial();
lineMaterial.color.setHex( 0xDAA520 );
material.depthTest = false;
material.depthWrite = false;

var lineGeometry = new THREE.BoxBufferGeometry( 10, 10, 10 );
var lineEntity = new THREE.Mesh( lineGeometry, lineMaterial );
scene.add( lineEntity );

image

Three.js version
  • Dev
  • r98
  • ...
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions