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

Use separate texture unit for light_texture #42538

Merged
merged 1 commit into from
Oct 3, 2020

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented Oct 3, 2020

Fixes: #42521

This bug has been present since the early stages of the GLES2 renderer. In a366d45 when reduz added the screen_texture he made it share a texture unit with the light texture. I am not sure why. As a result, when lights are drawn over sprites that read from SCREEN_TEXTURE, during the fragment pass they read from the light texture instead of the screen texture which results in a weird ghosting artifact.

About 30% of GLES2 devices have only 8 texture units so we try to use as few internal texture units as possible. That may be why reduz chose to share light texture and screen texture. This change makes the Godot internal shader take up 6 texture units which leaves the user with only 2 for themselves one these devices.

In light of the above, reduz needs to approve this change himself. It may have been an oversight, but there also may be a legitimate reason to avoid using the 6th texture unit.

@akien-mga
Copy link
Member

In light of the above, reduz needs to approve this change himself. It may have been an oversight, but there also may be a legitimate reason to avoid using the 6th texture unit.

It seems it was an oversight and reduz agrees with the change, though he shares the same concern about the more limited GLES2 devices. But it's important to make engine features work properly IMO, and so far no user of such an old device complained about having only 3 custom texture slots available, so maybe 2 will be fine too (if anyone makes games for the lowest end GLES2 devices).

@akien-mga akien-mga merged commit 2882284 into godotengine:3.2 Oct 3, 2020
@akien-mga
Copy link
Member

Thanks!

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.

2 participants