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 :

Or

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.

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/showthread.php?6855-Hair-Rendering-Simulation-test
Maybe publish this.

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 !

I think he means something like this: ?v=_i0wIuetWec It’s a tutorial about hair creation for UDK :slight_smile:

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 ?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)

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/view/XdlXz4#
https://www.shadertoy/view/Xd23WV
https://www.shadertoy/view/XsfSR8

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. ://www.nvidia/content/PDF/GDC2011/GDC2011EpicNVIDIAComposite.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 :wink:

Hi again,

I was trying to convert the shadercode from this page https://www.shadertoy/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.

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’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/latest/INT/Engine/Rendering/Materials/Functions/Overview/index.html
https://docs.unrealengine/latest/INT/Engine/Rendering/Materials/ExpressionReference/Custom/index.html

Good luck, have fun.

As stated by kylawl, you can write custom code in the Material Editor using the Custom Node

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/latest/INT/Programming/Rendering/ShaderDevelopment/index.html

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

, 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.

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 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

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 :" ://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!

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.

Since there seems to be a growing demand for this type of effect, I will devote some time this weekend to putting together a sample (Either using just the material editor, or a full blown ). I have already adpated a Hair Simulator (Based on AMD’s TressFX) into UE4 but that is a much more heavy weight effect. If I have any progress I will let everyone know.

Glad to hear it!

This 'lil fella is in desperate need of a fur solution!

Bqqk05ECYAAEUk0.png

Hi everyone again, i’m back from a busy job and ready to continue my games.

, i wanted to know if you did make your tutorial/samples for making our own shader inside unreal engine ?

Thanks

Hi guys, I’m working in fur stuff too using UE4 through shells and fins approach. But I have problem with multipass shader and bump offset when I used material editor. Do you guys any suggestion?

Ah, fur. Just so you guys know, this is one of the most complicated shaders you could ever make… ever. Very few games use fins and shells because the overdraw is so great. You need a lot of geometry to make the effect look convincing, and you also need a ton of shell layers: way more than what would make a convincing parallax occluded material, because you need to connect very small, fine points. This effect looked very convincing on consoles like the Gamecube and PS2 which had low screen resolutions and large parallel pixel shaders, but it is significantly more difficult to make the effect look convincing on higher resolution screens. You will waste your entire pixel rendering budget on making those shells. You might as well forget this as a mobile feature. There are other methods, however, to handle hair, fur, and generally soft bodies.

Alpha cards render extremely well. You get the flexibility of full-scale materials with the artist-defined cutout of the hair cards. Unfortunately, UE4’s transparent rendering is not compatible with the deferred lighting shader, so you will need to use cubemaps in the material itself to simulate transparent lighting. If you can find a way to blur the cubemap for a softer reflection, let me know, because I would love to know how to do this! If you use a sharp mask you can get access to deferred lighting and the roughness settings in the material, but you’ll need a higher texture resolution to ensure you don’t have floating hair. Also, good luck getting the cards to stay where they need to be with rigging. If you can pull it off, it will cost a lot of vertices and there will be overdraw, but not nearly as much as shells and fins. The end result is not perfect, but the best in a realtime CG environment.

The next method is to use fuzzy shading: a simple fresnel-based algorithm that generates a soft light outline around the edge of the model’s falloff, simulating the effect of hair catching light off the model’s surface. It’s generally good for velvet materials, but you can’t get individual hairs using this method.

Real video games nowadays like Super Smash Bros. 4 use a combination of the above two methods to simulate fur on characters like Fox and Donkey Kong. Rarely will games make the jump to full-blown fur shading due to its complexity and expense. Donkey Kong: Tropical Freeze actually uses fins and shells, and older games like Kinectimals also used it, and the effect is largely successful. But once again, this is definitely not a mobile-ready feature. If you choose to use it, it will be just as expensive as rendering a AAA-quality ocean shader layered over the ground underneath, and if you don’t maintain some control the camera, it will easily fill the entire screen, causing massive and erratic rate drops over your entire project as the pixel and vertex shaders try to pump out a complex multi-layered transparency shader. If you can pull it off, please let us know how you managed, because a practical solution for this will be a Godsend. I would totally pay for it if it was on the Marketplace.