Skip to content

MeshDepthMaterial: Support Reversed Depth#31500

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
WestLangley:dev-depth_shader_reversed_depth
Jul 25, 2025
Merged

MeshDepthMaterial: Support Reversed Depth#31500
Mugen87 merged 1 commit into
mrdoob:devfrom
WestLangley:dev-depth_shader_reversed_depth

Conversation

@WestLangley

Copy link
Copy Markdown
Collaborator

The higher precision equivalent of gl_FragCoord.z assumes that the depth range is [ - 1, 1 ].

In the case of reversed depth, the depth range is [ 0, 1 ].

@WestLangley WestLangley added this to the r179 milestone Jul 25, 2025
Comment thread src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.22
78.88
338.31
78.9
+88 B
+15 B
WebGPU 560.72
155.17
560.72
155.17
+0 B
+0 B
WebGPU Nodes 559.64
154.96
559.64
154.96
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 469.49
113.56
469.58
113.57
+88 B
+15 B
WebGPU 635.72
172.04
635.72
172.04
+0 B
+0 B
WebGPU Nodes 590.37
161.29
590.37
161.29
+0 B
+0 B

@Mugen87 Mugen87 merged commit a4f44f6 into mrdoob:dev Jul 25, 2025
9 checks passed
@WestLangley WestLangley deleted the dev-depth_shader_reversed_depth branch July 25, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants