Skip to content

Conversation

@slipher
Copy link
Member

@slipher slipher commented Nov 18, 2024

Disable depth fade, depth testing, depth writing for 2D rendering. Don't create a depth or stencil channel in the default framebuffer.

Instead of using the "depth clamp" GL extension (which disables clipping based on the z-coordinate), set the projection matrix to make z always 0. This is relevant if we use 3d CSS transformations like these.

This is a very 3D effect, the last thing that would make sense in a 2D
shader.
Also remove the 'gl_FragDepth = 0;' bit from the 2D GLSL shader. It
seemed to have no effect anyway, but with depth testing and writing
disabled we can be sure of it.
With RmlUi transforms and 3D CSS directives such as transform:
rotateX(...), nonzero z coordinates could be produced. Instead of
relying on GL_DEPTH_CLAMP which is not always available to prevent
clipping by near or far planes, just use a projection matrix that always
maps z to 0.
All 3D rendering and even screen-space effects are done in FBOs. The
default framebuffer is only targeted when drawing the UI, so a depth
buffer is not neede.
Copy link
Contributor

@VReaperV VReaperV left a comment

Choose a reason for hiding this comment

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

LGTM.

@slipher slipher merged commit 2b6d388 into DaemonEngine:master Nov 19, 2024
6 of 8 checks passed
@slipher slipher deleted the nodepth branch January 9, 2025 06: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