Announcement

Collapse
No announcement yet.

Dynamic Decal Blending + Mesh Integration Tools

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

    #16
    Originally posted by Chosker View Post
    dithering is not my friend. for quick LOD transitions it's good but for permanent effects up-close it's ugly. the only way to mitigate its uglyness is to use TemporalAA, which in UE4 gives you horrible smearing of moving objects (or the entire screen if the camera moves) and blurs the entire scene as well.


    no. there isn't an awesome node that allows you to optimize materials on the fly based on an evaluated condition.
    you obviously lack this very simple shader knowledge so I'll make it clear for you: Lerp samples both inputs first and then blends between them. all the time. for all pixels. always. lerp doesn't do dynamic branching so when you "compare values and determine what to do" and "fade things over a distance", both versions that go into the lerp are contributing to the shader complexity, always.
    fading things over a distance is used for cosmetic purposes (fading normalmaps into a flat normal, fading textures to a less tiled version to avoid repetition), but whether you know it or not, it causes extra overhead which I'm sure you'll agree means it's the opposite of optimization. pretending it optimizes your material is simply lying to yourself out of ignorance.

    "optimize your materials". sure.
    It comes down to everyone not knowing how to optimize their materials, every time.
    Last edited by Maximum-Dev; 07-30-2017, 05:13 PM.
    Artstation
    Join the support channel
    Gumroad Store

    Comment


      #17
      Oh wow, I assumed that the engine already had dynamic branching implemented in it but I tested it pretty thoroughly and it definitely doesn't... So far, I've made all of my materials assuming it was in the engine and never really bothered to actually benchmark test it to see. I mean it's only been an HLSL feature since what, SM3? It kind of makes sense to code an engine so that if a lerp is a 0/1 or an IF node is an A/B, that it would skip the rest of the stuff behind the branch that wasn't needed. Shame on me for expecting that out of a AAA engine in 2017 lol...

      That being said, does branching in a custom node work at least?

      [branch]
      if(some condition is true)
      {
      result=do branch A;
      }
      else
      {
      result=do branch B;
      }
      return result;
      On the plus side, at least all of my materials are ready to go for when it does get implemented. I might go back and replace my IF nodes with a custom node, if it actually supports the branching.


      Originally posted by Chosker View Post
      dithering is not my friend. for quick LOD transitions it's good but for permanent effects up-close it's ugly. the only way to mitigate its uglyness is to use TemporalAA, which in UE4 gives you horrible smearing of moving objects (or the entire screen if the camera moves) and blurs the entire scene as well.
      And about the dithering, at a distance, it's not really a big deal. If dynamic branching really worked, it would save a TON of performance to dither blend two distant materials together, rather than do an actual lerp between them.

      Left: regular blending, Right: dithered blending
      Click image for larger version

Name:	LeftRegularRightDither.jpg
Views:	1
Size:	170.5 KB
ID:	1131847

      Hybrid blend where it will do a normal blend <600 units and a dithered blend beyond that:
      Click image for larger version

Name:	hybrid600units.jpg
Views:	1
Size:	152.1 KB
ID:	1131848

      Comment


        #18
        Originally posted by Chosker View Post
        "optimize your materials". sure.
        Originally posted by Maximum-Dev View Post
        It comes down to everyone not knowing how to optimize their materials, every time.
        Update: Yes, you can put in some dynamic branching. I had some time to mess around and quickly made a simple IF switch custom node. I put it through the ringer and it works great! To benchmark it, I just set up an overkill lerpfest between four 8k textures for the complex part and just a plain color for the simple part. Within the level BP, I made a simple loop that alternates between the two states every 10 seconds (to ensure the graph settles).

        One caveat that I've found is that if you have any sort of animating going on behind the "deactivated branch," like a panner, it will keep the textures "hot" in the cycles and they will still contribute to frame time. Though I did only put one of these custom functions in and it was right before the material attributes. It's a pretty cheap little function, so it probably wouldn't hurt too badly to throw more of them into the mix; like before things like panners if needed.

        Code:
        [branch] if ( A >= B)
        {
        return ThroughA;
        }
        else
        {
        return ThroughB;
        }
        When it's on: ~90ms
        When it's off: ~67ms
        So it's definitely working!

        Click image for larger version

Name:	works.jpg
Views:	1
Size:	229.5 KB
ID:	1131859

        Comment


          #19
          Originally posted by IronicParadox View Post
          When it's on: ~90ms
          When it's off: ~67ms
          So it's definitely working!
          Shouldn't the single color branch be way faster than 67ms if it's dynamic branching?

          Comment


            #20
            Originally posted by cyaoeu View Post
            Shouldn't the single color branch be way faster than 67ms if it's dynamic branching?
            1080p, epic settings, dynamic lighting, bunch of other programs open and a toaster of a video card... Blank scene, with those settings, I will get like 10fps lol.

            EDIT: Tested it out, yep, 10fps with just the character, the dynamic lighting and those settings. Maybe I need to restart the editor because that still doesn't seem right.
            Click image for larger version

Name:	lolfps.jpg
Views:	1
Size:	7.7 KB
ID:	1131861
            Last edited by IronicParadox; 07-31-2017, 04:11 PM.

            Comment


              #21
              we're well aware of the advantages of using dynamic shader branching
              how about going to the thread where we request proper support (i.e. via nodes) instead of derailing this thread?
              Follow me on Twitter!
              Developer of Elium - Prison Escape
              Local Image-Based Lighting for UE4

              Comment


                #22
                So the dynamic branch node you can place in the material editor doesn't work? The more you know...

                Comment


                  #23
                  Originally posted by Chosker View Post
                  we're well aware of the advantages of using dynamic shader branching
                  how about going to the thread where we request proper support (i.e. via nodes) instead of derailing this thread?
                  Yeah it's getting a little derailed, but we were talking about optimization because Deathrey started talking about sampling when you have a ton of layers. Regardless, this dynamic branching topic is VERY much a part of making something like these CE decals come to life.

                  Originally posted by Zeblote View Post
                  So the dynamic branch node you can place in the material editor doesn't work? The more you know...
                  The built in one doesn't work. It would just be using the same method as flattening; like the IF node or the lerp node when they are at zero or one. The custom node method is the only real way to make it work right now. Speaking of the lerp node, I need to make a dynamic node version of it so that it branches at zero and one.

                  Comment

                  Working...
                  X