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 more texture pixel format support such as 16-bit unsigned integer #7540

Open
Redwarx008 opened this issue Aug 22, 2023 · 3 comments
Open

Comments

@Redwarx008
Copy link

Describe the project you are working on

A large terrain using heightmap.

Describe the problem or limitation you are having in your project

The height map used by the terrain is usually stored as a 16-bit unsigned int, but godot only supports R16_sfloat. If you want to not lose precision, you can only use R32_sfloat, which will double the size.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add uint support for all uncompressed formats, they can be sampled, just linear filtering is not supported. But I guess, people who use them should know this.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

If this enhancement will not be used often, can it be worked around with a few lines of script?

can not

Is there a reason why this should be core and not an add-on in the asset library?

it's render core

@Calinou Calinou changed the title Add more texture format support Add more texture pixel format support such as 16-bit unsigned integer Aug 22, 2023
@clayjohn
Copy link
Member

Is this proposal specifically for the Image class? Its a bit unclear where you are asking for the support to be implemented and what it will be used for

@Redwarx008
Copy link
Author

Is this proposal specifically for the Image class? Its a bit unclear where you are asking for the support to be implemented and what it will be used for

Currently, the main way for Godot to use textures is through image classes, so adding them to image classes is the first step, followed by modifying the format check in different places .

@TokisanGames
Copy link

TokisanGames commented Oct 22, 2023

Is this proposal specifically for the Image class?

Yes, this proposal should be renamed and understood to be: Support all standard opengl integer and float formats in Image and Texture classes. 8/16/32 uint/sint at the least. The vulkan rendering device already supports them as do shaders. OpenGL should as well.

As a workaround, we can currently write integers into FORMAT_RF and read them in the shader as ints with this process:
godotengine/godot#57841 (comment)

It's a bit unclear where you are asking for the support to be implemented and what it will be used for

What it is used for is integer data like bit fields. In Terrain3D, I am currently packing tons of information into 32 bits with the above workaround.

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

No branches or pull requests

4 participants