All Questions
Tagged with depth-buffer webgl
28
questions
0
votes
1
answer
66
views
WebGL screen to world coordinate
I'm creating a 3D globe with elevation:
I now want to add click detection to get a 3D world xyz position from a 2D screen xy + depth (from a click). I'm using the following code (inspired from ...
2
votes
1
answer
754
views
Can I read single pixel value from WebGL depth texture in JavaScript?
In short
I would like to read a single pixel value from a WebGL 2 depth texture in JavaScript. Is this at all possible?
The scenario
I am rendering a scene in WebGL 2. The renderer is given a depth ...
0
votes
1
answer
65
views
Is it possible to use texSubImage2D on a depth texture?
I'm following this tutorial on 2D shadow mapping and I've gotten it working in WebGL. Now, I am looking to develop a way to recompute single rows in the depth texture, without clearing the entire ...
0
votes
1
answer
2k
views
Webgl - Rendering depth to texture returns gl.INVALID_FRAMEBUFFER_OPERATION in Safari
If you look at the following snippet in Safari (taken from https://webglfundamentals.org/webgl/lessons/webgl-shadows.html), you will notice it looks different than in other browsers, because the depth ...
0
votes
1
answer
172
views
If you need a depth buffer or use the DEPTH_BUFFER_BIT flag in WebGL for 2D and/or parallax
Wondering about parallax in WebGL, which in my mind at least involves depth of the different layers.
Wondering if this has anything to do with a depth buffer and/or using DEPTH_BUFFER_BIT. I have a ...
1
vote
1
answer
482
views
How to acquire mapbox-gl-js z-buffer
I'm developing webgl application, where I draw detailed building on top of mapbox-gl-js.
Everything goes fine except one detail, I don't know how to acquire depth buffer of every drawn frame.
In ...
3
votes
0
answers
75
views
Surface Elimination not proper in my webgl code
Three triangles are rotating clockwise around the y-axis. However, there are some "surface elimination" problems when the triangles overlap. All the time, only one triangle remains in front. I have OR ...
1
vote
2
answers
3k
views
Implementing depth testing for semi-transparent objects
I've been carefully trolling the internet for the past two days to understand depth testing for semi-transparent objects. I've read multiple papers/tutorials on the subject and in theory I believe I ...
1
vote
1
answer
1k
views
Depth Buffer Clear Behavior between Draw Calls?
I have been testing WebGL to see whether I can batch-draw polygons in a particular way. I am going to simplify the use case, but it goes something along the lines of the following:
First, my vertices ...
4
votes
1
answer
3k
views
Pack depth information in a RGBA texture using mediump precison
Trying to understand the many issues related to the WebGL development for a generic mobile target, now I need to store depth information in a texture attachment for later retrieval and post-processing....
2
votes
1
answer
1k
views
How to access the values of the depth buffer outside of WebGL context?
Given a WebGL scene (created from THREE.js), how would you go about accessing the floating point values (as an array of data outside of the WebGL context) from the DEPTH_ATTACHMENT given the ...
5
votes
2
answers
5k
views
Linear depth buffer
Many people use usual perspective matrix with third line like this:
(0 0 (n+f)/(n-f) 2*n*f/(n-f))
But it has problem with float precision near far clipping surface. The result is z-fighting.
What ...
2
votes
1
answer
1k
views
WebGL2 FBO depth attachment values
I'm simply trying to render the depth values of my scene using WebGL2 like so:
//Texture
depthTexture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, depthTexture);
gl.texImage2D(gl.TEXTURE_2D, ...
1
vote
0
answers
240
views
Three js depth buffer, power of 2 textures?
I am rendering the depthbuffer of my scene to a texture, so that I can use it in a later pass for position and normal reconstruction. My question is whether the fact that the buffer is not power of 2 ...
6
votes
1
answer
8k
views
How does WebGL set values in the depth buffer?
In OpenGL, depth buffer values are calculated based on the near and far clipping planes of the scene. (Reference: Getting the true z value from the depth buffer)
How does this work in WebGL? My ...