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.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mrdoobcommented, Nov 26, 2018

Perhaps the background should be rendered first.

Yeah… The fact that it renders last is supposed to be to avoid drawing pixels twice. It’s a optimisation that keeps bumping into cases where it creates issues.

I agree, we should change it so it renders first. It’ll be better to favour something robust better than something optimal but delicate.

0reactions
mrdoobcommented, Nov 27, 2018

Hmm… changing the .pop() for a .unshift() here? And passing the transparent objects render list instead?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Disable depthTest and depthWrite on entire mesh ...
Hi, I've made a simple gun which clips through the wall. So in order to fix it I created a new material, disabled...
Read more >
glDisable(GL_DEPTH_TEST) makes nothing but Sky-Sphere ...
I'm trying to render a spherical Skybox for my scene and for some reason when I Disable depth testing before doing so, the...
Read more >
ShaderLab: Culling & Depth Testing - Unity - Manual
Controlling Culling is useful for more than debugging backfaces. If you have transparent objects, you quite often want to show the backfacing side...
Read more >
Material#depthTest – three.js docs
Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower...
Read more >
WebGL Fun - The Code
By default, ThreeJS already has built in materials for most of the ... be coved later in the post // her we remove...
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