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.

Depth Test Doesn't Work When Depth Buffer Set to False While Creating Render Target

See original GitHub issue
Description of the problem

This is an image from webgl_rtt.html sample.

screen shot 2017-07-17 at 10 47 55 am

When I set depthBuffer to false, the depth test doesn’t work.

rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBFormat, depthBuffer: false } );
Three.js version

Current version

Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
WestLangleycommented, Jul 19, 2017

Depth testing in the render target requires a depth buffer so there is something to depth test against.

The fiddle appears to be working as expected. https://jsfiddle.net/p4ob9d2e/2/

1reaction
immiaocommented, Jul 18, 2017

Here’s the jsfiddle:

https://jsfiddle.net/p4ob9d2e/

Change line 76 to depthBuffer: true then it works well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Depth test inverted by default in OpenGL, or did I get it wrong?
By clearing the depth buffer to 1, you are essentially saying that all objects closer than the maximum depth should be drawn. Changing...
Read more >
Depth test for custom framebuffer not working - Khronos Forums
The problem is that the depth testing for the local rendering doesn't work. The result of the rendering operation depends on the order...
Read more >
opengl - FBO Depth Buffer not working
I have set glClearDepth(1.0) and I clear bot the COLOR_BUFFER_BIT and DEPTH_BUFFER_BIT before I draw to the FBO, however the value is still...
Read more >
Depth testing - LearnOpenGL
OpenGL performs a depth test and if this test passes, the fragment is rendered and the depth buffer is updated with the new...
Read more >
Configuring Depth-Stencil Functionality - Win32 apps
Set DepthEnable to FALSE to disable depth testing and prevent ... When a buffer is used as a render target, depth-stencil testing and ......
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