Skip to content

Conversation

@ada-tv
Copy link
Collaborator

@ada-tv ada-tv commented Jan 7, 2026

Improves the look of Text entities, since the physical offset was a global constant, it could make the text stick out pretty far on small Text entities and the slight parallax even on larger ones felt kinda weird to look at

I've tested this with some of my toy scripts and looking at the Text entities around the hub. Everything looks to be working fine with this change.

Closes #2006

Before

without-depth-bias

After

with-depth-bias

@ada-tv ada-tv added enhancement New feature or request needs CR This pull request needs to be code reviewed needs QA This pull request needs to be tested labels Jan 7, 2026
@JulianGro
Copy link
Member

JulianGro commented Jan 8, 2026

This PR causes z-fighting on my machine, both on GLES and Vulkan:

master:
Screenshot_20260108_130248

This PR with Vulkan:
Screenshot_20260108_125613

This PR with GLES:
Screenshot_20260108_131644

This is all on the forward renderer though it also happens on deferred.
On a screenshot it isn't as obvious, but on master the text is just pixelated, while on this PR it flickers as if each letter was z-fighting.

@JulianGro
Copy link
Member

On my workstation, this behaves a lot better. (Mesa 25.3.2-2 on Intel Arc A770)
OpenGL looks fine:

OpenGL_2026-01-14.mp4

Vulkan has very consistent z-fighting:

Vulkan_2026-01-14.mp4

OpenGL on master for comparison:

master_OpenGL_2026-01-14.mp4

On master, it is visible that things also move a little there, so that part is the same (this is on the forward renderer). It would be great to figure out what is happening on the Vulkan side.

@ada-tv
Copy link
Collaborator Author

ada-tv commented Jan 14, 2026

I couldn't reproduce the z-fighting on GLES, but I was able to reproduce it on Vulkan:
image

This might just be that our Vulkan backend doesn't support depth biasing yet.

@ada-tv ada-tv marked this pull request as draft January 24, 2026 17:14
Copy link
Member

@ksuprynowicz ksuprynowicz left a comment

Choose a reason for hiding this comment

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

Everything looks good :)

@ksuprynowicz ksuprynowicz added CR approved This pull request has been successfully code reviewed and removed needs CR This pull request needs to be code reviewed labels Jan 25, 2026
@ksuprynowicz
Copy link
Member

Maybe for now we can make the change conditional, so that it happens only on OpenGL while Vulkan and GLES have the previous behavior? Later we can add depth bias support to Vulkan.

@ada-tv
Copy link
Collaborator Author

ada-tv commented Jan 25, 2026

Sorry, I should have mentioned and removed the review tags. This PR is on hold until we can figure out what's breaking it on some drivers. It's not mergable yet.

@ada-tv ada-tv removed CR approved This pull request has been successfully code reviewed needs QA This pull request needs to be tested labels Jan 25, 2026
@ksuprynowicz
Copy link
Member

Are there any currently known OpenGL drivers on which it doesn't work?

@ada-tv
Copy link
Collaborator Author

ada-tv commented Jan 25, 2026

Well, weirdly, the text renders fine for me (AMD with Mesa) even without the depth bias. I'm worried OpenGL's implementation-defined behavior for depth biasing might also bring issues. We'll need to test it more to be safe.

I think GLES shares the depth biasing code with GL4.5, so something weird might be going on there too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs more info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Depth offset for Text entities' text instead of physical distance from the background quad

3 participants