Announcement

Collapse
No announcement yet.

a 'variable' node in the material editor

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

    [FEATURE REQUEST] a 'variable' node in the material editor

    One thing that is difficult when working with complex materials is the maze of connection between nodes.

    Last time I had some group of nodes calculating a uv coordinate with some offset, and I used the results as input in several other nodes further on in the material. This gave me quite a maze of connections, and I couldn't find a way to make it look less complex...

    To me it would seem easier if I could store this result in a variable, and reuse it in other parts of the material. I've attached images explaining what I mean.

    You could also look at it like 'wireless connections' between node, based on a variable name. Obviously for each variable name, only one node can 'set' it, while multiple nodes can 'get' it.

    I hope I make my idea clear and that other people understand why this would make materials cleaner.

    So instead of this:
    Click image for larger version

Name:	variablenode1.png
Views:	1
Size:	31.4 KB
ID:	1164775

    I'd like to do this:
    Click image for larger version

Name:	variablenode2.png
Views:	1
Size:	32.7 KB
ID:	1164776

    #2
    A way of organizing complex material setups is using functions.
    Your "rest of the rather complex material" would be a simple node in the material graph with inputs as needed.

    Comment


      #3
      + One Million!

      Alternatively, you might be able to use a material parameter collection, but that would not be the most elegant for this specific use.
      Map Generator 1.0
      Map Generator 2.0
      Map Generator 3.0

      Comment


        #4
        KVogler, someone one the answerhub also gave this answer, but this is not exactly the same. Functions are for reusing functionality, but I want to reuse results of computations somewhere else in the same material. If I would reuse functionality, it would recalculate the whole thing over again several times, which is not what I want. On top of that, the material function would still require several inputs, which is also not helping me at all with the messyness. The situation is that I have some output, and it needs to function as input for several other nodes somewhere else. I would like to be able to do this without dragging a connection between all those nodes.

        In my example. I calculate several things:
        -a corrected UV coordinate for the current pixel
        -a corrected UV coordinate for the center of the effect I want to add
        -the sin of the clamped distance between the current pixel and the center of the effect.
        -And several other more

        the effect I'm making in the material has several aspects to it. For each aspect, I need a certain subset of the results of the above calculations. This is getting messy. Ofcourse I could place a collection of nodes in a material function, but if I reuse it in several places, it would redo the calculations several times, which is not neccesary. Also these material functions would still require several inputs from UV coordinates and material parameters. I would end up making even more complex connections between nodes, because now on each place I need them, I need to connect SEVERAL inputs to it, would be even worse.
        Last edited by BramV; 10-11-2015, 12:33 PM.

        Comment


          #5
          Why has something like this not been done yet. Imagine how much easier it would be to create complex materials with a feature like this. Epic, you guys reading this?

          Comment


            #6
            I Still want this feature. Comparing to the similar graph editor in Substance, Unreal's sucks

            Comment


              #7
              This would be nice. A local variable essentially (which it probably becomes when it's compiled anyway). We implemented something like this in the UE3 material editor at the last place I worked.
              Dev Blog
              Twitter: @TheRealSpoonDog
              150 FREE Blueprint functions for your project

              Comment


                #8
                Not to rain on anyone's parade but aren't you guys just describing material functions?
                [Submitted] Advanced Data Validation

                Comment


                  #9
                  +1, this would be really useful to keep things tidy in complex material setups, specially in places where you calculate/process one thing and then plug it in multiple places (i.e. a mask used in color/roughness/spec, etc)



                  Originally posted by DamirH View Post
                  Not to rain on anyone's parade but aren't you guys just describing material functions?
                  read the entire thread
                  Follow me on Twitter!
                  Developer of Elium - Prison Escape

                  Comment


                    #10
                    Originally posted by Chosker View Post
                    +1, this would be really useful to keep things tidy in complex material setups, specially in places where you calculate/process one thing and then plug it in multiple places (i.e. a mask used in color/roughness/spec, etc)




                    read the entire thread
                    Fair enough, my bad. That being said, I wouldn't be surprised if the compiler actually optimized this automatically, but I could of course be wrong.
                    [Submitted] Advanced Data Validation

                    Comment


                      #11
                      For some reason I fail to see how what OP describes is different from material functions.

                      Comment


                        #12
                        Originally posted by Deathrey View Post
                        For some reason I fail to see how what OP describes is different from material functions.
                        It is completely different to material functions. A material function recalculates every time. A local variable could be used to store this result and reuse it multiple times without recalculating.

                        Comment


                          #13
                          Originally posted by wilberolive View Post
                          It is completely different to material functions. A material function recalculates every time. A local variable could be used to store this result and reuse it multiple times without recalculating.
                          Nope.
                          What is described in the thread offers no benefit of over existing material editor functionality.

                          Whenever you slap 20 nodes of same material function and wire them to keep the graph clean, or place one material function and send over spaghetti net to 20 pins, it makes no difference.
                          If you are concerned about duplicate HLSL code being generated by material translator, you should not worry about it. It is handled by fxc/hlslcc.


                          Comment


                            #14
                            As someone coming from unity while daily using shaderforge, I miss this feature... set and get nodes kept things so clean. I hate the fact that I have so many noodles overlapping eachother.

                            Comment


                              #15
                              Just realized I duplicated this request!
                              Deleting my post and adding my examples here.
                              Amplify Shader editor for Unity does this, and it made my materials so, so much cleaner. Particularly anything with lots of math where a term needs to be computed once but reused in many places.
                              Attached Files

                              Comment

                              Working...
                              X