Skip to content

Fix GLES3 instanced rendering color and custom data defaults#81575

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
bitsawer:fix_gles_instancing
Oct 5, 2023
Merged

Fix GLES3 instanced rendering color and custom data defaults#81575
akien-mga merged 1 commit into
godotengine:masterfrom
bitsawer:fix_gles_instancing

Conversation

@bitsawer

@bitsawer bitsawer commented Sep 12, 2023

Copy link
Copy Markdown
Member

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).

@bitsawer bitsawer added this to the 4.2 milestone Sep 12, 2023
@bitsawer bitsawer requested a review from a team as a code owner September 12, 2023 13:39
@bitsawer bitsawer force-pushed the fix_gles_instancing branch 3 times, most recently from 0a38749 to e223009 Compare September 12, 2023 21:04

@clayjohn clayjohn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great!

@akien-mga akien-mga merged commit b42aa5a into godotengine:master Oct 5, 2023
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

@YuriSizov

Copy link
Copy Markdown
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