Announcement

Collapse
No announcement yet.

Fur Shader

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

    Fur Shader

    Hello everyone,

    I'm develloping a game that involve a lot of animals and i would like to reproduce the effect of fur on this image :

    Click image for larger version

Name:	alvin-and-the-chipmunks-chipwrecked-xbox-360-1321563122-008.jpg
Views:	1
Size:	90.5 KB
ID:	1135292

    Or

    Click image for larger version

Name:	FaceRig-alpha-stage-03.jpg
Views:	1
Size:	146.2 KB
ID:	1135293

    I know these are not real fur but it kinda the effect i would like the get.
    I have no idea on how they are doing that, is that a kind of pixelshader that involve a blur on the edge of the object or a vertex shader that create a more big version of the model + transparence ?


    Thanks in advance for the help.

    megatlantis.

    #2
    For the first image you can use mesh planes with translucent material.

    The second image use a BumpOffset shader. You can found a Material Sample in the "Realistic Rendering" from Marketplace.

    A other way is, to use a Interior Material with translucent or alpha maps. Stefander make one.

    Or you wait for this:
    https://forums.unrealengine.com/show...imulation-test
    Maybe Ehamloptiran publish this.
    Last edited by Ulrich.Thümmler; 06-08-2014, 08:14 PM.
    reference
    http://dirty-windows.de

    my blog
    http://ulrichthuemmler.blogspot.com/

    Comment


      #3
      Hi Ulrick, thanks for the advice.

      I didn't really understand what you mean by mesh plane with translucent material, can you explain me more in depth how can i make the fur effect in the first image please ?

      I would be really thankfull for that !

      Comment


        #4
        I think he means something like this: https://www.youtube.com/watch?v=_i0wIuetWec It's a tutorial about hair creation for UDK

        Comment


          #5
          I'm not sure the exact technique being used in the first image, but the second image is almost certainly the tried and true shell and fin technique. I don't think you can do that in UE4 with just a shader. You need to perform many passes over the mesh in order to shell it.

          Check out this video for an example https://www.youtube.com/watch?v=XTHyajWCAVk.

          I've implemented this before, it's not too tough. You'll likely need to pull it off in c++, I doubt this level of mesh control is exposed to Blueprints (I have not checked though so you never know)
          @kylerocha
          Luminawesome Games
          http://luminawesome.com/

          Comment


            #6
            Thanks for the help all, i'm not enough skilled for make a shader from c++ now, so i will maybe work on this later.

            also, I have found some nice fur shader that can maybe help other one :

            https://www.shadertoy.com/view/XdlXz4#
            https://www.shadertoy.com/view/Xd23WV
            https://www.shadertoy.com/view/XsfSR8

            Comment


              #7
              Take a look at the Samaritan demo slides. They have some good stuff there regarding hair which can be used as fur in your case. http://www.nvidia.com/content/PDF/GD...AComposite.pdf You can use the spline thicken material function instead of the shader code provided in the slides. Alternatively if you wanted to use the shader code, just enlarge the slide
              Portfolio: www.rishipatkar.com

              Comment


                #8
                Hi again,

                I was trying to convert the shadercode from this page https://www.shadertoy.com/view/XsfSR8 to a node based version, but we cannot do any kind of 'while/for/do' using that (or eventually copy/paste the material function hundred time, which is a pretty bad idea)

                So i was looking into converting the code into HLSL since it the ue4's language code for shader, i wanted to know once i have my furshader.usf ready, what do i actually have to do for compile it and use it inside my game ? I looked inside the Graphics Programming guide but didn't really understand what should I do with my file and it look like really few people are asking this kind of question on google, I have read vagely that i have to recompile the engine source ?

                Thanks for help.

                Comment


                  #9
                  Thanks for the help all, i'm not enough skilled for make a shader from c++ now, so i will maybe work on this later.

                  also, I have found some nice fur shader that can maybe help other one :

                  https://www.shadertoy.com/view/XdlXz4#
                  https://www.shadertoy.com/view/Xd23WV
                  https://www.shadertoy.com/view/XsfSR8
                  I'm afraid anything you find on shader toy is going to be problematic. Believe it or not, all of these fur shaders are basically postprocess effects, there is nothing there but 2 triangles. The shapes you're seeing are produced through some very cool shader math. In principal, the technique is quite similar to the fin and shell method I posted earlier. Only as I said they fake the presence of the "geometry" so It will be interesting to see what happens if you apply it to an actual 3d model.

                  I was trying to convert the shadercode from this page https://www.shadertoy.com/view/XsfSR8 to a node based version, but we cannot do any kind of 'while/for/do' using that (or eventually copy/paste the material function hundred time, which is a pretty bad idea)

                  So i was looking into converting the code into HLSL since it the ue4's language code for shader, i wanted to know once i have my furshader.usf ready, what do i actually have to do for compile it and use it inside my game ? I looked inside the Graphics Programming guide but didn't really understand what should I do with my file and it look like really few people are asking this kind of question on google, I have read vagely that i have to recompile the engine source?
                  I've yet to add a new coded node to the material editor, however you can write functions using the material editor. Check out these 2 doc pages.
                  https://docs.unrealengine.com/latest...iew/index.html
                  https://docs.unrealengine.com/latest...tom/index.html

                  Good luck, have fun.
                  @kylerocha
                  Luminawesome Games
                  http://luminawesome.com/

                  Comment


                    #10
                    Originally posted by megatlantis View Post
                    I was trying to convert the shadercode from this page https://www.shadertoy.com/view/XsfSR8 to a node based version, but we cannot do any kind of 'while/for/do' using that (or eventually copy/paste the material function hundred time, which is a pretty bad idea)
                    As stated by kylawl, you can write custom code in the Material Editor using the Custom Node

                    Originally posted by megatlantis View Post
                    So i was looking into converting the code into HLSL since it the ue4's language code for shader, i wanted to know once i have my furshader.usf ready, what do i actually have to do for compile it and use it inside my game ? I looked inside the Graphics Programming guide but didn't really understand what should I do with my file and it look like really few people are asking this kind of question on google, I have read vagely that i have to recompile the engine source ?
                    If you really do want to go down this path, you have two choices.

                    1. Create a new Vertex Factory type, which means you would write your usf based on something like LocalVertexFactory.usf.

                    2. Create your FurShader.usf then in C++ create your Vertex Shader/Pixel Shader/etc. based on FGlobalShader then implement a custom Drawing Policy to draw your mesh using the aformentioned shader.

                    For further information take a look at: https://docs.unrealengine.com/latest...ent/index.html
                    FluidSurface Plugin: https://github.com/Ehamloptiran/UnrealEngine/releases
                    TextureMovie Plugin: https://github.com/Ehamloptiran/TextureMoviePlugin

                    Comment


                      #11
                      Hey, thanks again for all your answer.

                      after trying to convert a lot of different fur shader on multiple differente sources, using the material node editor simply can't do the trick, even using the custom node. or maybe i'm just too bad for use them correctly.

                      I used UNITY 3D before switch to ue4 so i'm also not really confortable with c++.
                      You can write easily new shader in unity, simply create a new shaderlab file and then assign that shader to material, not a big deal.
                      Now in ue4, writing custom shader seem to be really tricky, and the lack of tutorial about that is really not in my favor.

                      I have read the 2 documents page about graphical programming again and again, but i still don't understand anything

                      Ehamloptiran, you seem to really know what to do for write custom shader, could you explain me in a step-by-step way how could create my furshader.usf file and then using it on one of my mesh in the editor ? I would be so thankfull for helping me doing that, my game really count a lot on that shell-based fur effect.

                      Comment


                        #12
                        I used UNITY 3D before switch to ue4 so i'm also not really confortable with c++.
                        You can write easily new shader in unity, simply create a new shaderlab file and then assign that shader to material, not a big deal.
                        Now in ue4, writing custom shader seem to be really tricky, and the lack of tutorial about that is really not in my favor
                        The trick here is that in Unity, you MUST program all materials by hand. That means the common stuff that everyone needs to do like colour tinting based on a mask or some vertex colour or a simple panning texture generally requires a programmer or a tech artist. Their pipeline makes it easy because that is the only way to do it unless you buy a plugin like Shader Forge.

                        UE on the other hand allows for the more common scenarios (and even many of the not common at all ones) and removes an entire person from the development of that content in almost every case. The overhead to adding a brand new material type or shader node is a little greater but almost all the time you don't need to anyway.

                        My advice would be to try and get it working with the material editor first. Get it working and understand the problem there, it might be ugly under the hood but thats not your primary concern.

                        / Kyle
                        @kylerocha
                        Luminawesome Games
                        http://luminawesome.com/

                        Comment


                          #13
                          Originally posted by kylawl View Post
                          My advice would be to try and get it working with the material editor first. Get it working and understand the problem there, it might be ugly under the hood but thats not your primary concern.

                          / Kyle
                          I'm bouncing betwen 2 solution ...
                          well, admitting that fur shader could be done using material node,

                          i'm not certainly sure about how convert an hlsl code like on this page :" http://www.xbdev.net/directx3dx/specialX/Fur/ " to a node version, this code use a a vertex shader and fragment shader, and the c++ code call this shader multiple time.

                          how can i get the code in the above link to work using node ? since i cannot call the material multiple time per frame and passing different variable in each pass.

                          Comment


                            #14
                            Originally posted by megatlantis View Post
                            I'm bouncing betwen 2 solution ...
                            well, admitting that fur shader could be done using material node,

                            i'm not certainly sure about how convert an hlsl code like on this page :" http://www.xbdev.net/directx3dx/specialX/Fur/ " to a node version, this code use a a vertex shader and fragment shader, and the c++ code call this shader multiple time.

                            how can i get the code in the above link to work using node ? since i cannot call the material multiple time per frame and passing different variable in each pass.
                            Hey awesome, that link is a more complete example of implementing the nvidia paper I sent earlier.

                            As far as running the material multiple times you you're right, you can't. However I though you were going to start by leaning how the shader toy version works which is pixel shader only. If you're going to take on the real deal, make sure you post screen shots as you go!
                            @kylerocha
                            Luminawesome Games
                            http://luminawesome.com/

                            Comment


                              #15
                              I'm currently creating a kid's game in which the main character is a plush monkey with fur like THIS

                              I feel your pain...

                              I've been researching the Fin and Shell technique for a while but cannot find any actual tutorials on it. I'm hoping I can find an artist friendly way to achieve this.

                              Comment

                              Working...
                              X