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

3D Fragment shader COLOR seem to be in 8bits #30470

Closed
Ijatsu opened this issue Jul 9, 2019 · 5 comments
Closed

3D Fragment shader COLOR seem to be in 8bits #30470

Ijatsu opened this issue Jul 9, 2019 · 5 comments

Comments

@Ijatsu
Copy link

Ijatsu commented Jul 9, 2019

Godot version:
3.1.1

OS/device including version:
Windows and Ubuntu
GLES3

Issue description:
With SurfaceTool I created a 3D mesh, each vertex had COLOR set as Color(0.125, 0.125, 0.125, 0.125).
In the fragment shader, the data in COLOR would be something between 0.121 and 0.122.
It seems like the data is in 8bits instead of the default 32bits as stated in the documentation on shaders here. However this document is for 3.0.

Steps to reproduce:
A simple 3D project with a 3D camera, and a mesh instance.
Create a square using surfacetool, set the Color above.
Create a default material, turn it into a shader, modify the fragment part. Display Albebo as white if Color.r/g/b/a is inferior to 0.122, display as black otherwise. It was drawn white on both linux and windows.

@clayjohn
Copy link
Member

clayjohn commented Jul 9, 2019

That document applies only to shaders. So it only applies to calculations done inside the shader, not to information coming into the shader.

I think vertex colors are sent to the GPU using 8 bits as a way to save bandwidth. Not sure off the top of my head though.

Also, if you are using 3.1 you should use the 3.1 version of the docs.

@Ijatsu
Copy link
Author

Ijatsu commented Jul 9, 2019

I was suspecting that Colors wouldn't be standard floats for memory concern...

Do you know how I could transfer more informations about my vertices? I already use the UV2 but ideally I need 4 more floats.

Also, if you are using 3.1 you should use the 3.1 version of the docs.

3.0 is the latest version of this doc apparently.

@clayjohn
Copy link
Member

clayjohn commented Jul 9, 2019

3.0 is the latest version of this doc apparently.

No, its not. Here is the latest version. http://docs.godotengine.org/en/latest/tutorials/shading/shading_reference/shading_language.html

Do you know how I could transfer more informations about my vertices? I already use the UV2 but ideally I need 4 more floats.

It depends on what information you are willing to override, weights is probably something you can use, it uses four floats. Bones as well.

@fire
Copy link
Member

fire commented Jul 10, 2019

Why don't you use an hdr texture that'll give you 32 to 16 bits float per component?

@Calinou
Copy link
Member

Calinou commented Sep 1, 2021

Closing in favor of godotengine/godot-proposals#2935, as feature proposals are now tracked on the Godot proposals repository.

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