Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Add support for 16-bit directional and point light shadow atlases #57430

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jan 30, 2022

Follow-up to #54165.

This results in slightly faster rendering with no discernible visual difference in most scenes. Both GLES3 and GLES2 support this option, which is also enabled by default.

Please test on various platforms, especially Android, iOS and HTML5 🙂

Testing project: test_shadow_16_bits_3.x.zip

Preview

Tested on a GeForce GTX 1080 in 2560×1440.

The performance difference is very slight here, but in a more complex scene with more lights, it would be more significant.

GLES3

24-bit 16-bit Difference (dssim)
2022-01-30_01 33 56 2022-01-30_01 35 03 d-0

GLES2

24-bit 16-bit Difference (dssim)
2022-01-30_01 35 55 2022-01-30_01 37 12 d_gles2-0

@lawnjelly
Copy link
Member

I wonder whether 16 bit / 24 bit may be quite scene dependent on whether it makes a visual difference, depending on the near and far planes of the shadow map "camera" and the relative size of the polys. I guess it might affect things like shadow acne.

Worth mentioning another option is just to have a global 16 bit setting, rather than overridable per viewport. That way you could probably do the PR with one line of code or so, just change storage->config.depth_buffer_internalformat on startup according to a project setting. I guess having it per viewport is more adaptable though.

I have to say I'm not totally convinced on having it 16 bit by default, especially at this late stage in 3.x. Quite apart from the risk that it may make some types of scenes look worse, we are also assuming here that all GPUs will always run faster with 16 bit than 24 bit, we'd need a GPU guy to confirm this (there are all kinds of counter intuitive things that can go on). Maybe some support 32 bit GL_OES_depth32 I don't know whether we are able to take advantage of this currently, just throwing that out there.

Also it would be helpful to know what kind of performance differences to expect, have you got any test results for different platforms? Especially mobile that supports the 24 bit extension. Obviously if there is a large difference it is more convincing to change the default, but if it is marginal, maybe it would be less worth it.

This results in slightly faster rendering with no discernible
visual difference in most scenes. Both GLES3 and GLES2 support this
option, which is also enabled by default.
@Calinou Calinou force-pushed the shadow-add-16-bits-option-3.x branch from 765f002 to ee37b7f Compare June 27, 2023 09:17
@akien-mga akien-mga changed the title Add support for 16-bit directional and point light shadow atlases [3.x] Add support for 16-bit directional and point light shadow atlases Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants