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

[MotionVectors] PrevFrame support for user shader code. #82733

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

amuTBKT
Copy link

@amuTBKT amuTBKT commented Oct 3, 2023

Hello

Coming from UE4 background, I think providing user shader logic some context regarding VertexShader invocations can be useful for generating correct motion vectors. In unreal this is handled using PreviousFrameSwitch nodes.

We already handle previous frame data related to Time and Node transforms, but it fails to handle cases where vertex deformation might be generated using some other means. This can be reading texture/physics simulation data passed to material etc.

I would like to propose PREV_FRAME_SWITCH(boolean) input for Vertex shaders.

Changes:

  • Added PREV_FRAME_SWITCH vertex shader input. This is only enabled for spatial shaders and Forward+ rendering as other renderers don't support motion vectors.
  • PREV_FRAME_SWITCH is defined (or renamed) as "false" for gles3 and mobile shader compiler.
  • Added a new VisualShader input node for vertex shader context.

Open to any suggestions/feedback :)

Regards

Amit

Bugsquad edit:

@amuTBKT amuTBKT requested review from a team as code owners October 3, 2023 16:04
@Calinou Calinou added this to the 4.x milestone Oct 3, 2023
@fire
Copy link
Member

fire commented Oct 3, 2023

Are you ok making a proposal? https://github.com/godotengine/godot-proposals/ We can backfill a proposal but it won't be as high quality or exactly what you wanted.

@amuTBKT
Copy link
Author

amuTBKT commented Oct 4, 2023

Sure, I have created a new proposal for this.

# Conflicts:
#	servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl
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.

Add a previous frame context for vertex shaders (for motion vector generation)
3 participants