Announcement

Collapse
No announcement yet.

Dynamic flow control in materials

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

    #46
    Originally posted by Deathrey View Post
    Dirty? Yes. Technical? No.
    Yes, it's technical in the sense that it's trying to simulate a heavy and a light load.

    That is a first time I come across a term "vertex sampler". Why would you sample a vertex? It is just a vertex, leave it alone.
    If you want to know the information of a specific vertex, such as it's XZY position, you sample it's information... Therefore you're sampling a vertex and that would make it a vertex sampler...
    Click image for larger version

Name:	Untitled.jpg
Views:	1
Size:	55.5 KB
ID:	1132125

    So far, you haven't demonstrated a working branch, but you are eagerly showing lack of competence, by engaging into argument without anything constructive backing you up. Hilarious thing is that if you in particular were able to at least check ASM result of your code, that argument would not be taking place.
    Yes, I definitely have shown a type of dynamic branching but you can keep wallowing in your denial all you want. The beauty about facts is that they are indifferent to opinions. And yes, that couldn't happen under normal circumstances but if you had other things directly editing the memory, that's a whole different story. Like I said though, it's more of an engineering habit because if you're designing a machine, that can possibly be hazardous to human health, you need to "dot all of your Is and Ts," or else you can be held liable for damages. I didn't really want to dive into explaining it, so I kind of just skipped over it.

    The source is out there, not hidden behind seven seals.
    I'm sure it is, but I've never bothered to check because I don't feel like playing follow the rabbit down the rabbit hole of includes; through thousands of lines of code. Have you studied/read through it entirely and do you comprehend it 100%?

    What is this phrase doing here? It does not tag along well with a concept of maintaining decent level of professionalism.
    She's actually a professional cook! Though using your logic, we had better grab our pitchforks and torches for the 90% of "professionals" that have appeared on live streams and joke around non-stop(Epic devs, please don't stop with the jokes and humor on streams). Also, you have little room to talk about professionalism. You try to be as politely insulting as possible and it's a cringe-worthy attempt at best.

    I truly hope so, because everything, you've posted in this thread up to this point, is misleading pseudo-scientific rant with a very limited value to the topic discussed.
    There is technically no such thing as something being pseudo-scientific. That phrase, alone, is a psuedo-phrase. Either it's scientific or it's not scientific; just like binary. You either follow a scientific method or you don't and there is technically no grey area between. Almost sounds like some form of an ironic paradox though.... But you can think what you want, you're just being arrogant and stubborn at this point.



    Hopefully I'll have some time this next week or so and I'll make a better example. I'll probably make a layered landscape material that has some branching in it and I'll make a second copy without it all in there; to show the FPS differences. I have a couple of landscape materials ready to go and working, but I don't want to share the materials for obvious reasons. I'll try to remake something similar enough, but that doesn't show any of my actual individual materials. This is a game development forum, so I'm sure people can understand not wanting to share actual source.

    It will probably show something like calculating out three or four masks, instead of the one in the example, packing them into a V3/V4 and then feeding those masks to the various branches and channels of the material. The masker would have A1/B1, A2/B2, etc inputs to solve C1/C2/C3/etc outputs and then you'd just say return = float4(C1,C2,C3,C4). It doesn't have to be too fancy of a custom node because you'll just solve everything out with regular nodes leading into the custom node. Here's a super quick example of what I'm talking about:
    Click image for larger version

Name:	Untitled2.jpg
Views:	1
Size:	148.0 KB
ID:	1132127

    EDIT: Oh and I know that you can easily calc this stuff out with regular IF nodes, but like I said in the last video, the lerp nodes are really flakey about their alpha inputs and it will directly determine whether or not the lerp will/will not branch. I'm assuming because the the custom node acts as a "blocker" or something and it can't precompute the stuff behind it or something along those lines.
    Last edited by IronicParadox; 08-06-2017, 12:11 AM.

    Comment


      #47
      determine whether or not the lerp will/will not branch.
      Lerps do not branch. They are only subjected to constant folding of alpha input, which you successfully demonstrated in your examples.


      I'm assuming because the the custom node acts as a "blocker"
      I wasn't too happy about it all because I had been designing around that false assumption.
      I'm assuming that flatten is the default
      I'm going to assume that it acknowledged
      You either follow a scientific method or you don't
      You are making too many assumptions, for a sworn follower of scientific method. That leads you to misconceptions and wrong conclusions.


      Yes, I definitely have shown a type of dynamic branching.
      Nope. The thread is about dynamic flow control and its importance for UE4. You are showing constant folding only up to this point, which was working flawlessly even without your intervention. Quit derailing yet another thread.
      Last edited by Deathrey; 08-06-2017, 01:27 AM.

      Comment


        #48
        On working model 2, I could have easily just made it do the EXACT same thing as the custom node in, working model 1, and it would still show that the branching works. I only put it in there because you were complaining and trying to claim that it wouldn't ever work with dynamic inputs and that none of my other examples were "real world" examples.
        another broad assumption. you could have but you didn't, thus failing to prove anything with "working model 2"

        And no, I actually corrected the second model because you guys said that it didn't work with dynamic inputs like vertex/pixel samplers. Your "code" is simple and nothing special. You literally copy+paste'd the reference on how to sample texture objects, filled in the necessary parameters(there's usually a whole list of potential parameters and the order to place them into the sampler) and modified the UVs with an offset on each loop through. Oh and divided by a number...
        I don't know where criticising my code comes from at this point, given that it was just a test to compare against your method. and a test that stresses the most common case where branching is desireable (sampling textures)
        it's not about my code being fancy or revolutionary. it's about what the code is doing: having the operations nested inside the branch or having it outside of the branch

        you're missing the point once again and derailing the thread. so let me remind you:
        • You claim your method can do dynamic shader branching using regular material nodes, with just a Custom Node containing the branch evaluation
        • We claim the only method to do dynamic shader branching is by nesting all the to-be-branched operations inside the branch itself, which forces writing the operations as HLSL code inside the custom node, which means you can't use regular material nodes

        by using my Custom node and having the texture sampler loop nested inside the branch, and of course not even using regular nodes, you failed to prove your method because you used our method.

        so far you haven't shown a single case where your method is used properly and comparing the performance against not using the branching at all, which is paramount when measuring performance.


        if you still intend to spend a bit of time with tests and showing "that it works" I'll suggest to try your method another common case of dynamic branching: triplanar mapping. as you know it will sample a texture 3 times (once per axis) so the cost of those 3 samplers is there for all pixels permanently. with dynamic branching you'd have only the cost of a single sampler (on areas where any given axis is 100% blended, which should be the majority), and just a few more costly areas where 2 or 3 textures will be sampled (the parts where the axis blend)
        of course if you do, provide a comparison against using triplanar mapping without any sort of branching, otherwise there's no indicator of wether or not the branching is beneficial.
        I'd do it myself but your method looks different every time you show it, so I'm sure I won't get it the way you claim it to work
        Last edited by Chosker; 08-06-2017, 05:20 AM.
        Follow me on Twitter!
        Developer of Elium - Prison Escape
        Local Image-Based Lighting for UE4

        Comment


          #49
          Originally posted by Deathrey View Post
          Lerps do not branch. They are only subjected to constant folding of alpha input, which you successfully demonstrated in your examples.

          You are making too many assumptions, for a sworn follower of scientific method. That leads you to misconceptions and wrong conclusions.

          Nope. The thread is about dynamic flow control and its importance for UE4. You are showing constant folding only up to this point, which was working flawlessly even without your intervention. Quit derailing yet another thread.
          Yeah, I found a round about way to make them work with branching... It's sort of sketchy, but it definitely works because I have many cases of it working now. The custom nodes seem to act as "blockers" that keep it all from getting folded statically. It was clearly demonstrated in one of the videos and you'd know if you were paying attention lol. It's also very evident the video at the bottom.

          Lots of experimenting, failing, retrying, succeeding, etc has gone into all of this, rather than just sitting there idly and proclaiming it doesn't work; like you've been doing. You have to learn to not be scared with failure, otherwise it will prevent you from trying to succeed.

          Originally posted by Chosker View Post
          redundant stuff
          And yeah, I'm showing that it can be done with MINIMAL hlsl. It's not super hard to write out five or ten lines of code and it's definitely worth it if it's going to save you a ton of frame time. Would it be nice to be able to do it with 100% pure UE nodes? Absolutely... But there are workarounds for now, so quit complaining and use them.

          Here is a clip of an upcoming series that I'm going to work on, when I've got the time, talking about this whole topic. It has two completely identical materials with a few changes. One has regular IFs for masking and the other has custom IFs. I'm using the radial blur MF for the "complex" effect, but I had to refactor it for the branched version because it doesn't handle nested loops with variable loop counts. It will spit all kinds of errors about uncoiling and such. I had to change it from a texture2dsample to a tex.samplegrad and feed it derivatives. Not really a big deal, but it allows it to branch now. If anything, that would probably make it slightly less performant, but it's negligible compared to the frame-rate benefit. Anyways, it has a few effects right now, but I'm adding in more and will eventually work it up to even handle blending landscape materials. Right now, it's mostly just a a range cutoff, dot product, expensive blur on the dot product and a regular version of the material. It's a technical material.

          Last edited by IronicParadox; 08-06-2017, 09:27 AM.

          Comment


            #50
            bump.

            what ever happened to this? UE-33876 is gone...
            Follow me on Twitter!
            Developer of Elium - Prison Escape
            Local Image-Based Lighting for UE4

            Comment


              #51
              Bump.
              What happened to https://issues.unrealengine.com/issue/UE-33876 ?

              Comment


                #52
                Originally posted by Speuzer View Post
                Got removed from issue tracker for being feature request, not a bug.

                Comment


                  #53
                  Bump for justice

                  Comment


                    #54
                    If there was a way to just a simple way to have a threshold-ed lerp branch Material layers (a dither would be nice, but on/off would at last work) , it would be amazing and useful for so many cases

                    Comment


                      #55
                      This is still sorely needed, and doesn't ever seem to have been given any attention. It's nearly impossible to recreate most modern AAA landscape rendering techniques without this functionality.

                      Comment

                      Working...
                      X