Skip to content

webgl_reverse_depth_buffer: Use post-processing and add note for use of floating point depth#30941

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
CodyJasonBennett:examples/reverse-depth
Apr 16, 2025
Merged

webgl_reverse_depth_buffer: Use post-processing and add note for use of floating point depth#30941
Mugen87 merged 1 commit into
mrdoob:devfrom
CodyJasonBennett:examples/reverse-depth

Conversation

@CodyJasonBennett

Copy link
Copy Markdown
Contributor

Related issue: #30809 (comment)

Description

Updates the example to configure a basic post-processing chain with a floating-point depth buffer (canvas default is integer, which doesn't work as well). The simplest form is what I had initially contributed with a single offscreen render + blit, but this is unusual for an example and will mess up tonemapping in real scenes since r155. This should now be a better showcase and realistic example.

@Mugen87 Mugen87 added this to the r176 milestone Apr 16, 2025
@Mugen87 Mugen87 merged commit 09826c0 into mrdoob:dev Apr 16, 2025
@CodyJasonBennett CodyJasonBennett deleted the examples/reverse-depth branch April 16, 2025 23:30
const meshes = [];

const renderTarget = new THREE.WebGLRenderTarget();
renderTarget.type = THREE.UnsignedByteType;

@Methuselah96 Methuselah96 Apr 24, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any pointers to what setting the type property does? I don't see it documented for WebGLRenderTarget and was wondering whether it needs to be added to the TypeScript types.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should be:

renderTarget.texture.type

But since the default is already THREE.UnsignedByteType we probably can just delete this line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad habit of mine. I will remove the line #30989.

RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
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.

3 participants