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

Fix GLES3 instanced rendering color and custom data defaults #81575

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

bitsawer
Copy link
Member

@bitsawer bitsawer commented Sep 12, 2023

In the GLES3 Compatibility renderer if a MultiMesh did not have instance colors or custom data enabled, the default instance color and data values ended up being 0.0 (or whatever value happened to be set previously) instead of 1.0 which made most meshes completely black if vertex_color_use_as_albedo flag was enabled on the material. This happens often with GridMap which uses internal MultiMesh objects.

This PR sets default compressed values to 1.0 for color and 0.0 for custom data. Looks like this is also needed in canvas rasterizer to satisfy any buggy. strict or paranoid OpenGL implementations (especially web) that check the input attribute declared data type (uvec4) against the bound type even if the shader branch reading the value is disabled by an uniform condition (FLAGS_INSTANCING_HAS_COLORS and FLAGS_INSTANCING_HAS_CUSTOM_DATA in canvas rasterizer).

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks great!

@clayjohn clayjohn added the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Oct 5, 2023
@akien-mga akien-mga merged commit b42aa5a into godotengine:master Oct 5, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@bitsawer bitsawer deleted the fix_gles_instancing branch October 5, 2023 10:07
@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Oct 24, 2023
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.3.

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