Search Unity

[Released] Lux LWRP Essentials

Discussion in 'Assets and Asset Store' started by larsbertram1, Jul 18, 2019.

  1. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    40
    Thank you, two materials method works. Now the hair looks better than alpha to coverage with MSAA.
     
    f1chris likes this.
  2. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    40
    I find a typo in hair shader, the Mask Map is Occlusion (G) Shift (B), not Shift(G) Occlusion (B), I also check the Lux LWRP Hair Core.hlsl file.
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    thanks!
     
  4. Alvarezmd90

    Alvarezmd90

    Joined:
    Jul 21, 2016
    Posts:
    73
    I'm genually surprised no one mentions this around the internet but 2B's dress has obvious fresnel shading on the clothing parts. This along with the skin shader looks great with this asset:
    2B.png
     
  5. Ruberta

    Ruberta

    Joined:
    Mar 5, 2019
    Posts:
    34
    Hello. Does hair shader support wind zone?
     
  6. Xskey

    Xskey

    Joined:
    Jul 23, 2013
    Posts:
    16
    @larsbertram1 Can you please add wind support for hair shader.

    P.S. For someone who wonder if this asset work with UniversalRP in 2019.3.0b1. I just test it and it's work! All you need to do is to change the reference from "Packages/com.unity.render-pipelines.lightweight" to "Packages/com.unity.render-pipelines.universal". There might be some warnings or errors. I'm not sure about this yet but most of it just works as expected.
    upload_2019-9-2_12-24-20.png
     
    Last edited: Sep 2, 2019
    Lars-Steenhoff likes this.
  7. Xskey

    Xskey

    Joined:
    Jul 23, 2013
    Posts:
    16
    Try to add some post-processing to the sample scenes to make it look more bright and shiny. The result is good. (Maybe a bit oversaturated.:p)
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    it does not. it is quite tricky and needs you to store a lot of extra information in the mesh. and as hair most likely will be part of a skinned mesh it might even need you to write your own skinning code in order to skin/interpolate that extra data.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    oh, i leave it to you :)
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    preview of the refractive glass shader.
    it is an eyeballed shader supporting thin shell glass materials as well as solid ones.
    you may mix thin shell with solid within a single material using the mask map.
    glass can be tinted and responds to normals and smoothness.

    Bildschirmfoto 2019-09-02 um 23.15.11.png
     
    Xskey, sjm-tech, GCat and 1 other person like this.
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    Somehow faking complex glass objects using different materials for outer and inner faces in order to make inner faces show up (right glass):

    Bildschirmfoto 2019-09-03 um 16.09.40.png
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    version 1.09 is available which adds the glass shader.
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    Preview of per vertex fetched real time shadows for particles in Unity 2019.1.10 using the LWRP.

     
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    the hair might need some more love :)
     
  15. Ruberta

    Ruberta

    Joined:
    Mar 5, 2019
    Posts:
    34
    Can you apply wind effect from grass to hair, please? I don't need much fancy wind for hair. Just the same effect as grass is enough. :)
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    how would you prevent hair from going through the head? how would you author stiffness?
     
  17. Ruberta

    Ruberta

    Joined:
    Mar 5, 2019
    Posts:
    34
    Oh... you're right. I didn't think about this yet. :oops:
     
  18. GCat

    GCat

    Joined:
    Jul 31, 2012
    Posts:
    174
    I liked the terrain mesh shader, would be also nice to have a shader for the terrain itself to removes tiling maybe detail mixing
     
  19. skyLark9

    skyLark9

    Joined:
    May 2, 2018
    Posts:
    119
    Is there mesh terrain blending shader ?
     
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    kind of: the top down projection shader as well as the mesh terrain shader can sample textures in world space (mesh terrain shader supports 1 texture to be sampled in world space). so these textures will fit in tiling.
    any fancy normal or texture blending most likely will not work with mesh terrains: think of cliffs and overhangs and custom uvs...
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    hmm, there are a few terrain shaders available.
     
  22. skyLark9

    skyLark9

    Joined:
    May 2, 2018
    Posts:
    119
    I did not understand you well. Do you mean that There is one shader included this package do blend meshs ?
    I found one or two free shaders in Unity store do this but with LWRP/HDRP did not work. At end, only one shader support HDRP/LWRP can do that only on unity store ! Is there a chance to do this kind of shader ?
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    as i wrote: it is more or less impossible to do it with a terrain using a custom mesh.
    if you have a unity terrain instead is way more easy: textures are always top down projected and the terrain does not let you create things like overhangs.
    if lux lwrp shipped with a shader for the built in terrain i might look into something like this. but it does not.
    lux lwrp comes with a mesh terrain shader. and when using mesh based terrains such a feature is way less important: you need a cliff blend nicely with the terrain? just add it to your mesh.
    performance wise you can hardly beat this approach. however it takes quite some time to build you mesh terrain, texture it and add all the details like grass and trees...

    just to illustrate: this is one mesh. all the cliffs and overhangs are part of the mesh terrain.
    no need for triplanar mapping, just one click in maya's uv editor and your terrain will be textured smoothly.
    of course everything blends super smoothly: texture as well as normals. and this comes all for free.



    the amount of details and precision is outstanding compared to a built in terrain – as you only add vertices where you need them and can have high densities combined with rather low ones – while the built in terrain always works on a fixed grid.



    i would not recommend mesh based terrains for larger levels (although people have done so – just have a look at how naughty dog works) but for a small, mobile level like 500x500 meters is absolutely fine and doable.

    if you kepp going with the built in terrain which has made great progress during the last year you will have to look for another solution. or wait until i have ported my terrain shading solution to lwrp.
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    The Lux LWRP particle shaders are finished:

    Particles.jpg

     
    GCat and osss like this.
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    version 1.1 is submitted.
     
    GCat and Ruberta like this.
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    version 1.1 is available!
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    cmckelvy likes this.
  28. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    14
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    ha, i did not think about new lighting functions but the existing ones like transmission or cloth...
    nevertheless toon shading might be something i will have a look into.
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    @osss i am not familiar with toon shading, but this is what i have come up with so far:

    Bildschirmfoto 2019-09-10 um 15.50.57.png

    the "position" of the border between lit/unlit can be controlled using lower and upper bounds. the distance between both values define the width of the transition.
    the bright circle is a specular highlight. the sharpness of its border can also be controlled.
    same goes for the soft shadows.

    do we need a gradient or ramp for the diffuse lighting? as texture input because the gradient as provided by shader graph looks pretty expensive in code.
     
    osss and Lars-Steenhoff like this.
  31. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    14
    i found an article about toon shading that might be useful.
    https://roystan.net/articles/toon-shader.html
     
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    thanks for the link. actually i thought more about an "artistic" input. i do not even know the terminology in toon shaders :)

    so here is what i have right now. duo tone shading, rim and eyeballed specular lighting.
    all shading features support a custom feather value (incl. shadows).
    adding light mapping support was a bit tricky...

    toon shade_jpgr.jpg
     
    osss likes this.
  33. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    14
    see this link for artistic input
    https://github.com/unity3d-jp/UnityChanToonShaderVer2_Project
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    oh, i already did.
    but it looks way to complicated :)

    my simple version looks like this:

    Bildschirmfoto 2019-09-11 um 13.25.22.png
     
    osss likes this.
  35. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    40
    The hair shader is cull off by default, but the backface of hair has wrong reflection lighting. I tried HDRI skybox and procedural skybox as sky and reflection source.
    upload_2019-9-12_16-7-21.png


    If I disable the reflection probe and environment reflection in lighting tab, the back side is right color.
    Or if I change hair shader to cull back and add another back side hair model, the whole lighting is correct.

    upload_2019-9-12_16-6-22.png
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    this is by design: the shader does not use VFACE to calculate proper normals for back faces in order to give you smoother lighting.
    your screenshots do not show the context of the hair. but i think in most situations totally wrong reflections on hair are occluded by the head.
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    i submitted version 1.11 which adds custom nodes for shader graph.
    the first two ones are lighting nodes: toon shading and transmission.

    i did some more fine tuning on the toon lighting. it now lets you chose if lights shall tint or colorize shaded parts of the mesh or not. you can tune the settings for directional light and additional lights separately:

    Bildschirmfoto 2019-09-12 um 21.30.32.png
    more info is already available in the documentation.
     
    osss likes this.
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    version 1.11 is available.
     
  39. Dark-Table

    Dark-Table

    Joined:
    Nov 25, 2008
    Posts:
    243
    I just tested out the shader pack in VR (oculus rift). Glass, water, lit particles and decals don't work correctly. The best way to describe it is the rendered positions for the left eye and right eye don't "converge?" Water and glass might not be taking into account the fact that the opaque texture is "double wide?"

    Hopefully there's a way to fix it.
     

    Attached Files:

  40. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    14
    how to add a emission map to toon shading?
     
  41. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    14
  42. Dark-Table

    Dark-Table

    Joined:
    Nov 25, 2008
    Posts:
    243
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    You simply combine "FinalLighting" with your "custom Emission" (e.g. by using "Add") and plug the result into the "Emission" slot of the PBR Master node:

    custom_emission1.png
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    as far as i know there is a bug in LWRP, yes.
     
  46. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    14
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    i hope unity will fix this soon.
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    Version 1.12 will add more lighting sub graphs for Shader Graph: Charlie Sheen, GGX Ansiotropic and Clear Coat.

    lighting_subgraphs.PNG
     
    GCat, Ruberta, osss and 1 other person like this.
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,950
    I have submitted version 1.12

    ### Added
    - Custom nodes for Shader Graph added:
    - - Charlie Sheen, GGX anisotropic and clear coat lighting added.
    - - Helper nodes added: Double sided normalTS and Metallic Albedo to Specular Albedo.

    ### Fixed
    - Custom Transmission Lighting node: Occlusion fixed.
    - Clear Coat Lighting: Wrong NdotL for clear coat layer fixed.
     
  50. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    14
    @larsbertram1 how to add whole outline when one mesh has multiple materials?
    20190916103323.png