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

Move fading to effect and add collision fading support. #631

Merged
merged 1 commit into from
May 24, 2024

Conversation

Malcolmnixon
Copy link
Collaborator

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.

@DigitalN8m4r3
Copy link
Contributor

DigitalN8m4r3 commented Apr 2, 2024

lgtm, thanks again malcolm for working this out!
we might want to supply a example inside the movement Demo that showcases a color change, something like a hurt zone?

@Malcolmnixon Malcolmnixon marked this pull request as ready for review April 3, 2024 03:41
@Malcolmnixon
Copy link
Collaborator Author

Added a basic damage area to the basic movement scene.

Damage.Area.mp4

Copy link
Member

@BastiaanOlij BastiaanOlij left a 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);
Copy link
Member

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);

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

addons/godot-xr-tools/effects/fade.gdshader Outdated Show resolved Hide resolved
Copy link
Member

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Malcolmnixon Malcolmnixon merged commit 71f1457 into GodotVR:master May 24, 2024
2 checks passed
@Malcolmnixon Malcolmnixon deleted the common-fade branch May 24, 2024 16:28
@BastiaanOlij BastiaanOlij added this to the 4.3.2 milestone Jun 19, 2024
@BastiaanOlij BastiaanOlij added the enhancement New feature or request label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants