# \#depth

**URL:** https://discourse.threejs.org/tag/depth/1386.md

[Latest](https://discourse.threejs.org/latest.md) · [Categories](https://discourse.threejs.org/categories.md) · [Tags](https://discourse.threejs.org/tags.md)

---

## [Does three.js WebGPU support reverse z-buffer?](https://discourse.threejs.org/t/does-three-js-webgpu-support-reverse-z-buffer/87687)

<div class="topic-metadata">

**Author:** [@torrent](https://discourse.threejs.org/u/torrent)\
**Replies:** 6\
**Last updated:** [December 7, 2025, 7:48pm UTC](https://discourse.threejs.org/t/does-three-js-webgpu-support-reverse-z-buffer/87687 "2025-12-07T19:48:32Z")

</div>

Does three.js WebGPU support reverse z-buffer? If so, should I use it instead of logarithmic depth buffer?

---

## [Use depth in effect composer pass](https://discourse.threejs.org/t/use-depth-in-effect-composer-pass/86586)

<div class="topic-metadata">

**Author:** [@Dr.Mystery](https://discourse.threejs.org/u/Dr.Mystery)\
**Replies:** 3\
**Last updated:** [September 3, 2025, 12:16am UTC](https://discourse.threejs.org/t/use-depth-in-effect-composer-pass/86586 "2025-09-03T00:16:54Z")

</div>

Hi, I want to implement a shader that renders on top of a previous pass and is able to read the depth buffer value. For context, I do ray marching in the scene after the regular geometry has rendered, but I want the geo…

---

## [World position from depth using webgpu/TSL](https://discourse.threejs.org/t/world-position-from-depth-using-webgpu-tsl/82414)

<div class="topic-metadata">

**Author:** [@LoreFleur](https://discourse.threejs.org/u/LoreFleur)\
**Replies:** 1\
**Last updated:** [May 12, 2025, 2:35pm UTC](https://discourse.threejs.org/t/world-position-from-depth-using-webgpu-tsl/82414 "2025-05-12T14:35:36Z")

</div>

I am trying to reconstruct the world position of any geometry contained within a volume (a BoxGeometry to which the shader material is applied) using the depth buffer. And I am trying to do this with the webgpu renderer …

---

## [Reflight Studio - Ultra-skilled AI Camera & Photo Editor](https://discourse.threejs.org/t/reflight-studio-ultra-skilled-ai-camera-photo-editor/78828)

<div class="topic-metadata">

**Author:** [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Replies:** 0\
**Last updated:** [March 1, 2025, 2:04pm UTC](https://discourse.threejs.org/t/reflight-studio-ultra-skilled-ai-camera-photo-editor/78828 "2025-03-01T14:04:50Z")

</div>

« Did you know that in terms of coding - React is the most compatible framework for Three.js? » \[ :earth\_africa: Reflight Web \] \[ :green\_apple: iOS \] \[ :space\_invader: Android \] :clap: Hello :clap: and …

---

## [Achieving Depth on Plane Geometry with 2D Texture in Three.js (Displacement Map Alternatives)](https://discourse.threejs.org/t/achieving-depth-on-plane-geometry-with-2d-texture-in-three-js-displacement-map-alternatives/76181)

<div class="topic-metadata">

**Author:** [@Nandan\_Bilagi](https://discourse.threejs.org/u/Nandan_Bilagi)\
**Replies:** 6\
**Last updated:** [January 10, 2025, 3:48am UTC](https://discourse.threejs.org/t/achieving-depth-on-plane-geometry-with-2d-texture-in-three-js-displacement-map-alternatives/76181 "2025-01-10T03:48:48Z")

</div>

I’m trying to create a depth effect on a plane geometry in Three.js using a 2D image texture. However, the displacement map doesn’t provide the desired look. Are there any alternative approaches, such as using front and …

---

## [Is there a way to use ssao When camera far is large?](https://discourse.threejs.org/t/is-there-a-way-to-use-ssao-when-camera-far-is-large/74514)

<div class="topic-metadata">

**Author:** [@samsRich](https://discourse.threejs.org/u/samsRich)\
**Replies:** 6\
**Last updated:** [December 14, 2024, 4:47am UTC](https://discourse.threejs.org/t/is-there-a-way-to-use-ssao-when-camera-far-is-large/74514 "2024-12-14T04:47:37Z")

</div>

I want to use ssao in my scene, but when I change camera far to 1e7,and enable logarithmicDepthBuffer, it seem seem no work.

---

## [What's the difference between linear depth, perspective depth, and orthographic depth?](https://discourse.threejs.org/t/whats-the-difference-between-linear-depth-perspective-depth-and-orthographic-depth/70750)

<div class="topic-metadata">

**Author:** [@torrent](https://discourse.threejs.org/u/torrent)\
**Replies:** 3\
**Last updated:** [September 16, 2024, 8:59pm UTC](https://discourse.threejs.org/t/whats-the-difference-between-linear-depth-perspective-depth-and-orthographic-depth/70750 "2024-09-16T20:59:10Z")

</div>

Studying the code of three.webgpu.js, I come across the terms “linear depth”, “perspective depth”, and “orthographic depth”. I know there is a visual difference between perspective and orthographic projections, but why …

---

## [Object rendering behind](https://discourse.threejs.org/t/object-rendering-behind/68892)

<div class="topic-metadata">

**Author:** [@Gaelle\_Berton](https://discourse.threejs.org/u/Gaelle_Berton)\
**Replies:** 3\
**Last updated:** [August 12, 2024, 6:51pm UTC](https://discourse.threejs.org/t/object-rendering-behind/68892 "2024-08-12T18:51:09Z")

</div>

I havd an object on the scene, rendering behind the scene, i dont understand why, here is the material: const cubeMaterial = new THREE.RawShaderMaterial({ uniforms: {}, vertexShader: \` precision highp flo…

---

## [Raymarching - Correct gl\_FragDepth](https://discourse.threejs.org/t/raymarching-correct-gl-fragdepth/66033)

<div class="topic-metadata">

**Author:** [@Lunatictactoc](https://discourse.threejs.org/u/Lunatictactoc)\
**Replies:** 11\
**Last updated:** [May 30, 2024, 7:27am UTC](https://discourse.threejs.org/t/raymarching-correct-gl-fragdepth/66033 "2024-05-30T07:27:46Z")

</div>

Hello everyone. I’m desperately trying to calculate the depth of my fragment in a shader using raymarching to create a cloudy sky. I tried many things, such as several formulas to calculate the gl\_FragDepth, or even us…

---

## [How to fix the opacity and depth error in instanceUnifromMesh with shader](https://discourse.threejs.org/t/how-to-fix-the-opacity-and-depth-error-in-instanceunifrommesh-with-shader/65806)

<div class="topic-metadata">

**Author:** [@byexman](https://discourse.threejs.org/u/byexman)\
**Replies:** 2\
**Last updated:** [May 21, 2024, 1:27pm UTC](https://discourse.threejs.org/t/how-to-fix-the-opacity-and-depth-error-in-instanceunifrommesh-with-shader/65806 "2024-05-21T13:27:45Z")

</div>

I generated over 10000 blocks using intancedUniformMesh and made the blocks transparent by modifying the uniform opacity in the material shader, but it resulted in a lot of incorrect occlusion. If it is an independent mu…

---

## [Getting The Correct Depth In Ray March Cloud Example](https://discourse.threejs.org/t/getting-the-correct-depth-in-ray-march-cloud-example/64037)

<div class="topic-metadata">

**Author:** [@michealmyers81](https://discourse.threejs.org/u/michealmyers81)\
**Replies:** 3\
**Last updated:** [May 13, 2024, 10:09am UTC](https://discourse.threejs.org/t/getting-the-correct-depth-in-ray-march-cloud-example/64037 "2024-05-13T10:09:43Z")

</div>

Okay, after a few days of banging my head against the wall trying to get depth working in the volume cloud ray march example, I need some help. This is what I have come up with. I’m getting partially decent results, but …

---

## [Getting depth map value from panorama with depth example](https://discourse.threejs.org/t/getting-depth-map-value-from-panorama-with-depth-example/59203)

<div class="topic-metadata">

**Author:** [@Anas\_Ch](https://discourse.threejs.org/u/Anas_Ch)\
**Replies:** 0\
**Last updated:** [December 14, 2023, 6:38am UTC](https://discourse.threejs.org/t/getting-depth-map-value-from-panorama-with-depth-example/59203 "2023-12-14T06:38:45Z")

</div>

Hi to all, I’m trying to get the depth map value from panorama with depth example when moving the mouse : https://threejs.org/examples/webxr\_vr\_panorama\_depth.html i tried using Raycaster but with no success, is there…

---

## [Does the current Nodes system support writing to depth buffer in WebGPU?](https://discourse.threejs.org/t/does-the-current-nodes-system-support-writing-to-depth-buffer-in-webgpu/58463)

<div class="topic-metadata">

**Author:** [@Berthur](https://discourse.threejs.org/u/Berthur)\
**Replies:** 16\
**Last updated:** [December 7, 2023, 3:39pm UTC](https://discourse.threejs.org/t/does-the-current-nodes-system-support-writing-to-depth-buffer-in-webgpu/58463 "2023-12-07T15:39:49Z")

</div>

In WebGL, we can set the fragment depth from within the fragment shader, which writes to the depth buffer: gl\_FragDepthEXT = 0.123; In WGSL, it can be done as follows: struct OutputStruct { @location(0) color: vec4\<f…

---

## [WebGLRenderTarget depth in Chrome vs Firefox](https://discourse.threejs.org/t/webglrendertarget-depth-in-chrome-vs-firefox/53362)

<div class="topic-metadata">

**Author:** [@mcharytoniuk](https://discourse.threejs.org/u/mcharytoniuk)\
**Replies:** 1\
**Last updated:** [June 29, 2023, 6:43pm UTC](https://discourse.threejs.org/t/webglrendertarget-depth-in-chrome-vs-firefox/53362 "2023-06-29T18:43:40Z")

</div>

Hello! I have some issues with my scene. It looks OK in Firefox, but also looks completely wrong in Chrome. Each of those “tiles” is a portal to a different scene. Each has a different WebGLRenderTarget assigned to it.…

---

## [Calculate the camera z position based on a number of factors](https://discourse.threejs.org/t/calculate-the-camera-z-position-based-on-a-number-of-factors/52266)

<div class="topic-metadata">

**Author:** [@cswkim](https://discourse.threejs.org/u/cswkim)\
**Replies:** 2\
**Last updated:** [May 31, 2023, 11:07pm UTC](https://discourse.threejs.org/t/calculate-the-camera-z-position-based-on-a-number-of-factors/52266 "2023-05-31T23:07:55Z")

</div>

What would be a function to output a number for the camera position’s z value based on a number of factors: fov: (default 50) windowWidth: (window.innerWidth) 3DObject size + position: (PlaneGeometry with width 5, h…

---

## [Get depth in post processing shader](https://discourse.threejs.org/t/get-depth-in-post-processing-shader/47143)

<div class="topic-metadata">

**Author:** [@Yin\_Cognyto](https://discourse.threejs.org/u/Yin_Cognyto)\
**Replies:** 1\
**Last updated:** [January 21, 2023, 8:39pm UTC](https://discourse.threejs.org/t/get-depth-in-post-processing-shader/47143 "2023-01-21T20:39:17Z")

</div>

I have attempted to use this fiddle (which is basically a working version of this one), this example and this explanation to integrate into my own fiddle the ability to have a post processing shader redrawing things usin…
