-
Notifications
You must be signed in to change notification settings - Fork 80
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
Move fading to effect and add collision fading support. #631
Conversation
lgtm, thanks again malcolm for working this out! |
fe36873
to
0e205ae
Compare
0e205ae
to
50069e7
Compare
Added a basic damage area to the basic movement scene. Damage.Area.mp4 |
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 good, cool addition
@@ -1,13 +1,13 @@ | |||
shader_type spatial; | |||
render_mode depth_test_disabled, skip_vertex_transform, unshaded, cull_disabled; | |||
|
|||
uniform float alpha = 0.0; | |||
uniform vec4 albedo : source_color; | |||
|
|||
void vertex() { | |||
POSITION = vec4(VERTEX.x, -VERTEX.y, 0.0, 1.0); |
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.
Something we need to change here that I didn't realise until later is that this needs to be POSITION = vec4(VERTEX.x, -VERTEX.y, -1.0, 1.0);
when using OpenGL (compatibility). The code as it stands right now is correct for Vulkan.
Once the reverse-Z PR is merged in 4.3, we need to change this again to POSITION = vec4(VERTEX.x, -VERTEX.y, 1.0, 1.0);
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.
This shader works on the current options (tested on PC, not native):
- Godot 4.1.3 Vulkan & OpenGL
- Godot 4.2.1 Vulkan & OpenGL
- Godot 4.3-dev5 Vulkan & OpenGL
Back in 4.0 we were looking for an option that would satisfy both OpenGL and Vulkan, and I thought the ``cull_disabled` was all we needed.
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.
What would we need to do if we want this shader to work in Vulkan & OpenGL on Godot 4.1 - 4.3?
In the Reverse Z Progress Report announcement there didn't seem to be anything about how to handle forwards/backwards compatibility.
Co-Authored-By: Miodrag Sejic <[email protected]>
50069e7
to
9592a7a
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.
LGTM
This PR moves the fade logic to a common effect accessible by all nodes - including with the ability to fade to colors.
Additionally it adds collision-based fading to prevent looking through walls.