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

Expose unused SHADOW_MODULATE's alpha as shadow opacity for 2d lighting shadows #90805

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maidopi-usagi
Copy link
Contributor

@maidopi-usagi maidopi-usagi commented Apr 17, 2024

The light built-in SHADOW_MODULATE is a vector4 but only first three elements of it are used for modulating the color of shadows, and the alpha channel was totally unused previously.

In this pr, the alpha channel of SHADOW_MODULATE will modulate the alpha of shadow, so users can change the opacity of received shadows when overriding light() function.

Maybe related to godotengine/godot-proposals#7136 and godotengine/godot-proposals#9297

As shadow_modulate is initialized to vec4(1.0) before lighting compute , so the default behavior of canvas shaders should not get differences.

2024-04-17.23-24-40.mp4

EDIT: made an example Project here
shadow_modulate.zip
Before:

shadow_modulate_alpha_before.mp4

This PR:

shadow_modulate_alpha.mp4

@AThousandShips
Copy link
Member

Please open a proposal to track the support and details of this feature 😸

@maidopi-usagi
Copy link
Contributor Author

Please open a proposal to track the support and details of this feature 😸

Ok~ I've made a proposal here. godotengine/godot-proposals#9541

@maidopi-usagi
Copy link
Contributor Author

Sorry to bother, but would it be possible to get a code review for this pull request, and I would also appreciate any feedback on this. :)

@Delsin-Yu
Copy link
Contributor

I built and tested the MRP locally and can confirm it does indeed work. Great job! I'm looking forward to utilizing this in my local project.

@maidopi-usagi
Copy link
Contributor Author

Rebased to master branch and fixed conflicts.

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.

Expose unused SHADOW_MODULATE's alpha as shadow opacity for 2d lighting shadows
3 participants