Announcement

Collapse
No announcement yet.

Does fading out textures improve performence? (e.g. using PixelDepth)

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

    Does fading out textures improve performence? (e.g. using PixelDepth)

    Hi, everybody!

    I was wondering if fading out a texture in a material over distance using PixelDepth actually improves the performance.
    There are examples of such materials in the starter content. For example there is a material called M_Ground_Grass which uses PixelDepth to fade out a texture the further away it is from the camera.

    Does this actually improve the performance because the texture with the higher resolution no longer needs to be displayed or does it still need to be calculated anyway?

    If I have a scene where the player can zoom out quite far could I use that technique to have high resolution textures when the camera is close to the ground and a low resolution version when the camera is far away or would it be better to just make several LODs of the ground meshes and then apply differently detailed materials to them?

    Long story short: Would it make sense to use PixelDepth instead of making LODs and multiple materials?

    Edit: Sorry about the typo in the title. I can't edit it.
    Last edited by KnitterX; 10-29-2014, 12:26 AM.

    #2
    There's already a system that creates various sizes of a texture and then switches to a lower resolution as the object gets farther away.

    Comment


      #3
      Originally posted by darthviper107 View Post
      There's already a system that creates various sizes of a texture and then switches to a lower resolution as the object gets farther away.
      this is different. the texture is still being sampled in this case and every pixel has the same amount of instructions. all this does is help with memory uasge really

      I'd also be interested in an answer to this topic, an answer maybe with in-depth explanations and/or numbers and comparisons if possible
      Follow me on Twitter!
      Developer of Elium - Prison Escape
      Local Image-Based Lighting for UE4

      Comment


        #4
        No it will not help performance, it will hurt it slightly, because you add instructions to the shader that will be executed. Texture MipMaps, geometry LOD and culling help performance.

        Comment


          #5
          Doing this will actually hamper performance, not help it. LOD's and Mip-Maps exist already and are about as efficient as it gets right now.

          Comment


            #6
            Originally posted by TheJamsh View Post
            Doing this will actually hamper performance, not help it. LOD's and Mip-Maps exist already and are about as efficient as it gets right now.
            How about fading out stuff like Prallax occlusion or similar? Shouldn't that help?

            Comment


              #7
              Parallax Occlusion mapping isn't something that improves performance, it gives an effect similar to displacement but doesn't actually subdivide the mesh or push vertices.

              Comment


                #8
                Then what is the point of fading out the more detailed texture in the example M_Ground_Grass if it was actually even better to just keep it?

                Comment


                  #9
                  Originally posted by KnitterX View Post
                  Then what is the point of fading out the more detailed texture in the example M_Ground_Grass if it was actually even better to just keep it?
                  Most likely due to aliasing or to avoid tiling at distances. IIRC, that material is designed so that as you move far away from it, it tiles less and less so you don't see the repetition so much in the distance. It's a neat trick and relatively cheap, but anything you do in the pixel shader is done for every pixel, every frame.

                  I think what OP is getting at, is the ability to switch off features as you move further away, to prevent artefacts and filling the screen with those pink and white pixels you get in Shader Complexity View. Lodding Shader Features is possible but either requires a lot of Lerp/Switch nodes that use distance-based gradients (pixel depth or camera fade etc), or blueprint/code intervention to switch off features globally in a shader.

                  I've never actually put this to the test but I've been meaning too, but I'm pretty sure that fading out complex code via a lerp won't actually improve your performance at runtime at all, because Lerps are dynamic and the renderer is prepared for their inputs to change at any time. It doesn't know what that input could be, so everything in both A and B has to be stored somewhere just in case either is needed. Switch nodes are possibly the same. This is based on intuition though, not an actual test. Really should try this out.

                  Two different ways to think about are certainly the following (but it all depends on your situation):
                  Physical LODS = Less Computationally Expensive > More Memory Intensive.
                  Shader LODS = More Computationally Expensive < Less Memory Intensive.

                  It's a constant trade-off between the two.
                  Last edited by TheJamsh; 10-29-2014, 06:32 PM.

                  Comment


                    #10
                    Originally posted by darthviper107 View Post
                    Parallax Occlusion mapping isn't something that improves performance, it gives an effect similar to displacement but doesn't actually subdivide the mesh or push vertices.
                    I know what it does, I just wondered if there would be any benefit (other than looks) in fading out a POM effect so only the area close to the viewer is affected by it.

                    Comment


                      #11
                      For POM this surely improves performance. It also helps for other advanced materials but the effects needs to have a certain amount of complexity to get benefits. That is because, just as mentioned before, the fading/blending has its own cost.
                      3.14159265359

                      Comment


                        #12
                        Originally posted by TheJamsh View Post
                        but I'm pretty sure that fading out complex code via a lerp won't actually improve your performance at runtime at all, because Lerps are dynamic and the renderer is prepared for their inputs to change at any time. It doesn't know what that input could be, so everything in both A and B has to be stored somewhere just in case either is needed.
                        actually I've heard that the GPU is efficient at 'culling out' stuff that isn't used at all by the shader code (i.e. Lerp(A,B,0) and B isn't used ). but this could be wrong.

                        Originally posted by mAlkAv!An View Post
                        For POM this surely improves performance.
                        this. I used to have a POM shader in a landscape in UDK and the performance died unless it was faded so it only occurred until a few meters away from the camera.


                        also while the fading/blending has its own cost, I don't think it's really costly even the first time. and for a second/third/etc time the extra cost would be zero if the distance params are kept the same

                        someone needs to make a test
                        Follow me on Twitter!
                        Developer of Elium - Prison Escape
                        Local Image-Based Lighting for UE4

                        Comment


                          #13
                          Originally posted by mAlkAv!An View Post
                          For POM this surely improves performance. It also helps for other advanced materials but the effects needs to have a certain amount of complexity to get benefits. That is because, just as mentioned before, the fading/blending has its own cost.
                          Great, thanks! Hadn't tested yet but I was pretty sure it would help.

                          Comment

                          Working...
                          X