Announcement

Collapse
No announcement yet.

Radial Blur PostProcess Material

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

    #76
    Yep, that worked great in my 4.19 project, thanks for the help!

    Comment


      #77
      Anyone got this material working in 4.19 after enabled "Temporal Upsampling" ?

      Comment


        #78
        Cool!
        Thank you, I was looking for a tutorial on this.

        Comment


          #79
          Hi. I'm fairly new to blue printing and was wondering if you would be willing to show me how to replicate this in 4.19. I've tried myself but cant seem to make it work.

          Comment


            #80
            This was very useful. Many thanks.

            I'm currently using a modified version of the script which allows control of the radial center, as well as the gain and number of samples. It works in 4.19.

            Code:
            int TexIndex = 14;                               // Equivalent to the index of the PostProcessInput0 on the SceneTexture node
            float2 dir = (ScreenMult * Center - UV) * -1;  // Directon of the blur
            float4 sum = SceneTextureLookup(ViewportUVToSceneTextureUV(UV,TexIndex), TexIndex, false);  // Initial lookup of the seen, unaffected by blur
            float2 pos = float2(0.0,0.0);                  // Initializing variable 'pos'
            float currentValue = 0;                           // Initializing variable 'currentValue'
            float delta = sampleDist/Samples;              // The distance of each sampling step. The more steps, the smaller the distance
            
            // Loop for each sample
            for(int i = 0; i<Samples; i++)
            {
                // new sample position
                pos = UV + dir * currentValue;
                pos = max(min(pos, ScreenMult * float2(1.0, 1.0)), float2(0.0,0.0));
            
                // Look up and add. The higher 'i', the lower the strength of the addition
                sum += SceneTextureLookup(ViewportUVToSceneTextureUV(pos,TexIndex), TexIndex, false)* (Samples - i)*2/Samples ;
            
                currentValue -= delta;
            }
            
            // Gain control
            sum *= 1.0/((Samples/Gain)+1);
            
            return sum;

            Attached Files

            Comment


              #81
              Im having troubles making this work on mobile ES2.
              Some comment in this thread from 2015 says ES2 does not support SceneTextures while the documentations states PostProcessInput0 is supported. (see screenshot + link)
              https://docs.unrealengine.com/en-us/...ProcessEffects -> just CTRL+F "PostProcessInput0" or look below
              Click image for larger version

Name:	PostProcessInput0Supported.PNG
Views:	1
Size:	220.7 KB
ID:	1522014

              Any idea how what the problem could be?

              If have tried only using the PostProcessInput0 and multipling it by some float4 to give it a tint and that did work.
              I assume the problem is the "SceneTextureLookup()", I could be wrong.
              Mobile HDR is enabled and other Post Processing effects (like DoF) work on mobile.

              Thanks!

              Comment


                #82
                I've got the material working in a slightly different way using moadib's code in 4.20.3, here's the material, and a video workflow: https://www.youtube.com/watch?v=4ccBjlAFt0s

                Just in case anyone is interested
                Attached Files
                Website: http://artbybeven.wixsite.com/jackmadethat
                Twitch: https://www.twitch.tv/bevd0g

                Comment


                  #83
                  Originally posted by WardVanBever View Post
                  Im having troubles making this work on mobile ES2.
                  Some comment in this thread from 2015 says ES2 does not support SceneTextures while the documentations states PostProcessInput0 is supported. (see screenshot + link)
                  https://docs.unrealengine.com/en-us/...ProcessEffects -> just CTRL+F "PostProcessInput0" or look below
                  Click image for larger version  Name:	PostProcessInput0Supported.PNG Views:	1 Size:	220.7 KB ID:	1522014

                  Any idea how what the problem could be?

                  If have tried only using the PostProcessInput0 and multipling it by some float4 to give it a tint and that did work.
                  I assume the problem is the "SceneTextureLookup()", I could be wrong.
                  Mobile HDR is enabled and other Post Processing effects (like DoF) work on mobile.

                  Thanks!
                  To use "MobileSceneTextureLookup()" instead of "SceneTextureLookup()".

                  For Mobile Example:
                  Code:
                  const float2 ScreenMult = View.ViewSizeAndInvSize.xy * View.BufferSizeAndInvSize.zw;
                  
                  const int TexIndex = 14;
                  const float Samples[11] = {-0.08,-0.05,-0.03,-0.02,-0.01,0,0.01,0.02,0.03,0.05,0.08};
                  
                  float2 dir = float2(0.5,0.5) - ScreenUV;
                  float4 sum = float4(0.0, 0.0, 0.0, 0.0);
                  for(int i = 0; i<11; i++)
                  {
                      float2 pos = ScreenUV + dir * Samples[i] * BlurDist;
                      pos = clamp(pos, float2(0.0,0.0), float2(1.0, 1.0));
                  #if (ES2_PROFILE || ES3_1_PROFILE || MOBILE_EMULATION)
                      sum += MobileSceneTextureLookup(Parameters, TexIndex, pos * ScreenMult);
                  #else
                      sum += SceneTextureLookup(pos * ScreenMult, TexIndex, false);
                  #endif
                  }
                  
                  return sum / 11.0;
                  Works fine

                  Comment


                    #84
                    Does any of you have a version of this that just blurs ? With no radial involved

                    Comment


                      #85
                      does it work in 4.20, i heard there are problems with hlsl in ue4.20

                      Comment


                        #86
                        Originally posted by Bevman00 View Post
                        I've got the material working in a slightly different way using moadib's code in 4.20.3, here's the material, and a video workflow: https://www.youtube.com/watch?v=4ccBjlAFt0s

                        Just in case anyone is interested
                        I tried your sollution but it doesn't work on 4.21
                        is there any change required ?

                        Comment


                          #87
                          I was able to solve right and bottom edges.
                          Use "ViewportUVToSceneTextureUV"
                          https://answers.unrealengine.com/que...stom-node.html

                          Code:
                          const float2 ScreenMult = View.ViewSizeAndInvSize.xy * View.BufferSizeAndInvSize.zw;
                          
                          const int TexIndex = 14;
                          const float Samples[11] = {-0.08,-0.05,-0.03,-0.02,-0.01,0,0.01,0.02,0.03,0.05,0.08};
                          
                          float2 dir = float2(0.5,0.5) - ViewportUV;
                          float4 sum = float4(0.0, 0.0, 0.0, 0.0);
                          for(int i = 0; i<11; i++)
                          {
                              float2 pos = ViewportUV + dir * Samples[i] * BlurDist;
                              pos = clamp(pos, float2(0.0,0.0), float2(1.0, 1.0));
                              sum += SceneTextureLookup(ViewportUVToSceneTextureUV(pos * ScreenMult, TexIndex), TexIndex, false);
                          }
                          
                          return sum / 11.0;

                          Comment


                            #88
                            Has anyone managed to get this working on UE4.22?

                            Comment


                              #89
                              Originally posted by Keytotruth View Post
                              Has anyone managed to get this working on UE4.22?
                              Mine still works in 4.22



                              Custom node code is:

                              Code:
                              int TexIndex = 14;
                              float2 dir = ScreenMult * Center - UV + Distortion; 
                              float4 sum = SceneTextureLookup(ViewportUVToSceneTextureUV(UV,TexIndex), TexIndex, false);
                              float2 pos = float2(0.0,0.0);
                              float delta = sampleDist/Samples;
                              float initial =  Samples/2 * delta;
                              float currentValue = initial;
                              for(int i = 0; i<Samples; i++)
                              {
                                  pos = UV + dir * currentValue;
                                  pos = max(min(pos, ScreenMult * float2(1.0, 1.0)), float2(0.0,0.0));
                                  sum += SceneTextureLookup(ViewportUVToSceneTextureUV(pos,TexIndex), TexIndex, false)* i*2/Samples ;
                                  currentValue -= delta;
                              }
                              sum *= 1.0/((Samples/Gain)+1);
                              return sum;
                              Nodes

                              Comment


                                #90
                                Sorry for the long delay on responding everyone. I didn’t see any notifications via email! I shared a zip of a VR version a while back, don’t remember what engine version it was or if it will still work but here’s the link:
                                https://forums.unrealengine.com/file...tch?id=1502738

                                Comment

                                Working...
                                X