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 shadow mapping with RGBA textures on html #33093

Merged
merged 1 commit into from
Oct 26, 2019

Conversation

clayjohn
Copy link
Member

Fixes: #28444

@Toshiwoz This doesn't address the GLES3 issue you were facing in that thread. If you can still reproduce that issue with orthogonal directional lights, please open another issue.

This fix has two pieces.

  1. On WebGL 91% of devices support depth textures with an extension. However, we were only polling for the GL ES 2.0 extension so it was never used on Web export. Accordingly HTML fell back on RGBA shadows. For most devices it was enough to just enable the extension.

  2. RGBA shadows were completely broken in 3D in GLES2. The color buffer was never cleared. Additionally, all lights were using the directional light shadow atlas to store shadow maps, which likely lead to some pretty odd results. We never caught this earlier because all desktop and the overwhelming majority of mobile devices supported and used depth textures.

Code graciously donated by Gamblify. :)

CC: @jesperkondrup

@Toshiwoz
Copy link
Contributor

Toshiwoz commented Oct 26, 2019

EDIT: Thanks @clayjohn I'll probably do so, although now I'm not using GLES 3.0 and neither orthogonal projection/shadows on my project.

@akien-mga akien-mga merged commit 3556876 into godotengine:master Oct 26, 2019
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga added this to the 3.2 milestone Oct 26, 2019
@akien-mga
Copy link
Member

Cherry-picked for 3.1.2.

@clayjohn clayjohn deleted the GLES2-HTML-shadows branch November 17, 2019 19:40
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.

GLES2, Cast Shadow=Off breaks receiving shadow, HTML5
3 participants