Skip to content

OpenGL: Fix shader compilation failure with shadow_to_opacity and unshaded #107238

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

Merged

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Jun 6, 2025

At the moment, if you make a shader that uses both shadow_to_opacity and unshaded when using the Compatibility renderer, it will fail to compile with the following error:

E 0:00:02:007   _display_error_with_code: SceneShaderGLES3: Fragment shader compilation failed:
ERROR: 0:1817: 'ambient_light' : undeclared identifier
ERROR: 1 compilation errors.  No code generated.
  <C++ Source>  drivers/gles3/shader_gles3.cpp:259 @ _display_error_with_code()

This PR fixes that!

This problem doesn't happen with the Forward+ or Mobile renderers, where the result is full transparency (alpha = 0.0), even though the scene shaders in those renders don't set it explicitly, like in this PR. I don't know if it'd be worth changing Forward+ and Mobile to do it explicitly too?

@Repiteo Repiteo merged commit 6bb1318 into godotengine:master Jun 9, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jun 9, 2025

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.

3 participants