Describe the problem or limitation you are having in your project
Custom materials authored as VisualShader or StandardMaterial3D don't provide a way to customize vertex shader logic for previous frame.
We internally patch Time and Node-Transform related parameters before invoking the user code but it fails to account for user logic which might be modifying vertex position.
A common use case would be writing simulation data to texture/buffer and reading that inside the shader with some offset.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I would like to propose a boolean input for vertex shader bool PREV_FRAME_SWTICH which can be used to adjust offsets/logic for customizing previous frame shader invocation.
Use cases should align with how it's used in UnrealEngine.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
User can query the newly added input PREV_FRAME_SWITCH to run different logic based on context.
I understand that this has limited use case and I believe the changes I am proposing should not affect the performance of existing materials.
The input should be optimized away for cases where user doesn't opt into using it for performing custom logic.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It's an engine feature.
Is there a reason why this should be core and not an add-on in the asset library?
Hey! I am not super familiar with motion vectors, but I was wondering if it wouldn't be simpler to offer directly the motion vector in the shader, both in and out?
Describe the project you are working on
General VFX and rendering.
Describe the problem or limitation you are having in your project
Custom materials authored as VisualShader or StandardMaterial3D don't provide a way to customize vertex shader logic for previous frame. We internally patch Time and Node-Transform related parameters before invoking the user code but it fails to account for user logic which might be modifying vertex position.
A common use case would be writing simulation data to texture/buffer and reading that inside the shader with some offset.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I would like to propose a boolean input for vertex shader
bool PREV_FRAME_SWTICH
which can be used to adjust offsets/logic for customizing previous frame shader invocation.For code changes please refer to this PR.
Use cases should align with how it's used in UnrealEngine.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
User can query the newly added input
PREV_FRAME_SWITCH
to run different logic based on context.I understand that this has limited use case and I believe the changes I am proposing should not affect the performance of existing materials. The input should be optimized away for cases where user doesn't opt into using it for performing custom logic.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It's an engine feature.
Is there a reason why this should be core and not an add-on in the asset library?
It's an engine feature.