Announcement

Collapse
No announcement yet.

Pixel Tracking Methods: Optical Flow Methods

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    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
    Last edited by II_ADN_II; 06-21-2019, 09:25 PM.

    Leave a comment:


  • replied
    i need this solution too,how to get motion vector buffer?

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.
    Last edited by RyanB; 10-19-2017, 10:39 AM.

    Leave a comment:


  • replied
    Originally posted by Sithdown View Post
    Also interested.

    I looked over the UE4 code (DeferredShadingCommon.usf, BasePassPixelShader.usf) and the GBuffer.Velocity should be there, but accessing it on the material from a custom node always returns a black image. Accessing other buffers like Metallic and WorldNormal work as expected from any custom node.
    I have blur set to 1 on my postprocess volume, and "Accurate velocities from vertex deformation" enabled on project settings (Rendering section, optimizations).

    Working example:
    Code:
    MaterialFloat2 UV = MaterialFloat2(ScreenAlignedPosition(Parameters.ScreenPosition).xy);
    FGBufferData GBData = GetGBufferData(UV, false);
    return GBData.Metallic;
    Does not work:
    Code:
    MaterialFloat2 UV = MaterialFloat2(ScreenAlignedPosition(Parameters.ScreenPosition).xy);
    FGBufferData GBData = GetGBufferData(UV, false);
    return GBData.Velocity;
    Setup is the same as GrohBot's.

    So, the Velocity GBuffer is not being written to. Any ideas on why is that happening? I see forcing it should be easy by modifying some lines, but client uses launcher build. Thank you.
    I get the error:
    [SM5] /Engine/Generated/Material.ush(1271,1-12): error X3000: unrecognized identifier 'FGBufferData'

    Did you somehow define 'FGBufferData' beforehand

    Leave a comment:


  • replied
    Originally posted by GrohBot View Post
    I think I may have figured out a potential solution using a Custom HLSL expressions node and using it to access the GBUFFER to output screen space velocity.

    In DeferredShadingCommon.usf, there is function called GetScreenSpaceData, is there a way to call that function from within my custom node?


    MaterialFloat2 UV = MaterialFloat2(ScreenAlignedPosition(Parameters.ScreenPosition).xy);
    FScreenSpaceData ScreenSpaceData = GetScreenSpaceData(UV, false);
    return ScreenSpaceData.GBuffer.Velocity.xy;

    But I get the error:
    Error [SM5] error X3000: unrecognized identifier 'FScreenSpaceData'
    Error [SM5] error X3000: unrecognized identifier 'ScreenSpaceData'
    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

    Leave a comment:


  • replied
    Originally posted by Katod View Post
    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?

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    Originally posted by bluearc View Post
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    Originally posted by Sithdown View Post
    Could some Epic dev enlighten us? Is the velocity exposed through the GBuffer? Where should we be looking at if we wanted to expose velocity to the GBuffer, and, ultimately, to a render target?
    Get any idears for .usf shaders?

    Leave a comment:


  • replied
    I found Definition.usf

    line 154:
    #define GBUFFER_HAS_VELOCITY 0

    Seems epic disable in purpose.
    So I change is 0 value to 1.
    and still waiting UE compile all shaders.
    maybe it's hopeful.
    Than I use the GrohBot's code, but still gets black.
    Last edited by bluearc; 06-22-2017, 05:57 AM.

    Leave a comment:


  • replied
    Originally posted by Sithdown View Post
    Could some Epic dev enlighten us? Is the velocity exposed through the GBuffer? Where should we be looking at if we wanted to expose velocity to the GBuffer, and, ultimately, to a render target?
    I found some codes might relate with.
    Please found and open DeferredShadingCommon.usf at \Engine\Shaders\

    in line 344:

    // Velocity for motion blur (only used when WRITES_VELOCITY_TO_GBUFFER is enabled)
    float4 Velocity;

    in line 448:

    #if WRITES_VELOCITY_TO_GBUFFER
    OutGBufferVelocity = GBuffer.Velocity;
    #else
    OutGBufferVelocity = 0;
    #endif



    So where is this WRITES_VELOCITY_TO_GBUFFER? how to enable it?

    And,there's more Gbuffer.velocity in these usf shader files.


    Hope these can helps a little bit more.

    Leave a comment:


  • replied
    Could some Epic dev enlighten us? Is the velocity exposed through the GBuffer? Where should we be looking at if we wanted to expose velocity to the GBuffer, and, ultimately, to a render target?

    Leave a comment:


  • replied
    Originally posted by overfuze View Post
    I tried that but when I enter the PP volume, my whole unreal engine crashes. If i set the return GBData.Velocity; then the screen is just black image.
    Same Here, Just black, no matter mul a larger number or normalize it, just black.

    Leave a comment:

Working...
X