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

Add a Viewport property to use full floating-point precision #51709

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Aug 16, 2021

master version of #51708.

This is only available on the Vulkan Clustered backend.

This can be useful for advanced shaders, but it should generally not be enabled otherwise as full precision has a performance cost. For general-purpose rendering, the built-in debanding filter should be used to reduce banding instead.

This closes godotengine/godot-proposals#2935.

Testing project: test_32bpc_master.zip

Preview

While I don't have a suitable shader for testing the difference, I can note that there is a subtle visual difference in a test scene I made (verified by dssim).

No MSAA

16 bpc (default)

2021-08-16_04 02 40

32 bpc

2021-08-16_04 02 51

Difference

s png-0

8× MSAA

16 bpc (default)

2021-08-16_04 04 18

32 bpc

2021-08-16_04 04 28

Difference

msaa png-0

This is only available on the Vulkan Clustered backend.

This can be useful for advanced shaders, but it should generally
not be enabled otherwise as full precision has a performance cost.
For general-purpose rendering, the built-in debanding filter should
be used to reduce banding instead.
@Calinou Calinou force-pushed the viewport-add-32bpc-color-depth-master branch from fb382bf to 58cc7a8 Compare September 24, 2021 00:23
@reduz
Copy link
Member

reduz commented Oct 12, 2021

This is not going to work as-is, and its likely triggering lots of validation layer errors. You need to fix all the compute shaders and add variants that work with 32bpp, as the format needs to be explicited in image load/store. I think its not worth the effort.

@YuriSizov YuriSizov modified the milestones: 4.0, 4.1 Feb 9, 2023
@clayjohn clayjohn modified the milestones: 4.1, 4.x May 23, 2023
@FishOfTheNorthStar
Copy link

Just wanted to chime in and explain why this option would help me. I'm trying to generate Terrain3D control maps inside a canvasitem shader, because that would be quite a lot faster than bit banging it per pixel in an Image. Except Terrain3D is using Rf (32 bit), converted in their shader to 32 bit uint. So when I generate the appropriate uint 32 in my control-map-maker, internally Godot is mangling it down to 16bpc, which of course doesn't work out.

For now I'm doing it the kinda slow way, CPU side, but it's a shame cause it's easily 20 times slower. Is there perhaps a way I could use two 16 bpc output channels in my shader, like Red and Green, then cpu side, merge them together into a true 32bpc reconstructed single channel image? Looking into this now but if anyone has any work arounds to this use case that'd be very helpful.

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.

Add a 32 bpc frame buffer option to Viewport
6 participants