Announcement

Collapse
No announcement yet.

So Blurred glass material is impossible in Unreal Engine 4?

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

    #16
    Nevermind figured it out. You need to set the material to "Before Tonemapping" down in the "post process material" settings.

    This is a really nice basically free way to get controllable blur. The only problem with this technique is you will give up DOF elsewhere in the scene since this isn't doing a separate pass its simply blending to a scene without the post process for outside the window.
    Ryan Brucks
    Principal Technical Artist, Epic Games

    Comment


      #17
      In this example, I used a simple plane instead of a cube, I unchecked "Receive Decals" on the skeletal mesh and used SceneTexture:decalmask to better define where the blur is applied.
      And it works but the problem is that I can't get rid of the "blurry halo" around the character:

      Click image for larger version

Name:	Blurring_Glass_WIP_5.jpg
Views:	1
Size:	25.1 KB
ID:	1076587

      Such a shame I can't exclude the character from beeing affected by depth of field, as meshes with translucent materials can be.
      Or is there an option here?
      Last edited by EdWasHere; 07-02-2015, 04:22 AM.
      GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

      Comment


        #18
        The above halo problem is a pretty standard problem. Even the approach I did has that same problem.

        The custom node version can fix this problem though by comparing depths and rejecting a sample if it came from a depth that is greater than the window. But then you have to do something like use an old color or use no color, which means you still have a halo of some kind, like a halo of no blur at all. Clever use of temporalAA may help solve it. I haven't tried that yet but it might be fun to mess around with.
        Ryan Brucks
        Principal Technical Artist, Epic Games

        Comment


          #19
          Ok, I found a way to get rid of the halo.

          Click image for larger version

Name:	Blur_No_Halo.jpg
Views:	1
Size:	121.2 KB
ID:	1078790

          So now I have 2 problems to fix:

          1 - The skySphere is not affected by DOF. I don't think it's the most difficult part - but I didn't find out how to tweak it's material the proper way).

          Click image for larger version

Name:	SkySphere_No_Blur.jpg
Views:	1
Size:	36.9 KB
ID:	1078792

          2 - With my actual setup, actors are always or never blurred.

          Click image for larger version

Name:	Third.jpg
Views:	1
Size:	30.5 KB
ID:	1078793

          So, in the pic above, my character which is behind the window, should be blurred, but he is not.
          Last edited by EdWasHere; 07-02-2015, 03:11 AM.
          GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

          Comment


            #20
            How did you accomplish masking the actors from the DOF? you didn't have the sky masking problem before. That default engine sky is opaque which means there should be no issues picking it up in DOF.
            Last edited by RyanB; 05-24-2015, 12:15 PM.
            Ryan Brucks
            Principal Technical Artist, Epic Games

            Comment


              #21
              I did something similiar for my painting game, using the final render pass with DOF as blur and then using scene color for everything else. Obviously that is far from optimal because you can't use all those other post FX like Bloom and stuff.
              Is there any chance that we can get a seperate blur effect that we can maybe even apply to different things in the post processing material?
              Would be also cool to use such blur effect for something like when you get hit or be underwater and screen masking could be animated.
              If we would have access to custom masks it would make such things also easier, I made a thread about it here: https://forums.unrealengine.com/show...hp?70509-Masks

              Comment


                #22
                Would be also cool to use such blur effect for something like when you get hit or be underwater and screen masking could be animated
                What do you mean by "animated screen masking"? If you mean a mask redefined every frame according to you needs, this setup already allows this, even if it has to be improved.
                Last edited by EdWasHere; 07-02-2015, 04:23 AM.
                GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                Comment


                  #23
                  Originally posted by EdWasHere View Post
                  @RyanB:

                  To mask the character:
                  1- I uncheck "Receive Decals" in his rendering settings
                  2 - In the PostProcess Material, I use a "SceneTexture - DecalsMask" node, to get it's silhouette as a first mask.
                  3 - I combine this mask with the one from "SceneTexture - CustomDepth" (which gives me the window silhouette). This way, I have a final mask and I use it to combine 2 renders of the Scene.
                  a) The first from "SceneColor".
                  b) The second from a Texture RenderTarget (I got rid of the "SceneTexture:PPInput0" node, as it gave me this undesired halo).
                  In order to do that, I added a SceneCapture2D Actor in the scene and, in the level Blueprint, I put it every frame at the same location and rotation that the Camera Component of the character.
                  In the SceneCapture2D settings, I activate Gaussian DOF and uncheck "Skeletal Meshes" flag, so that the character doesn't appear.
                  I kept my PostProcess Volume in the level, even if I don't use PPInput0 anymore, as I need to attach my PProcess Material (blendable) to something.

                  Here is my PPMat setup.

                  [ATTACH=CONFIG]40851[/ATTACH]


                  Some problems, though, with this setup:

                  - Sky is not blurred. I think that's because I capture from a SceneCapture2D actor (what's wrong with this actor/skyspheres?) because I checked that if I use PPInput0 node, the sky is as blurry as the rest of the scene.
                  - If I put translucent materials in the scene, they appear to be affected by depth of field in the TextureTarget and they shouldn't (is it a limitation of this actor? is it a bug?).
                  - If I set "Capture Scene" settings to "Final" with "Capture every frame" checked, I get an almost black window, something really weird (???!!!). If I uncheck it, it works - but it's a problem as soon as the character doesn't move anymore.
                  - Because I use the DecalsMask output, the mask isn't defined according to depth and positions of the actors relative to the window.

                  For these reasons, I'm digging in an other direction, to get something more optimized, using depth calculations and getting rid of the DecalsMask output. Should be ready soon.


                  @Davision:


                  If you're using SceneColor, that's right, but if you use a second render from a second SceneCapture2D actor, then it seems you can still use some post FX effects. I'm experimenting with this now.
                  By the way: are there sreenshots of your painting game? Is it a W.I.P?


                  If you can define your mask with precision, you can apply the gaussian blur on anything in the screen. Here, I apply it to a plane only rendered in custom depth but you could apply it
                  to any number of any meshes set up the same way.


                  What do you mean by "animated screen masking"? If you mean a mask redefined every frame according to you needs, this setup already allows this, even if it has to be improved.
                  That is quite a big workaround to get that working! You do all that stuff to get the character in front not affecting the blur of the window but what about other objects that are in front of it, like a wall?

                  That is a interesting approach which SceneCapture to seperate it but for my painting game I like to have the blur in my post material and defined there, not for a specified object.
                  Here is a gif of my game, I mainly use the final render DOF blur for blurring the paint near the edges on the side:

                  The painting mask is basically done by using the translucent pass as a mask, which is quite the hack that then doesn't allow me to use any other translucency in the game. Custom masks would here be much better too. The problem with your usage of masks is that you basically use up all the possible masks you can have just for your windows. So you can't have anymore masking in your game for instance for outlines and decal mask is meant for masking decals which you can't do anymore now.
                  With animated screen masking I just mean fading a blur in and making it more blurred on the edges of the screen and the like.

                  I'm also already using CustomDepth and DecalMask for other things, here is recent gif: http://i.imgur.com/B4GU8rR.gif

                  Comment


                    #24
                    The problem with your usage of masks is that you basically use up all the possible masks you can have just for your windows. So you can't have anymore masking in your game for instance for outlines and decal mask is meant for masking decals which you can't do anymore now.
                    So you agree with what I said about limitations of this technique.

                    I know it's not ideal. This is just experiments while I'm discovering UE4.
                    However, I think a postprocess material is not the better way to achieve such effects. It would be better to use shaders. But, as already said, I don't know how to do it.
                    Or it would be cool to be able to manipulate camera layers but it seems this feature is missing in UE4.

                    The problem in your gif is that I see blur nowhere. The effect is cool but where's the blur? Must be a subtle effect.
                    Last edited by EdWasHere; 05-25-2015, 12:31 PM.
                    GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                    Comment


                      #25
                      Looks like there's going to be another option for blurred glass soon, Spiral Blur Scene Texture

                      https://forums.unrealengine.com/show...view-5-29-2015

                      Comment


                        #26
                        Yes. Isn't it what RyanB already showed in this thread?
                        GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                        Comment


                          #27
                          Yeah it's the same thing it looks like, nice seeing how it's going to be intergrated though.

                          Comment


                            #28
                            Yes but looking at the screenshot with this kind of rubik's cube and balls, it seems that everything is not blurred as you would expect e.g the same way: some parts (shadow on the right) seems more blurred that edges of the cube.
                            Last edited by EdWasHere; 06-11-2015, 05:57 PM.
                            GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                            Comment


                              #29
                              In that image, it was masking the amount of blur by the distance from the object to the glass. You can easily disable that by leaving the depth mask at 1.

                              But yes, this isn't nearly as fast or good as a "proper" hardware implemented blur. Some engine programmers actually suggested that more 'special case' functions like this be put into a separate content example or sample project rather than going straight into engine since the blur here is not a fully engine-level supported blur. Ie it could be slow and have sorting issues I am curious what you guys think since I don't think we decided one way or another for sure.

                              The things that a 'proper' blur can do to be way faster include: creating halfres buffers at each step and then sampling from those. this step alone can be a huge 10X+ speed increase but its simply not possible with materials.
                              It is possible to make the spiral blur a bit faster by getting 1 free blur by offsetting the initial scenetexture sample by half a pixel which uses the hardwares filtered lookup to get a 1 pixel blur for almost free.
                              Ryan Brucks
                              Principal Technical Artist, Epic Games

                              Comment


                                #30
                                Meanwhile, somewhere in outer space...

                                Click image for larger version

Name:	WIP_1.jpg
Views:	1
Size:	687.4 KB
ID:	1079287

                                So, I changed a lot of things in my postprocess material to get rid of all halos problems, for meshes and pawn, in any point of view in the scene. I don't use decal mask, etc... It was too complicated and so limited, as davision constructively mentionned it.
                                With this new setup I can have a big gaussian blur in the glass panel (tweakable) while keeping subtle gaussian DOF.

                                I still have to improve some things and then i'll post a video.
                                Last edited by EdWasHere; 07-02-2015, 03:48 AM.
                                GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                                Comment

                                Working...
                                X