Announcement

Collapse
No announcement yet.

Radial Blur PostProcess Material

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

    #31
    Sick work mate! Been wanting something like that to use along with a dash mechanic!!!
    Github - YouTube - Unreal Slackers - KITATUS

    Comment


      #32
      Originally posted by Kory View Post
      People may also try this custom node for a soft guassian like appearance. lower-cased uv and no extra parameter to adjust weight.
      Code:
      float3 res = 0;
      float2 invSize = GetPostProcessInputSize(0).zw;
      int TexIndex = 14;
      float weights[] =
      {
        0.01, 0.02, 0.04, 0.02, 0.01,
        0.02, 0.04, 0.08, 0.04, 0.02,
        0.04, 0.08, 0.16, 0.08, 0.04,
        0.02, 0.04, 0.08, 0.04, 0.02,
        0.01, 0.02, 0.04, 0.02, 0.01
      };
      float offsets[] = { -2, -1, 0, 1, 2 };
      
      uv *= 0.5;
      for (int i = 0; i < 5; ++i)
      {
        float v = uv.y + offsets[i] * invSize.y;
        int temp = i * 5;
        for (int j = 0; j < 5; ++j)
        {
          float u = uv.x + offsets[j] * invSize.x;
          float2 uvShifted = uv + float2(u, v);
          float weight = weights[temp + j];
          float3 tex = SceneTextureLookup(uvShifted, TexIndex, false);
          res += tex * weight;
        }
      }
      
      return float4(res, 1);
      Hi Kory, the effect does not seem to be resolution independent. It seems to be always a fixed pixel size. I tried to multiply this out by again multiplying/dividing by invSize.x/y, but it still is resolution dependent.

      Comment


        #33
        Originally posted by isgoed View Post
        Hi Kory, the effect does not seem to be resolution independent. It seems to be always a fixed pixel size. I tried to multiply this out by again multiplying/dividing by invSize.x/y, but it still is resolution dependent.
        OK, I found it myself, when trying to find the center for the radial blur: Seems the input ScreenPosition or TexCoord (the UV) are with respect to the wrong port (probably the offscreen). To correct it you need to multiply them with View.RenderTargetSize/ViewSize. See attached screenshot to determine the center:

        Click image for larger version

Name:	2016-04-08-Correct Center PostProcess Blur.png
Views:	1
Size:	310.8 KB
ID:	1104075

        Comment


          #34
          How to Adjust the Vanishing Point

          Hi guys, i'm trying to use this PP material in my 4.11 project

          This is the material setup: Click image for larger version

Name:	MaterialRadialBlur.JPG
Views:	1
Size:	269.2 KB
ID:	1109255


          This is the result: Click image for larger version

Name:	VanishingPoint.jpg
Views:	1
Size:	368.6 KB
ID:	1109256


          How do i adjust the radial blur vanishing point?

          Thanks!

          Comment


            #35
            How do i adjust the radial blur vanishing point?
            I have modified this node to be compatible with 4.12.4. Upon compiling the original HLSL code, the editor threw an undeclared identifier for both View.ViewSizeAndSceneTexelSize and View.RenderTargetSize leading me to believe that Epic has recently renamed these identifiers. You could replace the first line to GetPostProcessInputSize(0).wz; however for the radial blur is then vanishing at the top left corner of the viewport rather than the center of the screen.

            I'm not savvy enough in HLSL or UE4's specific variables and names to know what these have been changed to, however I have produced the same results using the nodes that return those values:

            Click image for larger version

Name:	Radial Blur.PNG
Views:	1
Size:	336.5 KB
ID:	1111459

            I have simply added a new pin to the custom HLSL node named "ScreenMult" (case-sensitive) and removed the first line of code declaring that variable:
            Code:
            int TexIndex = 14;
            float samples[10] = {-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08};
            float2 dir = ScreenMult * float2(0.5,0.5) - UV; 
            float4 sum = SceneTextureLookup(UV, TexIndex, false);
            float2 pos = float2(0.0,0.0);
            for(int i = 0; i<10; i++)
            {
                pos = UV + dir * samples[i] * sampleDist;
                max(min(pos, ScreenMult * float2(1.0, 1.0)), float2(0.0,0.0));
                sum += SceneTextureLookup(pos, TexIndex, false);
            }
            sum *= 1.0/11.0;
            return sum;
            Then simply input the ViewSize / RenderTargetSize math using their nodes.

            The result is a proper vanishing point:



            In theory, I think setting the ScreenMult variable in the blueprint editor will also allow the user to change the position of the vanishing point manually by changing that value. This would work well if you decide to also move the CenterPosition (V2) on the RadialGradientExponential node.
            Attached Files
            Last edited by Zarrashi; 07-04-2016, 07:31 AM.

            Comment


              #36
              I copy from above,but it didn't work in 12.5.Nothing happened.I put it into a post process volume/blend,tick the unbound on.Do some one experienced it too?

              Comment


                #37
                Thanks for this great tutorial! It works well in my project, but when I tried to use it in a VR project , there are something wrong with the right eye display. Any suggestions for me? Thank you very much!

                Comment


                  #38
                  Originally posted by Huolynn View Post
                  Thanks for this great tutorial! It works well in my project, but when I tried to use it in a VR project , there are something wrong with the right eye display. Any suggestions for me? Thank you very much!
                  Possibly see my post #33

                  Comment


                    #39
                    Originally posted by isgoed View Post
                    Possibly see my post #33
                    It seems that in my situation, it is not about the center, it is the display in right eye has a left and right reversed problem (sorry for my poor English, hope you can understand what I mean)

                    Comment


                      #40
                      Yes, but it might be the same viewport-renderport issue. Your renderport most likely uses an offset for the right eye. by using the postprocess material of my post #33, you can visualize the coordinates. You should have a cross in the center. Else you need to correct for the renderport or viewport-coordinates.

                      Comment


                        #41
                        Originally posted by isgoed View Post
                        Yes, but it might be the same viewport-renderport issue. Your renderport most likely uses an offset for the right eye. by using the postprocess material of my post #33, you can visualize the coordinates. You should have a cross in the center. Else you need to correct for the renderport or viewport-coordinates.
                        By using your post process material, I do get a cross in the center, but when I look it from HTC vive, right eye is still wrong.

                        Comment


                          #42
                          I am trying to make some sort of super speed effect with this.
                          Is there any way to attach any of the parmeters to the speed of my First Person Character?
                          Which param should I use to achieve this?

                          Comment


                            #43
                            Hey guys, this seems to be THE Radial blur thread. I'm having trouble reproducing the blur. I feel like I've copied the instructions accurately (I've not spent much time in the material editor so I don't understand most of it), but I'm not seeing the blur I was hoping for. You can see my nodes in the image below.

                            Click image for larger version

Name:	RadialBlur_1.png
Views:	1
Size:	169.6 KB
ID:	1121201

                            There's an error "Error [SM5] Material.usf(1270,21-50): error X3004: undeclared identifier 'View_ViewSizeAndSceneTexelSize" which I don't really understand. I also tried applying the post process to camera in my scene and got the result you see below. Not exactly what I was expecting.

                            Click image for larger version

Name:	RadialBlur_2.png
Views:	1
Size:	843.7 KB
ID:	1121200

                            Do you guys have any suggestions?

                            Comment


                              #44
                              Cheers [MENTION=96229]Zarrashi[/MENTION] [MENTION=3227]Tomura[/MENTION]

                              Zarrashi's tweaks seem to work in both 4.10 & 4.14.1...
                              (Limitations: Needs changes to work in Split-Screen etc)

                              Comment


                                #45
                                Hi everyone ! Thanks [MENTION=96229]Zarrashi[/MENTION] i tried your way but I can't see anything when I press play. I've create a material, I can Apply the changes without any error but when I launch the game I can't see the blur... Many thanks in advance for your help (sorry for my english).

                                Comment

                                Working...
                                X