Announcement

Collapse
No announcement yet.

Pixel Tracking Methods: Optical Flow Methods

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

    #46
    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

    Comment


      #47
      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

      Comment


        #48
        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.
        Ryan Brucks
        Principal Technical Artist, Epic Games

        Comment


          #49
          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.

          Comment


            #50
            i need this solution too,how to get motion vector buffer?

            Comment


              #51
              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.
              Check 3d tips! POLY DNA

              Comment

              Working...
              X