Search Unity

Imperial Fur - PBR Fur Shaders!

Discussion in 'Assets and Asset Store' started by HemiMG, Mar 15, 2015.

  1. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911

    Hi everyone. I am very pleased to announce Imperial Fur, my latest asset. I needed a fur shader, and the one I was looking at in the asset store apparently doesn't work with Unity 5. That created a perfect opportunity for me to create a set of shaders that takes full advantage of everything Unity 5 has to offer.



    The screen above shows the included demo scene with several furred spheres. Imperial Fur has a few features that I think really set it apart from the competition. The first being the option to use PBR surface shaders as can be seen in the shot above, and most noticeable in the metal bristles.



    Here you can see the furred objects reacting realistically to the physics in the game. Not only can they react to RigidBody velocities, but the included script can also be set to calculate the velocities on its own for those cases where you may not have a rigid body attached to your object. A simple wind effect is also included in the script. Although, full disclosure, the wind doesn't seem to work all that well on the grass shown below.



    The alpha channel of the fur texture doubles as a height map so you can create some interesting effects. Shown here is grass on a dirt plane, but it could also be useful for creating a nicer fade in areas where there is no fur, such as a face.

    You'll also notice that it has an optional extra texture for the skin. The grass demo does a good job of showing how great that can be, as the dirt shows through the grass in areas where other fur shaders wouldn't allow without creating a separate object.



    If you choose to add a skin texture, you can use the alpha channel of that map to further control the opacity of the fur. Here is a pretty extreme example turning leopard spots into a peach fuzzy sort of look. But even at less extreme settings, a fair amount of opacity really helps the underlying skin to show through the gaps as the fur moves back and forth.

    There is an option to add rim lighting for that halo effect that fur and hair can have. It can be set to use a custom color for a more prominent effect, or the ambient lighting color for something more subtle.

    Like the Unity Standard Shader, it doesn't use any texture slots that you don't assign to, so having the metallic/specular maps and normal map slots have no effect on performance. You can choose between the standard metal style PBR, the specular style PBR, or a simple Blinn shader.

    Also included is a set of simplified shaders that will improve performance if the PBR or surface based shaders are not needed. Those shaders still use standard surface shaders for the skin, but the expensive task of drawing the multiple shells on top are done with simplified vertex/fragment shaders. The simplified shaders also allow you to choose between metal, specular, and Blinn style shaders for the skin. There is also a no skin option for those. That option still uses a Blinn surface shader for the skin, but will do it with the material assigned to the fur. Because the skin and shells are rendered differently in the simplified shader, I needed to separate out the options.

    The simple shaders have an option to add a cube map reflection so you can help them to fit in a little better with the rest of your scene. The cube map can be set to HDR or LDR so it works fine with whatever reflection probe you may be using.

    The standard shaders come with 10 and 20 shell variants, with 40 shell variants zipped up in the package. Import and compile times are pretty resource intensive on the standard shader and my old iMac didn't like the 40 shell versions too much. So I wanted people to have the option of whether to import those or not. The simple shaders have 10, 20, and 40 shell versions available right out of the package. The demo uses the 20 shell variant for both shader examples.

    There are also two different methods for intra-fur shadowing that you can pick from. One will just make the fur shells at lower levels darker. The other shifts the UV texture over a pixel, grabs that color and converts it to grayscale based on the depth to get a shadow value. For some textures, the second method can look a little better. But I've found that a lot of time it isn't worth whatever minimal performance impact it may have so I provide the option. You can adjust the strength of the shadowing to your liking in both methods.

    I've submitted it to the Asset Store, so hopefully it will be available there soon. I'll update the thread when it is. Until then, you can purchase it or check out the web player demo on my website:

    Web Player Demo
    This is the demo of Version 2.0, which has not yet been approved on the Asset Store.
     
    Last edited: Apr 30, 2015
    I am da bawss and punk like this.
  2. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    That looks like a very nice system. I tried the demo though and I am not seeing any fur, tried both shader types, just getting textured balls, is there a key press or something to turn it on?
     
  3. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    no fur here either
     
  4. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Hmm. That's strange. I was thinking maybe something went wrong with the upload, but I just checked it on the website and it works fine on my end. Is anyone else having that problem? Are you using Unity 5? I don't know if Unity upgrades the web player when you upgrade the program itself, or it that would make a difference at all. But there should definitely be fur on the balls without having to do anything.
     
  5. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Well crap, that answers the question about whether it is happening to anyone else. Are you guys using Windows? I wonder if maybe it is a problem with DirectX vs OpenGL. I'm not sure what that problem would be, but at least it'd be some place for me to start looking for a solution.
     
  6. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    I'm using latest firefox web browser on windows 7 64 with latest version of unity web browser.
     
  7. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Same here, I was thinking the same that we are using an old version of the webplayer. I guess.
     
  8. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Well there goes the high I got from finally finishing and releasing it. It works for me on Firefox as well. I guess maybe it is a Windows problem? Can someone with a Mac confirm whether it works or not? I just can't imagine any other reason why it would work on my end, but not for other people. But I'm not using any GLSL code, so I don't know why it would be OpenGL specific.
     
  9. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Unity usually throws a warning when something isn't DirectX compatible. To double check I rewrote one of the shaders so that everything was inlined instead of calling a cginc, in case cginc files for some reason don't generate the warnings, but I still got nothing indicating that anything would prevent it from working with DirectX (assuming DirectX is the problem)

    I've asked in the Shaders forum about anything else I might have to look out for, so hopefully I'll have a fix soon.
     
  10. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I was able to fix it by building a Windows standalone build so the errors and warnings would spit out. Luckily, it runs in Crossover so I was able to confirm both the problem and the fix. Can someone check the web player to make sure everything is updated and fixed properly, just so I can be double sure before re-uploading the package? And thanks for letting me know about the problem. I would have hated to have had the asset rejected after a week of waiting!
     
  11. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    It's working on my side :) (Windows 7 64bits)
     
    HemiMG likes this.
  12. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Awesome. Thank you. I've sent the fresh build to the asset store team.
     
    cAyouMontreal likes this.
  13. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    yep fuzzy goodness all around...
     
    cAyouMontreal and HemiMG like this.
  14. timmerish

    timmerish

    Joined:
    Feb 6, 2014
    Posts:
    5
    Very nice, works well for me on OS X. Will it work on mobile? How about VR?
     
  15. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I haven't checked it on mobile. I'll give it a go when I get caught up on some work that I fell behind on while getting the shader written so my client doesn't kill me. I should have an answer for you before it is approved by the asset store team. I tried to push it to my old Droid Razr but apparently I need to update my JDK before Unity 5 can do that. I'd suspect that the simple shaders with the blinn skin should do alright on mobile though.

    Everything in the demo is done with the 20 shell versions of the shaders. They also come in 10 shell versions for better performance, so I'll give it a go with those as well. On the tiny screens of mobile there might not be a big difference in the appearance.

    The simple shaders have a 40 shell version that didn't seem to hurt performance too much. The standard shaders also have a 40 shell version, but I've zipped those in the unity package because my poor 5 year old iMac chokes on trying to compile them so I wanted people to have the option of whether or not to try.

    I just realized that I didn't mention any of this in the description so I'm going to go ahead and update that as well.

    I have no way of testing VR at the moment, sorry.

    Edit: I also didn't mention the options for intra-fur shadowing, so I've added that to the first post for anyone interested.
     
    Last edited: Mar 16, 2015
  16. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    @timmerish , sorry for the long delay in testing it on mobile. Unfortunately, I still can't provide my info. My old Droid Razr apparently doesn't like Unity 5 at all. Even the default scene with just a 6 polygon Cornell Box and two menu buttons is hovering around 13fps (and looking horrible in the process. I think I need to change something in the lighting for it to work on mobile).

    I've uploaded the APK here: http://www.imperialpenguin.com/fur/DemoAndroid.apk for anyone who has an Android device to have a go with it. I'll go ahead and give the other numbers just for some sort of comparison. With the standard (PBR) fur shaders, it dropped to around 3fps and stayed there. It didn't seem to make any difference how many of them were in the scene. The simple shaders did better, jumping as high as 11fps when only one or two of them are in the scene.

    Those numbers are with the 20 shell shaders. I guess it would perform better with the 10 shell versions, but with a 13fps max, my device just isn't suitable for testing that.

    The asset was rejected yesterday because I had a link to an external sales site on my demo page. I've fixed it to link to the asset store page (which doesn't exist yet) and emailed the asset store team to see if I need to resubmit the asset. So, depending on how long it takes them to respond and what they say, it could be a few days away or another week or two.
     
  17. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
  18. vedranskarica

    vedranskarica

    Joined:
    Apr 7, 2013
    Posts:
    7
    Tried the mobile demo on a Nexus 5 with 5.1, getting 15-20 fps on standard shaders, and 25-35 with simple shaders. Fur looks good on both variants, but that baked-in light on the background sure is horrible :)

    Any chance of getting a trial of the shader? Our current fur shader doesn't play well with Unity 5 and it's a pain setting up all the variants so it looks good in various light setups, which a PBR version would solve, but we'd need to play around with it a bit to do a direct comparison before putting down 30€ (tight budget :) )
     
  19. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Thanks for testing it on the Nexus. With less than 6 objects and the 10 shell simple shaders, I suppose it would do okay on higher end mobile devices. With a 13fps max on a near empty scene, my old Razr is clearly outside of the scope of Unity's system requirements. It's a pretty old phone though, well out of the contract expiration range where people usually upgrade. I'm moving away from mobile development so I haven't kept current on devices.

    Regarding your question about a demo, I'll PM you.
     
  20. cygnusfear

    cygnusfear

    Joined:
    Oct 24, 2012
    Posts:
    14
    Hi HemiMG,

    We've just purchased your asset as it's the only compatible fur shader for Unity 5; currently the shader multiplies the Skin Texture by _StrandThickness; I suppose this is not the intended behaviour as it will also tile the skin texture.

    Also it would be nice if the skin texture was used to color the fur and for the skin alpha to influence the fur length instead of just the opacity.

    Otherwise the shader seems to be working nicely :)

    Cheers,
    Alex
     
    Last edited: Mar 31, 2015
  21. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Thanks for the purchase! You are correct, it doesn't make sense for the skin texture to tile. I'm trying to think back to whether there is a legitimate reason for that, but it seems to just be an oversight. Right now I'm knee deep in work on my next asset. Of course, I'll take time off from that to fix Imperial Fur, but it might be a day or so until I get to it. I'm in the middle of completely rewriting some code, and things can go horribly wrong if I don't get it all fixed up while its fresh in my mind.

    Regarding the skin also coloring the fur, I'm not sure I understand the point of that. Wouldn't it defeat the purpose of having separate textures for the skin and fur if they did the same thing?
     
  22. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I just wanted to give everyone a heads up that the next version is going to change the way materials are authored a bit. I've separated the noise map from the height map so that you can adjust the strand thickness without also tilling your fur shape. This is really a much better way of doing things and allows for a greater variation in the effects you can create. There are several other changes that are going to be made. I'm experimenting with a few things, and if they work out then the height map might get pulled into a separate texture along with some other maps as well. Just keep this in mind so you don't export from your image editor without saving the layers you used to create the textures. I hope to have everything finished up in a week or so and get it submitted to the store.
     
  23. Scott-Curtin

    Scott-Curtin

    Joined:
    Mar 19, 2013
    Posts:
    14
    Am considering your shader to potentially solve an issue I've been having and was curious about some features that may be an interesting addition, if they're not already available.

    I need to assign a halo/glow/corona effect, of sorts, to some meshes and nothing available I've come across is quite right so far, as I'd like to maintain the effect scale as the camera moves around- I also need to be able to flip the effect in some cases to make the "glow" appear inwards on the models. Was curious if a facing ratio texture option would be possible?- so the "fur/glow" effect would be apparent more towards the perimeters... If possible as well, a slot for an animated distortion texture. I've tried some interesting experiments with particles, but the effect doesn't scale well and also washes out with my white background... Dunno- thought I'd ask- could be some interesting bonus features and possibly boost sales.

    Thanks for your time regardless, it looks really awesome and good luck with your revisions.
     
  24. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    looks interesting. sadly too computationally expensive for our plans.

    web demo: Standard Shader:
    upload_2015-4-17_1-45-21.png

    Simple Shader
    upload_2015-4-17_1-47-18.png

    nice nevertheless. Will be awesome in the right setting.
    Who doesn't love fur.? :D
     
  25. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Sorry for the delay in responding guys, I've been crazy busy.

    @Scott Curtin I'm not sure that's something I can get in there anytime soon. I've already made a massive amount of changes to the shaders. I'll go over all of them when it is finalized, but I think the material authoring changes are going to annoy people and I feel really bad about that. They are for the better though, and will result in much higher quality looking fur and far greater control over it.

    @twobob There are some optimizations coming in the next version, although I'm not sure they'll help too much if you need 10 furred objects on screen at full quality like they are in the demo. It will now dump out of the shader early if the alpha is zero. For scenes like the demo where there are a lot of blank patches in the fur, it speeds it up a bit. The other improvement is an LOD system that will let you transition from a max of 40 shells (or less) up close all the way down to 1 shell really far away. I'm still working on the shader so I haven't created a test scene for that yet to really see what a difference it can make. I did test it in the cornell box to make sure it works, but the box is so small that going from 40-20-10-5-2-1 shells in the length of it just looks ridiculous. It should be a huge help for larger scenes where anything but the main character is furred though. I'll try to remember to let people choose the number of shells for the shader in the next version as well. 5, 2, and 1 shell versions are available in the LOD shader only, but the 10 shell is quite a bit faster than the 20 shell that is in the demo now, and may suit people's needs. It depends on how long you need the fur and how close up it needs to be seen.

    It's a bit hard for me to judge performance, unfortunately. I'm stuck on a GeForce 9400M at the moment. On my computer, just the empty cornell box scene drops to around 20fps at 720p. PBR textures kill my card. Adding a depth of field effect to the box takes it down to around 5fps. I had to manually count the framerate of the Unigine Heaven Benchmark on the extreme setting. (it was around 11-17 frames per minute). Hopefully one day I can afford more modern hardware so I can have a better frame of reference. It's really difficult to develop desktop games on a system that is slower than most modern phones.
     
  26. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Actually. I would argue that is the perfect system to develop on. If you aim to get decent(ish) performance on that then all other systems fall into place ;)

    Happy to have another look when you roll out v2 then. Best of fortune with the project :)

    Also. A simple demo of ONE main character having "Hair" that blows in the wind, reacts to gravity, would be helpful.

    This adds value to your current bouncing around the box demonstration suite
     
  27. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Oh, having a slow as dirt computer around certainly has advantage. I'm sure there are plant of people out there with blazing cards that don't realize that the depth of field effect makes a game pretty much unplayable at any setting on older hardware. It sure would be nice if the older hardware wasn't the only option though. A nice middle of the road system would be great. 20fps for a 5 polygon box is a bit limiting.

    I've got one more thing to add to the shader before I start the process of re-authoring the textures and creating some new demos. You are right, I really should have a scene with just one character so people can see what type of performance they might be able to expect in a real world project.
     
    twobob likes this.
  28. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Could you please make a demo where i can look at the fur?
    I mean that demo you have now is to fast. I can not see how the fur reacts to physics or the general quality of the fur. Maybe you can make them in different quality steps too.
     
  29. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I'm working on the demos for version 2 now. I hope to have them finished in the next couple of days and they will include a more robust set of demos. It's a bit soon since the original release for a 2.0 release, but a lot has changed due to user feedback that changes the way things are done, so I feel the distinction is necessary.
     
  30. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Removed outdated preview image.
     
    Last edited: Apr 30, 2015
  31. KaTsuoo1

    KaTsuoo1

    Joined:
    Jun 29, 2013
    Posts:
    8
    It's great to see that there is someone else, dedicated to making a fur shader.

    Would it be possible to make it receive shadows, and if so, are there any plans to include it?

    Also, have you thought about using a separate map for the fur noise, rather than the diffuse texture's alpha channel? That way the diffuse's alpha would just be used for length. Which means you could take any texture, and make it appear like fur.
     
  32. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Version 2, which I hope to have out soon, does use a separate noise texture. The alpha of the fur channel now just controls the opacity of the fur, which can help blend it in with the skin a little as seen in the preview from my previous post or in the extreme example shown in the "tips demo" image in the original post. The shader has changed a bit since the preview image above, so I should have kept to my instinct of not revealing anything until it is finished. There is also still a height map to get the effect as shown in the grass scene in the original post.

    Shadows are something else entirely. They won't be in version 2.0, but I would like to somehow get them in a later release. The problem isn't just that transparent materials can't receive shadows. I tried an alpha cutout version to get shadows working, but only one of the shells gets a shadow. I can pick the shell with the "addshadow" parameter, but that isn't particularly useful. I also tried a version that runs a separate shadow pass after each fur pass, but the code that supposedly works on other versions of Unity doesn't do anything in Unity 5. I know back in the day before Unity Free had shadows there were some assets that would allow you to add a script to a mesh to have it cast shadows and a shader to receive them. I don't know how they did that, but if I can figure it out, it might be a solution. As I said though, it won't be in version 2.0. Things have changed so much that I really want to get this out as soon as possible to minimize the amount of materials that existing customers will have to redo.

    In theory I'm at the point where I'm just creating the demo scenes to show of the new features and updating the existing scenes to work with them. But every time I start on a new scene I find some tweak that I want to make in order to improve the workflow. So I'm cautiously saying that I should be submitting it within a couple of days or so.
     
  33. KaTsuoo1

    KaTsuoo1

    Joined:
    Jun 29, 2013
    Posts:
    8
    Awesome, I'm glad to hear it will use a separate noise texture.

    I thought shadows for all the shells would be heavy on performance, and that's why it wasn't included in any of these fur shaders. But if it's because it is difficult to implement, then that's certainly understandable.

    The last thing I feel it could use, is gravity that works in global space as opposed to local... Unless something is very wrong on my end.

    Other than those things, it is a very competent and solid fur shader.
     
  34. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I think the fur shader that I was going to buy before I read that it doesn't work with Unity 5 had shadows. He still hasn't updated to Unity 5 as far as I can tell and it may be that whatever he was doing just doesn't work anymore. I did find a couple of shaders that make a custom lighting model and use the inverse of the attenuation to get the shadow data. That doesn't seem to work on Unity 5. I was surprised that it wasn't a massive performance hit to have double the passes in there. I didn't properly benchmark because it didn't work, and if I ever do get it to work, it is most certainly going to be optional because any performance hit is bad if the object is never going to need shadows.

    There is something wrong with the gravity on your end, I'm really sorry about that. I originally did the conversion to local space in the shader, then I moved it to the physics script, then I rewrote the physics script and forgot I removed it from the shader. Version 2 fixes it, and I'm still hoping to submit around Monday or so. But for now you can just open the Physics script and use this line in place of the original:

    Code (CSharp):
    1. material.SetVector("Displacement", transform.InverseTransformDirection(forceSmooth));
    The new physics code on the shader end is much improved as well, as I'm now accounting for fur length inside the shader instead of having to muck about with the maximum movement setting in the script.

    There are a lot of other changes in version 2 that will break materials, which is something I feel horrible about for existing customers (and the reason it is version 2 and not 1.5 or something). But if you just keep in mind that height maps (if you use them) and noise maps will now be separate, I don't think converting things over will be too hard. There are, tentatively, two other maps that combine with the height map to form a so called "Control map" that will allow for a much greater control over the fur. Since the fur changed since I posted my preview image, I'm not going to say what they are until I've finished their demos and made sure that nothing else changes. But I think people are really going to like them.
     
  35. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    I'm pleased to see someone is working on developing a more fully functional fur shader. I'd like to see it work for both fur and hair, if possible. Which would require shadowing, highlights, and direction (so hair can be styled and fur looks more normal on animal faces). Extra bonus points if the strands can take a wave. :)
     
  36. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Hair is a little more difficult. Fur shaders basically work by redrawing the model multiple times, slightly larger each time. When the length of the fur is short, the illusion is created that the collection of shells is a continuous line. The longer the fur gets, the more shells you need to maintain the illusion. Since hair can get really long, shells aren't a great way to replicate it.

    That said, it may work okay for short hair. At least one of the extra maps I plan on adding will help a little with styling, although hair isn't really the primary purpose. It seems like every time I start on a demo for one of the added features, I find something else that needs to be tweaked or changed to make everything look nice and play nicely together. In the end, it will result in a much more capable, well-rounded solution. But it sure does make it feel like I'm just spinning my wheels. I'm really excited to get it done and show it off though, so I guess as long as I spin those wheels fast enough I'll eventually get where I want to go. ;-)

    Anyhow, hopefully soon I'll be able to show off the new maps to give people an idea of what they can do to get the fur looking the way they want it.
     
  37. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    I figure if you can define the direction of the strands, you can better simulate the way fur looks on a wolf's face, as it flows around the eyes, nose, and mouth. And for human hair, direction would allow you to simulate hair parted on the side.

    Introducing a wave to the strand (if that's even possible) would allow for more natural coats on wolves and more natural locks of hair on people. You might even be able to simulate a big, bushy beard. ;)

    Though it may turn out that for long hair this sort of thing is the better approach:
    http://forum.unity3d.com/threads/vertexmotion-released.277294/
     
  38. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    86
    I was going to buy this but unfortunately I found out it doesn't support shadows. Currently i'm using a custom fur shader to generate grass but it looks really bad and also does not receive shadows. I will keep an eye on this asset and hope that you add shadow support.

     
  39. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I'm really sorry. I feel bad that I can't get shadows working, but I just spent all day today trying to get them in and failed again. I really thought I was close this time, but when I put them in an actual test scene it was obvious that the shadows weren't even remotely accurate. And the only way to get them to show up even halfway right was to disable the ability to cast shadows. At some point I'd really like to get them in. I don't want people feeling like they aren't getting the best that they can out of me. But it looks like the only way to do that is to figure out how those other shadow casting assets from the days before shadows in Unity Free did it and see if I can make that work. Unfortunately, I have no clue where to even start looking and I can't delay the update any longer than I already have. There are important bug fixes and exciting new features that need to get released as soon as possible. :(
     
  40. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    86
    I think receiving without casting is fine for me. My current grass also only receives without casting:


    If you can make an option to make it receive shadows without casting any, it would be great.
     
  41. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Yeah, for your use case it would probably work okay, but it isn't something that I'd want to put in the core asset because most people are using fur for other objects. The issue of not casing shadows was really only one part of it. What actually happened is that whatever shadows are in the scene just "show through" onto the furred object. So it isn't remotely physically accurate. If I allowed shadow casting, the on top of that issue, a shadow would appear on the base mesh underneath the fur, but not always on the fur itself which just looks horrible. For something like grass though, I think it would work fine. My test was a simple furred plane,which is why I didn't notice it until I put furred balls in an actual scene. For grass, there's nothing behind to to break the illusion.

    There are a lot of features that aren't needed for a grass shader though, and some things that could be added to make a grass shader better. So, since you haven't purchased Imperial Fur, it might be better for me to make a separate (and cheaper) grass shader. I'd be a little concerned about performance for a large field of grass though. And I'm not sure I can pull off something as realistic looking as the VolumeGrass asset on the asset store now. I'd be willing to have a go at it though when I get caught up on things.
     
  42. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    86
    I'd love a simple fur/grass shader to use in things like hedges and small patches of grass. I've been looking for someone to make an asset like this for a time. I see it being used a lot in recent games, here are some examples:


     
    Last edited: May 3, 2015
  43. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
  44. Goldenvale

    Goldenvale

    Joined:
    Feb 26, 2015
    Posts:
    86
  45. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Version 2.0 was submitted to the asset store late last night (or early this morning, if you prefer). The web player in the top post has been updated to the new demo. I'll update that post with some of this info when it is approved, but for now here is a list of changes and improvements:

    Import time has be dramatically reduced because some customers were having issues. Unity doesn't really like having variants in shaders with that many passes I suppose.That allowed me to include the 40 pass shaders directly in the package instead of in a zip file.

    Getting rid of the variants also meant getting rid of the normal maps on the fur itself. It was a performance cost and shaders don't respond to if-statements telling them not to include the normals very well. Normal mapping on the fur was always a bit of a gimmick and that height maps and noise maps made irrelevant anyhow.

    As I've mentioned before, the noise maps are now a separate map. So the issue with the skin tiling is fixed and in addition the fur texture itself no longer tiles with strand density. That is all handled by the noise map. The strand density inspector item is now a slider.

    Now for some pictures. As mentioned, the heightmap is separated as well. It now makes up part (the red channel) of a map called the control map. The RGB channels of the control map control different things. We'll take a look at those.



    The intrafur shadowing now correctly takes into account the height map. Before, lower strands of fur would be artificially dark because the shader thought the would be shadowed by the higher elements next to them. Getting this to work right meant getting rid of the UV shift style of shadowing. But the two were similar enough and the UV shift was an extra performance hit, so I don't think it will be much missed.



    This green channel of the control map is a stiffness map. It will allow you to control how much the physics effects a certain part of the fur. This map is vertex based, so you don't get fined grained control and it depends on the tesselation of the model. A good artist could certainly account for that though, and put vertices where they need to be to get the desired design.



    The blue channel of the control map is a bias map. I think this one will come in most handy. The cat model above was originally going to be in the version 1 demo. But as you can see, it gets really fat when fur of any length is added. Modellers tend to assume that we want the fur accounted for in the model, which makes things difficult when we add an extra layer of fur on top. The bias map allows you to shrink the skin in before pulling the fur out. The bias mapped cat above could also benefit from a height map, altered noise map, or just black alpha values in the fur texture to reduce the fur around the ears and paws.

    Because making maps with separate RGB channels is a major pain in the butt, I've created a utility called Texture Channel Manager and included it for free in Imperial Fur. It is also available separately, https://www.assetstore.unity3d.com/#!/content/35129
    Imperial Fur 2.0 comes with version 1.1 of the utility, which is also waiting in review for the asset store and fixes an issue with platform changes causing user experience issues.



    The shader now comes with an LOD script and special versions of the shaders that go all the way down to 1 shell. The distances that the shells are switched to is, of course, controllable. No default values are given because the appropriate amount is different for just above every setting. I originally had one unified LOD shader, but even empty passes cost performance, so swapping shaders is a much faster way to do it.



    The fur's alpha channel, now freed from height and noise duties, does what the skin's alpha channel did in version 1. That is, it just reduces that opacity of the fur.

    There are also bug fixes and improvements to the physics script. It now handles keeping the max movement to a sane range inside the shader, so no more guess work on that variable is needed. The wind effect is now a separate prefab, so all models with fur react the same way to the wind.

    Finally, I added a natural light option to the rim lighting. This should have been there from the beginning. I don't know why it wasn't. It basically just brightens the albedo color of the fur for a more realistic look than lighting it with the ambient light color gives.

    I think that pretty much covers the changes. Hopefully it will be approved for sale soon.
     
  46. KaTsuoo1

    KaTsuoo1

    Joined:
    Jun 29, 2013
    Posts:
    8
    It's great to see that the next version have been submitted.

    The LOD script is a much welcome addition. If I turn it off, then the demo runs at around 13-14 fps, but if I turn it on, then it runs at 60 fps solid. Which probably is more than that, since it is capped at 60. So it is great to know that it won't only be a fancy effect to use, but something that will be viable for a game.

    I look forward to getting my hands on it.
     
  47. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I was hoping that someone would post LOD framerates, but I forgot to ask people to do it. My 8 year old card is significantly less powerful so it's nice to see real world numbers. I'd rather have gotten the unified shader to work so people don't have to drag the shaders into the graphics settings so Shader.Find can find them, but the performance is just way better without it. I don't guess a one time setup is that big of a deal.

    That scene could have been improved a little further. The 40 to 20 shell transition becomes seamless really close to the camera, so the 40 shell could have been dropped entirely. Of course, it wouldn't have been a really fair comparison if I did that. The switch from 5 to 2 and from 2 to 1 is noticeable from just about any distance if you look hard enough, so that change could have possibly been brought up closer.

    Of course it depends on the fur length too. For the physics demo, I had to look at the framerate and double check the source code to make sure the 10 shell shader was getting used. I can't tell much of a difference. I maybe should have made the fur a little longer so the difference was more obvious in that demo.
     
  48. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Version 2.0 was just approved on the asset store. I still feel pretty bad about changing the way materials are authored, but I think all of the changes are for the better. Hopefully converting your fur over to the new method won't be too much of a pain. As always, if there are any problems or requests please let me know.
     
  49. KaTsuoo1

    KaTsuoo1

    Joined:
    Jun 29, 2013
    Posts:
    8
    Yesterday I was going to ask if you had an idea when it would show up on the asset store. Great to see that it is finally approved.

    First of all, I have to say that it looks really good. The bias map is definitely one of my favorite features, as it solves a major issue with fur shaders, which is that the fur usually pokes through accessories, such as collars.

    Tail.png

    I have a few suggestions so far. The first one is minor, but I thought I'd mention it. It would be to keep those 3 folders in one, when importing. It's not a big deal though, since it is easy to clean up.

    The second is for the bias map, and it would be to make black leave the skin as is, and white move the skin in, which is the opposite of how it is now. Because if you want to make a height map, and at the same time, make sure that fur doesn't make the model fatter, you can just make a black and white texture for the control map. So the whiter the map would be, the longer the fur would be, but also the more the skin would be moved in, to compensate for it.

    Now that I mention it, the same could be done for the stiffness map, where black and white is flipped. Because as far as I'm aware, longer fur would be more affected by wind, than shorter fur. So if you don't need specific control for the fur, you could just make a black and white control map, and it would do the job. It would also not really limit anything, as it would provide the same amount of control.

    Another idea I had would be either a check box, or slider to change bias based on the fur height, to compensate for the length. But with the idea above, it would only be useful, if you don't have a control map.

    I have only encountered 2 issues so far. The first is that the fur physics causes the fur to be pulled in the wrong direction. In the image at the top, I had to change Additional Gravity X, to something above 0.

    (I can't seem to upload another image) http://i.imgur.com/bRIgF3Z.png

    The second is that the Texture Channel Manager window appears so far up, that the close button in the top right, is covered by the top of my monitor.
     
  50. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    That is a good point regarding the heightmap and the bias map. Though I'm a bit afraid to change the way the textures are authored a third time. Since the heightmap is per pixel and the bias map is per vertex, I'm not sure that a combine map would provide the desired results consistently.

    I'm a bit confused about the physics problem. In my tests, the physics gravity always pull the fur down, regardless of which way the object was facing. Is it the physics gravity that pulls it up or is the problem that the additional gravity goes in the wrong direction?

    I guess having a 16:10 monitor might be why the TCM window didn't do that for me. Can you reach the title bar enough to pull it down? The second time it comes up I believe it will show where you left it. I'll definitely see about adjusting the starting position in the next update. Oddly, the standalone version went through review just fine. So I wonder if Unity is using 16:10 monitors, or if it is a more isolated incident, or if they just didn't care? Anyhow, I'll pull it down a little in the next update.