Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Lux pre integrated Skin shader for unity 5 [RC3]

Discussion in 'Unity 5 Pre-order Beta' started by larsbertram1, Dec 20, 2014.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi there,

    i have just started to port some lux shaders to unity 5 beta (latest tested version: RC3).
    the first one is the lux pre integrated skin shader – which got a little update and now supports "deep subsurface scattering" or translucency.

    Lux2_Skinshader_animgif.gif

    you can grab the shader from the git repo:
    https://github.com/larsbertram69/Lux_2.0

    others might follow in the nearby future.

    lars
     
    Last edited: Feb 23, 2015
    Stunx, Dweep, ZiadJ and 6 others like this.
  2. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    Awesome Lars!
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    thank you mike.
    still some wok to do like solving large scale sss issues when using point or spot lights.
    may be the upcoming betas will help (by improving the shadow quality), may be i will have to come with an own solution.

    lars
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi there,

    soft spot light shadows are done – at least for opengl.
    so subsurface scattering looks a bit better for spotlights. nevertheless i am not really sure if it worth adding it as it would cause sampling the shadow texture 25 times instead of just 4 times...
    sss for spot lights is applied using depthtexture*depthtexture to smooth it out a little bit more.
    but i am still not really convinced by the softened shadows.

    if one looks from the light’s direction things are completely different however: using a custom 5x5 pcf shadow filtering will give you real smooth shadows whereas unity’s built in functions will not.

    what do you think?
    lars

    Lux2_Skinshader_2nd-iteration_ainimgif1.gif

    just to compare the edge (as the animated gif more or less made it look the same)

    Lux2_Skinshader_softshadows.png
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i have just tested the shader with the latest beta 18 – and it still works!
     
  6. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    Hi,
    I have tested LuxSkin in Windows 7 with Ub17 and Ub18 but don't work (always pink)...
    the shader error is: "cannot map expression to ps_4_0 instruction set"
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    strange – as it works fine for me on osx.
    i have just updated the git – may be it works now?
     
  8. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    Tried now, but unfortunately the same error...
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hmm, some more info about the error message could help.
    and you could try adding:
    #pragma only_renderers d3d9 d3d11 opengl
     
  10. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    No,
    but "ddx_fine" seems to requires shader model 5
    and #pragma target 5.0 solves the problem...

    Thanks for your work, I test it now
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi there,
    i have managed to reproduce the compiler error.
    and as thundertruck said: ps 4 does not like the dx11 "branch" which uses "ddx_fine" instead of "fwidth".
    using:
    #if (SHADER_TARGET > 40)
    instead of:
    #if SHADER_API_D3D11
    does the job without adding #pragma target 5.0 which would make the shader not compile for opengl or dx9.

    update is in the repo.
     
  12. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    does this work with unity 5 reflection probes?
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
  14. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    is lux required? And are you porting over the other shaders like eye shaders?
     
  15. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Awesome. Can you create a cloth shader too?
     
  16. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    Why would u need that? Cant u just create cloth with the standard unity 5 shader.
     
    ksam2 likes this.
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    ksam2 likes this.
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    what would that exactly mean?
     
    ksam2 likes this.
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    ksam2 likes this.
  20. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Ops! I added vertex color to this shader and now looks better with my camera
    Is the newest version on the github?
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    the shader does not make any use of vertex colors... and i am still working on the 2nd iteration.
    so the version on github does not support "softened" real time shadows right now.
     
    ksam2 likes this.
  22. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Hi Lars,
    Can you add fuzziness to the skin and hair shader?
     
    ksam2 likes this.
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    what exactly do you mean by fuzziness?
    skin already supports a bump bias.
     
  24. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Textures of this models looks really out of quality for a FBR, Isn't there any better model for example?
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    you could edit the textures and improve them.
     
    ksam2 and 0tacun like this.
  26. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Some kind of additional fresnel effect on the direct lit area to visualize small hair/fur on the surface with parameter to set it's intensity, the fuzz color could take from Difuse IBL or difuse color (albedo*light).
    I know that this would break the physical based shading of the skin/hair, but this could be an additional aesthetics effects.
     
    ksam2 likes this.
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    shader has been updated to work with beta 20.
     
    kurylo3d likes this.
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    updated to beta 22.
     
  29. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    Has anyone tried this shader out yet extensively? I have a lot of issues with it and im using beta 22. For one the curvature and normal blur are the only 2 sliders that work... i cant even change the sss color value in the material to do anything..

    First image is the sss blue channel as a flipped normal ao inverted. I barely get anything... problemstill.jpg


    The following screens are a totally white sss blue channel with shadows for testing.
    light_hi.jpg light_lo.jpg

    And here are 2 different curvature values with no shadow.

    settings1_noshadow.jpg settings2_noshadow.jpg

    I cant seem to get any decent control over sss since none of the slider values do anything other then the ones mentioned.
     
    TechnicalArtist likes this.
  30. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    What hair shader are you using?
     
  31. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
  32. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    luxs hair shader, but im more concerned with the skin shader not working properly. larsbertram has been trying to help me. It works on his end with his mac. But for whatever reason.. having issues with it on my end. We're trying to see if anyone else has encountered anything similiar. Using beta 22 here of unity 5.
     
  33. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Hi Lars

    I'm wondering what is your position on this question from Unity.
    forum.unity3d.com/threads/official-specular-vs-metallic-workflow.274612

    My real concern is how this integrates with a skin shader. If I wanted the skin shader to support make-up, piercings, tattoos and scars. Would there be an advantage to using either metallic or specular pbr approach?

    As usual your stuff rocks! Keep it up!
     
  34. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    Has anyone else even attempted to use this shader yet?
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    making the skin shader supporting the metalness workflow should be a rather easy task but it will make the shader a bit more expensive. just like all metalness shaders are a bit more expensive…
    the advantage of using metalness is the fact that you have at lest one texture channel free (in the metlnasse/spec/xx/smoothness texture) which could hold the ao map – so you would save one texture/one texture lookup which might in the end make the shader as fast as using specular.

    lars
     
  36. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    Here are some screens of a model i did of me using various methods for accuracy and using the lux skin hair and eye shaders... though the skin shader is somewhat broken right now on my computer.. (maybe cause the creator only as a mac to test with)... I was still able to ghetto rig it to look good with some bad ideas like disabling mip mapping on the bdrf lookup and stuff... The shaders are awesome though and I highly recommend em :)
    tom_3D1.jpg tom_3D7.jpg tom_3D6.jpg tom_3D2.jpg
     
    protopop and Botanika like this.
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi there,
    i have just uploaded the latest version of the skin shader which now works with unity 5 RC3.
    make sure you get the skin shader named: "Lux RC3 Skin" and have also downloaded the include "LuxSkinLightingRC3" if you want to use it with RC3.

    lars
     
  38. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    That hair looks SO DAMN GOOD... I'm curious to see the textures for them as hair is something I struggle with.
     
    kurylo3d likes this.
  39. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    As for the skin, I wish you would include separate controls for blurring/strengthening the channels of the normal map separately. Especially since the red channel of the skin is blurrier than the green, and blue is weakest