Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Pre-Integrated Skin Shader - announcements and feedback

Discussion in 'Assets and Asset Store' started by cician, Feb 26, 2013.

?

What should I focus on for next releases

  1. optimizations and mobile

    45 vote(s)
    25.0%
  2. realism

    82 vote(s)
    45.6%
  3. ease of use

    8 vote(s)
    4.4%
  4. just fixes and compatibility, it's awesome as is and you better make a hair shader...

    45 vote(s)
    25.0%
  1. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I will post some images when I get home ...but yes, hair looks crappy without some strange magic to make it look great. and cutout shaders ae horrible. someone did do a hair shader based on kajiya-kay, but it doesn't look good with the transparency sorting issues that continue happening. And the light probe issue is visually obvious... I get my diffuse texture multiplied and the normal mapping and gloss detail drowned in ambient lighting. also translucency is increased ten fold, almost making the model look hollow. you can see it better with a grey texture in the diffuse slot and light probes enabled
     
    Last edited: Apr 26, 2013
  2. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I do have this hairball thingy here:
    $hairball.png

    I guess it's already better than what you can achieve with built-in shaders.
    I put it on hold because I risked my real hair trying to make it work with shadows, in vain.

    More details:
    The base is Kajiya-Kay specular copy-pasted from Scheuermann's pdf (ATI), including the textures.
    It's double sided with proper lighting on back faces and soft edge like the built-in soft-edge-unlit, but with better transition between cutout and semitransparent part. You still need to keep semitransparent to minimum.

    For now I'm only using surface tangents as hair direction so the hair strands need to be vertical on the texture. To achieve curly hair or similar you'd need a direction texture (not implemented).

    This effectively does four passes, but it shouldn't be an issue for low poly hair.

    It casts alpha-tested shadows, but does not receive them. Actually you need to explicitly turn off shadow receiving to get rid of bugs.
    I guess receiving shadows on semitransparent objects is not possible currently. Otherwise let me know how to do it!

    For cutout-only shadow receiving works in forward lighting, but if deferred is active in project settings I have the same bugs as with tessellation.
    This happens with any cutout shader that does not have deferred lighting function and seems triggered by the same bug that skin shader has with tessellation.
    To add salt on the wounds Unity uses _Cutoff uniform with deferred even if your shader does not define or use it anywhere.

    $hairball_cutout.png

    $hairball_cutout_deferred.png

    $hairball_cutout_deferred2.png

    I effectively hijacked my own thread ;)
     
    Last edited: Apr 26, 2013
  3. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    That hair is looking great, aside from the alpha issues that keep happening in Unity (I find it highly bothersome!! What year is this,1999?) I hope you crack this nut :).

    And for dzodzu's request, here are some images of the problem I am having and the unfortunate drawback of skin shaders. I also attached a grey map on the shader to REALLY show the loss of detail that I need on my normal maps (after reading the papers on Uncharted 3, I learned so much about skin shading), but the use of GI kinda messes up the work I put into it.

    $Pre Integrated Skin Shader_0000_With GI GREY MAPPING.jpg $Pre Integrated Skin Shader_0001_With GI.jpg $Pre Integrated Skin Shader_0002_NO GI GREY MAPPING.jpg $Pre Integrated Skin Shader_0003_NO GI.jpg
     
  4. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
  5. Korda

    Korda

    Joined:
    Jan 3, 2013
    Posts:
    37
    That is a really unfortunate acronym.
     
  6. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I'm on my cellphone unfortunately :/
     
  7. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I agree, though I was first to use it somewhere. Let's call it CPISS, for Cician's Pre-Integrated Skin Shader, or something like that.

    I'll be experimenting with IBL in the future, though i don't promise anything. That would be v1.2 and v1.1 is STILL not on the asset store (check the thread this week end for update on the update).

    ps.: tablet is a little better ;)
     
  8. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997

    I wanted a tablet, but I opted for a mobile workstation... did you see the images I posted in regards to the Light probes...?
     
  9. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    I've been experimenting a bit with light probes yesterday. First of all skin shader needs shadows to work correctly.
    After baking your Light Maps and Probes, try to switch in all your lights Lightmapping mode from Auto or BakedOnly to RealtimeOnly.
    The only problem might be the performance drop for mobile or older graphic cards, in that case I would consider to create a layer for Culling Mask specifically for characters and other for static objects.. It may be a workaround for the issue, but still pain in the a$$..
     
  10. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    Sounds like something to try out...I'm not targeting mobiles or older hardware so performance is not an issue atm. I also hate that light probes ignore normal mapping and specular...
     
  11. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    Hey Dzodzu, setting the lights to real time do NOTHING
     
  12. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Sorry, I don't have much experience with light probes yet.

    This is what I understand from the limited tests we've done so far:

    Light probes provide some additional light on the part of the surface that would remain dark with real time only setting. Those parts get escluded from usual specular and diffuse calculation by angle to the light (traditional N dot L). Removing this limit would screw thing up.
    Standard bumped specular uses the additional light with original light direction which looks acceptable with plain blinn-phong, but not so much with Kelemen-Szirmay-Kalos specular used here.

    Unity feeds the additional light to the shader in the base pass where I can't even distinguish it from the main directional light.
    As rea said I need the light direction for SSS, which lightprobes don't provide. The result is that the normally unlit parts get lit smoothly like with VertexLit.

    Also I don't yet understand on what basis Unity decides when to apply light from probes vs real time but, as I said, I don't have experience with them.

    Here's my plan on how to manage lighting for skin shader in our game:
    - Proceed as you normally would with light probes and lightmaps.
    - Create a layer for characters (or just skin shaded meshes, but this may result in awkward differences).
    Set all the lights with lightmapping to auto (default) or baked only and exclude the characters layer with culling mask.
    - Create a second set of lights (control+d) set them up with real time only and only characters layer in culling mask.
    Then you can compensate the lack of indirect lighting with more lights that would affect only characters, limiting the overhead.

    All this serves to avoid using light probes for sss, but keep them for other objects.

    I was thinking of adding directional lights and somehow limit them to map locations with a combination of scripts and shaders, but I guess proper IBL could do a better job.

    Take what i said with a grain of salt, I can be entirely wrong with my assumptions.
     
  13. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I can try this... and your best bet is parts that are supposed to have glowing aspects...I will just fake it with point lights...

    Also, i am baking the scene using IBL so this trick doesn't work... I will just live with the bake... it looks good...
     
    Last edited: May 5, 2013
  14. scarletsnake

    scarletsnake

    Joined:
    Nov 27, 2009
    Posts:
    91
    Thanks a lot! I really appreciate it. :D
     
  15. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    bumping this topic... any new updates :)?
     
  16. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Please tell me that first picture on main post is Unity screenshot. Webplayer is not working for me due to some mozila bug, is there any way to get more pictures of shader in action?

    Just checked all pages and there are simply amazing examples posted by users. It seems thats what i was looking for.
     
    Last edited: May 19, 2013
  17. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    Last edited: May 19, 2013
  18. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    And the viewport screenshot:
    $Image9.jpg
    Tessellation on borders:
    $Image10.jpg
     
    Last edited: May 19, 2013
  19. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    Not bad dude. Though there is too much bump on the skin... makes it feel more leathery than skin. I love the teeth on him too, still trying to get my model's teeth like this. Are you all working on the shader together? and I like the hair too... do u have a working shader for hair?
     
    Last edited: May 19, 2013
  20. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Very nice monk, i would agree with Neptune though a bit too much bumpines on skin.
     
  21. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    Thanks a lot Neptune, much appreciated. I know, it looks like I got rid of specularity by switching to linear from gamma, and probably should tweak some specular parameters to get it back.
    The hair shader is working, but it's still kinda tricky.. Practically you have a shader per hair layer. It casts shadows, but not receive.. In other words, not too perfect but kind of working. :p
    By the way, we didn't figure out yet how to make the shader work correctly with light probes...
    Looks like normal map bumpiness dessapears completely when the light probes are too strong. Would love to see how the Skyshop you mentioned some posts before manages it..
    Anyway, only cician is a programmer there, me and K are working on the models, textures and rigging.
    We are planning to create a game in a near future and we would love to make some 3d models and shaders available on asset store.
     
  22. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    Maybe I should make available on asset store the teeth? Someone interested?
    $Image15.jpg
     
  23. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    A great way to make the skin feel soft and natural is to set the red channel on the diffuse bump to .02 and the green channel to a nice midpoint. leave the blue channel alone. also tweak your spec map so it is very bright...about 170,170,170 as a base. plug in a dark grey diffuse map to really see the effect. For the light probes, you may have to lower the main colour a bit to compensate, usually an off white should help.
     
  24. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I'm more interested in the shader settings
     
  25. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    Okay, no problem. I did the screenshots of everything what was coming to my mind.
    Screenshots shows the Shader version 1.1. Not published yet. Cician has been busy for last two weeks, so we didn't make much progress with the update, sorry about that folks ;( Shader works almost the same, but now it's much easier to use with the separated textures.
    Self two explanatory images (hope they show up):
    $mouthsetup.jpg $Setup.jpg
     
    Last edited: May 19, 2013
  26. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    i don't see the images :/
     
  27. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Darn this makes me want to model characters so much...but i cant as i am still way too early into design stage...weapons first...

    Nice skin tones on monk. The only thing that could be maybe improved is that hair from the angle on picture looks a bit wierd becouse it is not dense enough, you could solve that by simply lowering down polygons of hair a bit.
     
  28. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I want that hair shader! It may not receive shadows (can't see why) but it will work for my purposes...
     
  29. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    If someone cannot see the images, hate to say it, but try with Internet Explorer...
    Hair shader is still at "work in progress" state..
    Cician is trying to figure out some stuff for opacity ordering. Shadow works fine with cutout only, and what we would love to achieve is to make it work with soft edge at least. Anyway It's complicated, and we don't want to publish something half working.
    If you reeeeeally want it, try to pm Cician, maybe he can give you something in a stage as it is now.. I will get a serious punishment for making the promises though..
     
  30. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    VERY nice... and I do see what you did with the specular, you just turned it way up :). And I noticed that you were in Forward rendering mode... any reason who you didn't use Deferred? For the teeth, I would have to create a separate material for them so I can get that shine. And the transparency color, I was trying to get that working and I saw no effect :(

    I can wait on the hair. :) I halted my game so I can focus on finishing my novel...
     
    Last edited: May 20, 2013
  31. dzodzu

    dzodzu

    Joined:
    Nov 25, 2012
    Posts:
    46
    In Forward only because of tessellation bug (see the Cician's post on page 2). By the way, I discovered that this bug occurs only with directional lights!
    I'm hoping Cician will finish the manual soon, so we can update the shader. I don't know how much he modified the other stuff, but there is a lot of improvement in glossiness. We are thinking also in the future to remove the front rim, since it doesn't work as we would like to..

    P.S: Are you writing a novel? That's pretty awesome :)
     
  32. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    Yeah, i am not a fan of the front rim... doesn't contribute to anything...you guys should ax it. And for models, I would love to build a model that will fully show the power of this shader. And I hope you guys will definitely get IBL working on this in the future... because I would love to get this working with reflections, especially with skyshop. And Light Probes are a pain to use :(

    And yes, writing is my second passion next to gaming... I'm releasing my novel in Sept/October once I get this bad boy edited.
     
  33. smiljan66

    smiljan66

    Joined:
    Jun 9, 2010
    Posts:
    610
    I saw the image of the monk , the bump is not the bad thing the bad thing is not MILKY the secret of skin shader to be realistic is that has to be milky you need ot blend the dermal and the epidermal good managing reflection and spec , but dont know if this dont has dermal and epidermal , you need to try to make that and make a blend becuase far as i see it dont look realistic , i know is tuff job but you need a to to improbe a lot.
     
  34. crawler

    crawler

    Joined:
    Aug 9, 2012
    Posts:
    26
    Hello! It looks very nice. Tell me please does your shader support lightprobes and shadows from point lights?
     
  35. K-JBrothers

    K-JBrothers

    Joined:
    Feb 27, 2013
    Posts:
    43
    Yes it works with both. Only thing is that normal map is almost invisible when using probes (same happens with default "bumped diffuse" shader). To avoid that you have to lower intensity of your lights before baking probes. Then set your lights back, but with "lightmapping" option set to "realtime only" to have some shadows back.
    Otherwise generated probes will wash out normal maps on which our shader heavily depends.
    Unfortunately that happens because light probes don't cast shadows and I personally think that this is not a best way to fake GI, but for now there is no other way to do that.
     
  36. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    bumpity bump bump...
     
  37. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    725
  38. Emptiness

    Emptiness

    Joined:
    Jul 14, 2012
    Posts:
    33
    Hi!

    Is there any progress about the tessellation problem with DX11 ?

    I hope the Unity team solve this bug soon. :)

    Thanks!
     
  39. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Not much, unfortunately. I can only confirm that the bug is in Unity itself and I did not find any workaround.

    I filed a bug report but there doesn't seem to be any means to add additional info to it other than filing a new bug report.
    For anyone interested...

    The bug appears with following conditions:
    *deferred lighting is on
    *shader is forward lighting only
    *shader does vertex displacement (otherwise the additional pass doesn't pop up)
    *object has "receive shadows" enabled
    *There's at least one directional light in the scene with shadows enabled. Even if shader doesn't have a shadow receiver.
    Happens in Unity 3.5, 4.0 and 4.1.

    To reproduce:
    Code (csharp):
    1. Shader "Custom/Displacement" {
    2.     Properties {
    3.         _Color ("Color", color) = (1,1,1,0)
    4.     }
    5.     SubShader {
    6.         Tags {"Queue"="Geometry" "RenderType"="Opaque"}
    7.         LOD 300
    8.  
    9.         Pass {
    10.             Tags { "LightMode" = "ForwardBase" }
    11.            
    12.             Fog {Mode Off}
    13.             ZWrite On ZTest LEqual
    14.    
    15.             CGPROGRAM
    16.                 #pragma vertex vert
    17.                 #pragma fragment frag
    18.                 #pragma fragmentoption ARB_precision_hint_fastest
    19.                 #pragma multi_compile_particles
    20.    
    21.                 #include "UnityCG.cginc"
    22.                
    23.                 struct appdata {
    24.                     float4 vertex : POSITION;
    25.                 };
    26.    
    27.                 struct v2f {
    28.                     float4 vertex : POSITION;
    29.                 };
    30.    
    31.                 v2f vert(appdata v) {
    32.                     v.vertex.x += 0.1;
    33.                    
    34.                     v2f o;
    35.                     o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    36.                     return o;
    37.                 }
    38.                
    39.                 fixed4 frag (v2f i) : COLOR {
    40.                     return fixed4(1, 0, 0, 1);
    41.                 }
    42.             ENDCG
    43.         }
    44.     }
    45.     FallBack Off
    46. }
    ps. just got my pc running after moving and got stable internet connection again :D
     
  40. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    Hey man... welcome back... :) Any news on this shader?
     
  41. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    how does this thing look on mobile?
     
  42. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Currently not as good as in the webplayer demo because it fallbacks to the basic SM2 version on GLES2.
    That being said I have it working here with 3 passes and most features enabled on a Tegra2.
    If the trend in the poll continues v1.2 will be all about optimizations and a mobile variant. Though mobile will always be more limited.
     
  43. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    Any screenshots of it on mobile? or video?
     
  44. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    just a teaser, the quality is horrible...
    https://www.youtube.com/watch?v=K2cjLuKMT70&feature=youtube_gdata_player

    things to note:
    It's currently unreleased version, first baby steps on mobile. If you run the one on the asset store right you won't get back scattering, for instance.
    I cranked up translucency strength here so the ears are overly red and there are no shadows.
     
  45. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    curious about hte performance. How realistic is it to have on like 10 characters on screen with an environment in the mix? Tegra 2 or tegra 3. Honestly only way I would purchase this is for a mobile project im working on. For the moment desktop or looking any better doesnt interest me, but if u make a nice performing mobile version you got my money :)
     
    Last edited: Jul 12, 2013
  46. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    Hey guys... are you still working on this skin shader? I am using Skyshop, and I am wondering if you guys got this shader working with it... thanks a bunch
     
  47. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Still working on it. No IBL goodness yet, but other good news: tessellation bug seems to be gone in 4.2!
     
  48. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    That sounds good... (not on Unity 4 as of now)... I am still using your shader for other experiments...and it is the most realistic shader for skin, thus far...
     
  49. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,121
    Hey in an earlier post you said your mobile version in the video is not one the on the asset store? still unreleased? Any ETA on that? And again how is performance in comparison to regular bump spec shaders.. on mobile i mean.
     
  50. Emptiness

    Emptiness

    Joined:
    Jul 14, 2012
    Posts:
    33
    Unfortunately I haven't experienced any changing related this bug :(
    Could you confirm that at your shader the bug is not visible? Because I still see the bug with my shaders.

    Thanks
     
unityunity