-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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 to pass varying from fragment to light shader function #44698
Allow to pass varying from fragment to light shader function #44698
Conversation
f8c7f47
to
883146f
Compare
b725dac
to
322782e
Compare
See my comment here: godotengine/godot-proposals#2022 (comment) I made a suggestion and other remarks in the linked comment above. |
@Chaosus on review, and based on lyuma's comments. I think adding an optional hint |
Ok, will modify it at the nearest time. |
322782e
to
651cc36
Compare
651cc36
to
4882fef
Compare
@clayjohn Added |
4882fef
to
c72f32c
Compare
I am happy with this implementation. Normally at this point I would approve, but we haven't reached consensus in godotengine/godot-proposals#2022 |
Looks pretty sound to me, I'm assuming |
Yes |
I suggest the following
|
example:
|
Also ShaderLanguage::Varying can have the following info for the codegen:
|
I have a question: if something is vertex2light, it makes sense to also allow reading it in both fragment() and light(): the write/read/read case. For example, say I wanted to take some special value calculated in vertex() and pass it into both the fragment() and light(). It seems awkward to require using two interpolators and two different variable names just so that I can use it in both places. While I'll ultimately accept whatever reduz decides, I continue to find the above proposed use of the keyword "varying" to be inconsistent with anything you'll find in any real-world shading environments, and, therefore, confusing both for seasoned developers and for novices who look up documentation outside of the Godot bubble. I really want Godot to adopt idioms in widespread industry use, rather than painting a make-believe world (such as one in which fragment() and light() are separate programs that magically send data to one another) |
c72f32c
to
d8dfbb1
Compare
Done, all as @reduz requested. |
d8dfbb1
to
dd0874e
Compare
Thanks! |
Excellent! |
@SIsilicon It's possible, but as I'm a non-paid contributor it depends on my current motivation and mood to do so. |
I can relate to that. You're probably even busy doing something else right now. |
I will be making an attempt to backport this change to 3.2, as it reduces fragmentation to have as much shader language compatibility as possible. I also maintain ports of other shader features introduced in master to 3.2, including structs ( https://github.com/lyuma/godot/tree/shader_struct_backport ). I'd be happy to submit these as PR's to the 3.2 branch after 3.2.4 is released. |
@SIsilicon This feature was just merged into the 3.x branch! This means it will be in 3.4 when it gets released. (It is not available in 3.3 or earlier.) |
Allows passing varying from fragment to light:
It's exactly what @clayjohn was requested. I've implemented this variant cuz it's the easiest to implement of all variants. If it's not what everybody wants, I could create new variants... or @lyuma could try to fix it himself.
Closes godotengine/godot-proposals#2022