if scene use skybox , then mesh material disable depthTest and depthWrite no show
See original GitHub issueIf 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 );
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:
- Created 5 years ago
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Hmm… changing the
.pop()
for a.unshift()
here? And passing the transparent objects render list instead?