Announcement

Collapse
No announcement yet.

Is your scene too clean? Here's my tesselated "Dust Layer" material function for you all!

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

    [ASSETS] Is your scene too clean? Here's my tesselated "Dust Layer" material function for you all!

    EDIT 06/02/2018: Updated the links to the downloadable files throughout: DustLayerProject_4.8.2.zip & DustLayerProject_DIYfiles.zip

    As requested, here is my Dust Layer Material Function (+ a simple Material Parameter Collection). I have also posted this to the UE4 reddit HERE. This is my first public offering, so please be kind Seriously though, all feedback (and your optimisations!) would be greatly appreciated….

    … One of my biggest issues with Unreal is how "clean" everything is, particularly when trying to recreate anything old/abandoned. I have been working on a tesselated dust Material Function that is starting to look quite effective. In the before and after screenshots (in-editor) below I have added the material function to most of the materials in the scene (note how it only affects upward surfaces) - it's a scene of an old storeroom that hasn't been opened for 20-30 years:





    Currently my function is quite over-complicated, as I was experimenting and wanted to make it highly-customisable so it would work with a variety of my master materials. As an example, I don’t think I have used the output modifiers yet in my whole scene, and the “Pass-through” at the end was a last-minute hack. So please consider this an alpha version, as I intend to greatly simplify the entire function soon. There are a few other features I want to include as well, such as combining the two vertex-paintable scuff and scratch layers so that I can use the extra channel for a “debris build-up” channel that I can paint into the scene edges and corners (4.9’s proposed ambient-occlusion query may be useful for this too, thanks /r/muchcharles).


    ------------------------------------------------------------
    INSTALL:
    Either extract the files in the pack available for DOWNLOAD HERE into your project’s Content folder (4.8.2!), or follow the additional instructions below to re-create it yourself in your own project.

    Import the texture file from the DIY file pack HERE into your project then, in each material in your scene, paste the function call/variables and vertex-painting section into your graph, and then intercede the switches right before the final material input node as shown below. For your convenience, this file pack also contains plaintext dumps of my clipboard for each of the paste procedures outlined below (just copy the text file contents and paste into your pre-prepared material graph). Be sure to set the variable defaults as shown (for now):


    (full-sized image is within the DIY file pack)

    Make a new material function, and re-create the example shown below, again being sure to set the defaults (but for the BaseMat and BaseNormal defaults, just use something of your own):


    (full-sized image is within the DIY file pack)

    Make a simple Material Parameter Collection with a single scalar variable called “DustAmount”, with a value of 1.

    Then enable the dust layer in your material by setting the class defaults to something like shown below (plus enable vertex painting, if you wish):




    USAGE:
    Get a good starting coverage of dust on your individual materials and meshes first by adjusting the “Dusty_AmountModifier” and “Dusty_AmountToStartTesselationAt”. I had the best results making the latter value about 0.05 less than the former.

    The dust distribution can then be fine-tuned up or down by vertex painting in-editor into the red channel (add with L.click, reduce with Shift_L.click). Using low values of 0.1 for strength and flow in the vertex painting tool gave me the most fine control, and allows for painting in high-traffic areas and door scuffs, etc.. Hint: have enough vertices on your meshes!


    (note the removal of the dust where the door swings in)

    Scratches & scuffs in the dust layer can be vertex-painted in using the green and blue channels (higher strength and flow values are better for this).

    Adjusting the “DustAmount” value in your Material Parameter Collection will let you fine-tune the dust over your whole scene (or even adjust it at runtime). Setting the value to zero (edit: ?a small negative value is better) will bypass the function entirely so that the dust can be turned on and off at any time.


    ------------------------------------------------------------
    That’s it – have fun, and be sure to let me know how it goes in your own project! I’ll be fairly busy over the next week, but I should have some time most days to help with any queries you may have.

    Thanks, Jeff.


    Edit1: it’s probably fairly obvious to many of you, but the core of my function is based on Liaret’s pioneering “tessellated snow” material from the wiki – thanks, Liaret(Lordink)!
    Edit2: direct download links:
    Project files for 4.8.2
    DIY file pack (includes the full-sized screenshots & paste dumps!)
    Edit3: yes, it should be "tessellated" in the title, but I am sure you will get over it
    Edit4: added the material settings example screenshot
    Attached Files
    Last edited by Dr.Jeff; 02-05-2018, 10:46 AM.

    #2
    That is pretty cool looking and brings the scene into... OMG SO MANY WIRES! :P
    This really is cool though. Does the tessellation have any hit on the FPS?

    Comment


      #3
      Originally posted by _cDub View Post
      That is pretty cool looking and brings the scene into... OMG SO MANY WIRES! :P
      This really is cool though. Does the tessellation have any hit on the FPS?
      Yeh, I was perhaps understating it when I said it was "quite over-complicated" I'll be putting up an optimised version with a simpler material function call sometime soon.

      Regarding the FPS, I only lose ~1 FPS when the dust layer is enabled across the whole scene (I set up a simple keypress function that toggles the MPC DustAmount from -0.1 to 1 in-game). I have fairly old PC running a 770 though, so anything above that will probably not even notice the hit.
      Last edited by Dr.Jeff; 07-26-2015, 12:28 AM.

      Comment


        #4
        OMG spaghettiwar.
        Ty very much for that very nice stuff.
        My small game on IndieDB ****** Beams on Twitter ****** Beams on Steam ****** VideoStuff ****** PictureStuff
        UE brings Math back into my life or i am not sure.

        Comment


          #5
          Looks good mate.

          Comment


            #6
            Excellent work, thanks very much for sharing!

            Comment


              #7
              Great stuff!
              I really like that you give user possibility to decide where he wants the dust to concentrate and where not. Having dust where it shouldn't appear is as bad as not having dust at all. What bothers me though is uniform distribution of dust across the surface. Typically most of dust particles accumulate in corners and less on plain surfaces. Not sure about technical feasibility of fixing that in surface shader but maybe distance field nodes coming in 4.9 will let you improve that.

              Cheers!
              Tutorials: Pseudo realistic sand accumulation material | Creating outline effect around objects
              Links: Github | Twitter

              Comment


                #8
                Originally posted by EF View Post
                Great stuff!
                I really like that you give user possibility to decide where he wants the dust to concentrate and where not. Having dust where it shouldn't appear is as bad as not having dust at all. What bothers me though is uniform distribution of dust across the surface. Typically most of dust particles accumulate in corners and less on plain surfaces. Not sure about technical feasibility of fixing that in surface shader but maybe distance field nodes coming in 4.9 will let you improve that.

                Cheers!
                The look I was going for in this scene is that of a room that has not been opened for 30 years. What you want with the dust accumulating in the edges/corners is exactly what I wanted as well, and if you use vertex-painting then this is easily achievable with my shader. If you look at the floor in my screenshots, you can see that the dust on my floor is lighter in the middle of the floor and heavier in the corners - it is just that I wanted some dust covering the whole floor as well for this particular scene. It is easy to entirely remove the dust from the traffic areas if you wish (look at the screenshot where I removed the dust where the door opens).

                For realism, the dust covering your scene should be naturally lighter away from the edges, but you also should think about the prevailing air currents: dust will be extra-light under any open vents/windows/gaps as well as in any high-traffic areas. If you have tried my function in your own scene without being able to achieve this look, one thing to be sure of is that you have added enough vertices to your floor mesh! I had to add extra vertices to my original simple box floor mesh (8 vertices), and ended up putting a vertex about every 15cm in my mesh (they have about 1000 vertices now). With enough vertices and a deft touch with the vertex-painter, you can get very fine control over the distribution.

                It shouldn't be too hard to cut in some real-time footprints as well, but I am not planning on adding this features for some time yet. And yes, when 4.9 drops I will explore the possibility of using the new ambient-occulsion query to do some of the corner distribution automatically.

                Good luck with it!
                Last edited by Dr.Jeff; 07-26-2015, 11:43 PM.

                Comment


                  #9
                  Is fantastic, watch out with the wires ones may get shock on it I hope some day UE simplifies the way we have to create materials...Is sometime crazy all the wire to get a FX like this to me is ridiculous I can have the same effect in Max or Maya with way less parameters...

                  Comment


                    #10
                    Originally posted by risc View Post
                    Is fantastic, watch out with the wires ones may get shock on it I hope some day UE simplifies the way we have to create materials...Is sometime crazy all the wire to get a FX like this to me is ridiculous I can have the same effect in Max or Maya with way less parameters...
                    Agreed. Even some reroute nodes for the material editor would help enormously. It has such a powerful effect on my scene though, that I consider the spaghetti effect well worth it for now

                    Comment


                      #11
                      Originally posted by Dr.Jeff View Post
                      .. It has such a powerful effect on my scene though, that I consider the spaghetti effect well worth it for now
                      Not only at yours i bet, and yes it is worth it, for sure.
                      How long you need to create and setup things like that?
                      Originally posted by Dr.Jeff View Post
                      .. Hint: have enough vertices on your meshes!
                      Thats the only backdraw for me.
                      Last edited by Luftbauch; 07-27-2015, 03:22 AM.
                      My small game on IndieDB ****** Beams on Twitter ****** Beams on Steam ****** VideoStuff ****** PictureStuff
                      UE brings Math back into my life or i am not sure.

                      Comment


                        #12
                        Cant get this to work in 4.11 please fix before 4.12 comes out

                        Comment


                          #13
                          Can someone please make a video or something on how to make it work?, i am trying already for 2 hours to make it work and i cant seem to even get close to it

                          Comment


                            #14
                            It's good, but it seems hard to understand

                            Comment


                              #15
                              I know this is old, but the download link seems to be broken. Can someone reupload this? Looks really cool

                              Comment

                              Working...
                              X