Search Unity

[Released] Lux LWRP Essentials

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

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    thanks. then renaming the function should do the job.
     
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    Fix for 2019.2. has been submitted.
     
  3. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    251
    Same here, 2019.2 and latest LWRP 6.9.1

    I tried changing ShiftTangentLuxLWRP but didn't work for me !!
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    you have to rename ShiftTangentLuxLWRP and D_KayijaKay.
    but i have submitted a fix which should be available later today / early tomorrow.
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    hi there,

    i have been looking into volumetrics recently... but i am not quite sure what essentials might really need.
    any suggestions from you regarding missing shaders or features?


    udk like light beams

    Bildschirmfoto 2019-08-15 um 22.09.43.png

    ray marched box volume

    Bildschirmfoto 2019-08-15 um 22.07.45.png
     
  6. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    251
    Thanks for your quick turnaround :)
     
  7. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    15
    volumetric light, cloth shader, fur shader, eye shader, clear coat shader, for reference only:)
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    true volumetric lighting is a bit beyond the scope of lightweight i think.
    i may add some fake effects like udk light beams or simple volumes.
    cloth should be an easy one.
    fur sounds more complicated as lwrp is said to not support multipass shaders?! i haven't tested it tho.
    a dedicated eye shader may come, but most likely will need very special geometry. isn't this a bit too heavy?
    clear coat is a very special one... and one could go crazy about it.
     
  9. eldvbear

    eldvbear

    Joined:
    Jul 21, 2016
    Posts:
    1
    Thank you for the timely fix! I was able to get the shader to compile properly. They look great! This set of shaders is a must have for anyone using the LWRP.
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    thanks a lot!
    and it would be great if you could write a review in the asset store :)
     
  11. Augis1980

    Augis1980

    Joined:
    Sep 23, 2014
    Posts:
    33
    Hi, Projectors are not visible in VR. Any way to fix it?
    Thanks
    Eugenijus
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    as far as i know anything that relies on the depth buffer is broken in unity 2019 using LWRP and VR, sorry.
     
    Last edited: Aug 16, 2019
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    before i go crazy adding more lighting features just some more basic shaders: billboards!

    camera aligned and upright oriented (like the trees). lit and unlit. alpha tested and alpha blended.
    with or without fog. do i miss anything?

    Bildschirmfoto 2019-08-16 um 23.00.35.png
     
    GCat and osss like this.
  14. Abhijith_NB

    Abhijith_NB

    Joined:
    Jan 19, 2019
    Posts:
    1
    Hey,
    Can anyone please confirm if this shader works on Quest (using OpenGL ES3) or on any android devices which is using OpenGL?
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    version 1.06 has been submitted adding the billboard shader.
     
  16. Knele

    Knele

    Joined:
    Nov 5, 2018
    Posts:
    2
    +1 on this one.
    Could be very interesting, if not essential for Oculus Go/Quest development - which sadly doesn't support Vulcan right now.
    I just recently started looking into Unity because of DOTS and the LWRP since it looks to enable much higher quality graphics on low end hardware compared to released titles using the standard renderer.
    As I am only experimenting with Unity VR Dev for personal purposes even the humble and more than fair price is too much in my current personal situation to probably be disappointed with performance - especially since I could only really make use of the skin and hair shader for now...
    Would be happy to report performance in VR on Oculus Go for a free trial copy ;)
     
  17. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    278
    @larsbertram1
    hello,
    does it support on Android GL ES 3.xx or just Vulkan?
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    it should support gles 3x as well. at least: i do not get any errors or warning when i compile the shaders for gles 3x.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    Preview of the upcoming cloth shader which supports Charlie Sheen and GGX anisotropic lighting.
    The examples shows Charlie Sheen – slightly exaggerated.

    cloth.jpg
     
    Rowlan and osss like this.
  20. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    278
    Separable Subsurface Scattering [SSSS] shader , Carpaint Shader, Refractive Glass shader, Ocean shader ...
    PPS v2 AO shader ...
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    Lux LWRP already contains a very fast and IMHO convincing skin shader. so i do not see any need for doing something like separable subsurface scattering (expensive) :)
    As i wrote: car paint is a very special material. and you can really go crazy regarding features. maybe a simple clear coat shader will come.
    That is on the list.
    To render an ocean you do not only need a shader but a script/shader solution. And Crest for LWRP is just fine. So Lux LWRP will only offer a simple water shader for everything else.
    What is that? – Ah, ambient occlusion as post processing effect? Not my cup of tea to be honest. And i guess an official version will come sooner or later.
     
  22. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    278
    yup :]
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    Have you checked the skin shader?
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    Charlie Sheen vs GGX anisotropic (GGX anisotropic uses a darkened albedo):

    cloth_compare.jpg
     
    Davood_Kharmanzar likes this.
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    as some people have been asking for it: Here is a preview of a simple clear coat shader.

    ClearCoat_simple.jpg
     
    osss and Davood_Kharmanzar like this.
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    Clear Coat and activated normals:

    ClearCoat_normals.jpg
     
    osss likes this.
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    feature creap:
    now with secondary reflection sample, coat mask and smoothness texture and a base layer mask texture (metalic, occlusion, smoothness). at least all optional.

    ClearCoat_featurecreap.jpg
     
    GCat likes this.
  28. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    278
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    i have submitted version 1.07 which adds the cloth and clear coat shader.
    version 1.051 and 1.06 are still not approved (for 10 days now). i hope this time it will be a bit faster.
     
    osss and GCat like this.
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    i had a quick look into the code:
    it looks as if it does not support a 2nd normal - which is needed to add effects like flakes e.g.
    i do not really get the roughness recalculations there: clear coat to base layer traversal changes the ior of the base layer (as we do not deal with air to conductor) but roughness? does the clear coat material fill the micro cracks of the base layer changing its roughness?
    anyway. similar but still different. overall i think the lux clear coat shader offers more freedom :)
     
    Davood_Kharmanzar likes this.
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    version 1.07 is available!
    time to play around with billboards, cloth and clear coat.
     
    GCat and zyzyx like this.
  33. Vak_HD

    Vak_HD

    Joined:
    Aug 6, 2016
    Posts:
    11
    Hey,
    I seem to be having some trouble with the shader for the outline. Everything works fine just not the emission property on the Lit Extended Material/Shader no matter what I do (change the intensity or texture input) nothing seems to be updated in the material.
    Is there something I am doing wrong/something I am missing?
    Great asset btw.
     

    Attached Files:

  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    thanks!
    you found a bug!
    the shader simply misses the needed "#pragma shader_feature" directive.

    if you open the shader file and go to line 120 it looks like this:

    120: #pragma shader_feature _ALPHAPREMULTIPLY_ON
    121:
    122: #pragma shader_feature _METALLICSPECGLOSSMAP

    just add the missing pragma and safe the shader:

    120: #pragma shader_feature _ALPHAPREMULTIPLY_ON
    121: #pragma shader_feature _EMISSION
    122: #pragma shader_feature _METALLICSPECGLOSSMAP

    unity often ignores features being enabled or disabled like the normal map e.g.
    so emission still might not show.
    to fix this toggle "Enable GPU Instancing" several times. this should make unity actually activate all selected features.
     
  35. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    278
    @larsbertram1
    is it possible to mix SSS and outline shaders together?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    right now there is no generic sss or transmission shader.
    sss or transmission is part of foliage, skin (and somehow hair) and cloth lighting. cloth and skin should already support outlines. foliage does not (i think it is not needed here: selectable foliage?...).
    reading and writing from and to the stencil buffer costs something. not sure about the actually impact but as foliage most likely will be pretty heavy due to all the overdraw i skipped it.

    all it needs to add outline support to a given shader is to add the stencil options:

    needed properties (taken from cloth shader):
    [Header(Stencil)]
    [Space(5)]
    [IntRange] _Stencil ("Stencil Reference", Range (0, 255)) = 0
    [IntRange] _ReadMask (" Read Mask", Range (0, 255)) = 255
    [IntRange] _WriteMask (" Write Mask", Range (0, 255)) = 255
    [Enum(UnityEngine.Rendering.CompareFunction)]
    _StencilComp ("Stencil Comparison", Int) = 8 // always – terrain should be the first thing being rendered anyway
    [Enum(UnityEngine.Rendering.StencilOp)]
    _StencilOp ("Stencil Operation", Int) = 0 // 0 = keep, 2 = replace
    [Enum(UnityEngine.Rendering.StencilOp)]
    _StencilFail ("Stencil Fail Op", Int) = 0 // 0 = keep
    [Enum(UnityEngine.Rendering.StencilOp)]
    _StencilZFail ("Stencil ZFail Op", Int) = 0 // 0 = keep


    and then at the beginning of the lighting pass:

    Pass
    {
    Name "ForwardLit"
    Tags{"LightMode" = "LightweightForward"}

    Stencil {
    Ref [_Stencil]
    ReadMask [_ReadMask]
    WriteMask [_WriteMask]
    Comp [_StencilComp]
    Pass [_StencilOp]
    Fail [_StencilFail]
    ZFail [_StencilZFail]
    }


    i may add a general sss or transmission shader in the next upgrades.
     
  37. Vak_HD

    Vak_HD

    Joined:
    Aug 6, 2016
    Posts:
    11
    Thanks works perfectly now!

    Now I was wondering if it would be possible to add the Outline effect to a custom PBR Graph shader that I created in shader graph? I have a dissolve shader that I made and would love to be able to add the outline effect to the meshes that use it.
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    you can by adding the code from the post above.
    i assume it uses alpha testing... which is not supported by the outline shader (by design).
    here you actually have to use a full screen image effect.
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    Preview of a versatile subsurface scattering or transmission shader:

    Bildschirmfoto 2019-08-28 um 16.51.26.png
     
    GCat and Lars-Steenhoff like this.
  40. ActualStu

    ActualStu

    Joined:
    Jan 21, 2018
    Posts:
    2
    Hi, I was wondering if it would be possible to get an Unlit version of the Terrain Shader? I'm making a cartoony game and not using any in-scene lighting and this would be really useful for the terrain. Cheers.
     
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    well, then i would have to make an unlit version for pretty much all shaders i guess – which will take some time.
    meanwhile you can help yourself.
    just edit the terrain shader and find the block:
    half4 color = LightweightFragmentPBR(
    inputData,
    surfaceData.albedo,
    surfaceData.metallic,
    surfaceData.specular,
    surfaceData.smoothness,
    surfaceData.occlusion,
    surfaceData.emission,
    surfaceData.alpha);
    replace it with:
    half4 color = half4(surfaceData.albedo, 1);
    the shader compiler should strip (almost) all other lighting code as it never contributes to the final pixel.
     
  42. GCat

    GCat

    Joined:
    Jul 31, 2012
    Posts:
    174
    very nice work! only thing I can think of missing is a glass shader
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    thanks!
    glass is on the list :)
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    version 1.08 adding the transmission shader has been submitted.

    Transmission.jpg
     
    Lars-Steenhoff, GCat and osss like this.
  45. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    40
    Hi, I test the skin shader on Android, the Normal map bias option has visual artifacts. Other things work great.
     
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    thanks for reporting.
     
    Last edited: Aug 29, 2019
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    ah, sorry – i unpacked the normal using desktop code...
    a fix will come with version 1.08.

    meanwhile you can do it yourself. – forget it!
     
    Last edited: Aug 29, 2019
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    version 1.08 is available.
    it adds transmission and fixes the skin shader issue.
     
  49. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    40
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,966
    LWRP does not support multi pass shaders.
    but i think you can duplicate the material, assign the blend shader to the 2nd one and assign both materials to the hair mesh... both must receive shadows. the blended hair however will only receive shadows where there is something right underneath (like the alpha tested hair or the head).
    you may also edit the blend shader and add: ZTest Less to the LightweightForward pass. this will help to reduce the overdraw.

    the alpha testing shader uses alpha to coverage. combined with msaa x2 or msaa x4 it should already give you nice results tho.
    Edit: you will see the effect of alpha to coverage and msaa only in the game view.
     
    Last edited: Aug 29, 2019