Pixel Tracking Methods: Optical Flow Methods

Get any idears for .usf shaders?

I have change this BasePassCommon.usf
line 30:
#define WRITES_VELOCITY_TO_GBUFFER (USES_GBUFFER && GBUFFER_HAS_VELOCITY && (!SELECTIVE_BASEPASS_OUTPUTS || !(STATICLIGHTING_TEXTUREMASK || STATICLIGHTING_SIGNEDDISTANCEFIELD || HQ_TEXTURE_LIGHTMAP || LQ_TEXTURE_LIGHTMAP)))
to
#define WRITES_VELOCITY_TO_GBUFFER (USES_GBUFFER)
this might make WRITES_VELOCITY_TO_GBUFFER true.
Still can’t use this code to get velocity. by the mean time,VisualizeTexture Velocity still works.

If I change WRITES_VELOCITY_TO_GBUFFER to false.
VisualizeTexture Velocity won’t works.

So I assume, the Velocity GBuffer is being written to.
The reason of this code or this shading graph not working, caused by other problems.

Yep, I tried something similar too, to make sure WRITES_VELOCITY_TO_GBUFFER and GBUFFER_HAS_VELOCITY were true, but doesn’t show anything on the material.

I add new texture for velocity and write them in shader,change motion blur post process shader , take like argument VelocityRt in PostProcessing.cpp , and set Render Target my texture. Then Add this texture in material template for take this data in material editor.

Wooh,So you already can extract velocity from gBuffer? Awesome!!
Do you mind to share some details with it?

I am working on a similar purpose, tried your code and get the exact same errors. How did you get rid of them?
Thanks in advance

I get the error:
[SM5] /Engine/Generated/Material.ush(1271,1-12): error X3000: unrecognized identifier ‘FGBufferData’

Did you somehow define ‘FGBufferData’ beforehand

Usually, those types of things get bound by the shader based on the presence of certain nodes in the graph. Just placing them but having them clamped in a way so they dont do anything can help.

I am not sure what this one is, or if its even still possible as a code refactor could have disabled this workaround.

But for example, there is FScreenSpaceData and that will be inaccessible until you have a scene texture node used. If you look at the materialfunction “Spiral Blur Scene Texture” you see an example of this with the output pin called “scene color clamped to 0”. If that isn’t used somewhere (anywhere) in your graph, the shader will just render white or give an error.

So what was the solution finally ?
I’m reading through the thread and not sure what I need to do to get it work. Currently using @GrohBot solution and getting a black screen, even when normalizing only getting a yellow screen, no reaction to moving objects though.

i need this solution too:(,how to get motion vector buffer?

Anyone made it work? Is it possible without having to recompile the engine?

EDIT: Nevermind, just see that it was added as a standard scene texture option. Is there a way to acces other pass features like light pass, light direction, etc? The custom node is undocumented and getting lost in the usf its pretty easy

Hey ADN, I found the Velocity setting in the Scene Texture node but still can’t figure out how to render it out in Sequencer. Have you figure out how to use this?

I’ve tried plugging that scene texture node into emissive and putting in a post process with no luck. Thanks for your help!

Edit:
Nevermind, I just needed to make it unlit. Thanks for this discussion, there was no documentation on any of this.

Hey dethayngel - have you had any luck actually using the Velocity data from the SceneTexture:Velocity node? I’ve tried using it and have reported some of my findings here: SceneTexture:Velocity Data Integrity Issues - Rendering - Unreal Engine Forums - the main issue I’ve had is that the velocity I’m reading from this texture doesn’t match what I would expect. Any insight or help you could provide would be greatly appreciated :slight_smile: