-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Allow SCREEN_UV
to be used in light function of spatial shader
#94981
Allow SCREEN_UV
to be used in light function of spatial shader
#94981
Conversation
Chaosus
commented
Jul 31, 2024
- Closes Add the built-in SCREEN_UV to the spatial shader's light() function godot-proposals#10222
5033969
to
be3929f
Compare
be3929f
to
597b5a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally (rebased on top of master
3978628), it works as expected in all rendering methods.
Testing project: test_pr_94981.zip
One concern though is that this increases the number of shader versions compiled whenever the feature is used, which didn't occur with the workaround described in godotengine/godot-proposals#10222. This has a performance impact.
Yeah, maybe its not good. At least there is a simple workaround to use varying: shader_type spatial;
varying vec2 screen_uv;
void fragment() {
screen_uv = SCREEN_UV;
}
void light() {
DIFFUSE_LIGHT = vec3(screen_uv, 0.0);
} |
48fda6e
to
ab035e9
Compare
@Calinou I've removed the #ifdef statements so it should not generate a shader versions. Check again to ensure that. |
ab035e9
to
a64b3fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Thanks! |