Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] Lux URP Essentials

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

?

Does Lux URP Essentials need a Discord Server?

Poll closed Apr 29, 2021.
  1. yes - even if there was no moderator

    4 vote(s)
    57.1%
  2. no, the forum is all we need

    3 vote(s)
    42.9%
  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    good question!
    unity seems to always draw the last (in this case: 2nd) submesh when adding the extra outline material.
    so if you have 2 materials and add 2 extra ones for the outlines, the outline will be drawn twice just for the 2nd submesh.

    so you can either
    1. split up the mesh into 2 meshes = 2 renderers = 2 game objects :(
    2. or merge the submeshes into one. then you "simulate" 2 materials by assigning vertex colors. so the body uses e.g. vertex color 0,0,0,0 while the head is set to vertex color = 1,0,0,0. in the pixel shader you do not sample texture2D but a texture array with 2 layers. which layer will be sampled is then determined by the vertex color. in shader graph this might look like this:
    Bildschirmfoto 2019-09-16 um 08.42.39.png

    if you do not want to add vertex colors to the mesh (as they will make the mesh data a bit fatter) you could also use different uv shell positions to determine mat0 and mat1: just put the uv shell for mat1 into the negative uv (u) space and keep the shell of mat0 in the positive space.
    the get the index by using: float index = (uv.x < 0) ? 1.0f : 0.0f;
    please note that this needs the uvs of mat 1 always to be smaller than 0.0.

    in shader graph this might look like this:

    Bildschirmfoto 2019-09-16 um 09.07.03.png


    in order to create the texture arrays you may use this free tool from the asset store:
    https://assetstore.unity.com/packages/tools/utilities/texture-array-inspector-109547
     
    Last edited: Sep 16, 2019
  2. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    27
    i will try, thanks:)
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    you are welcome.
    and let me know if you run into any trouble.
     
  4. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    27
    it works.:cool:
    20190916161605.png
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    which method did you chose? vertex colors or uv shell positions?
     
  6. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    27
    vertex colors
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    you should give the uv shell position method a try some day: the size of the mesh data in this case will just be the same as when using two materials.
     
  8. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    27
    ok, i will try uv shell position.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    Version 1.121 is available!

    ## Version 1.121
    ### Added
    - Toon outline shader: Added option to scale outline width by object size.

    ## 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.
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    which transparent capsule looks most convincing (from left to right: 1, 2, 3 or4)?

    Bildschirmfoto 2019-09-17 um 17.18.33.png
     
  11. osss

    osss

    Joined:
    Jan 20, 2014
    Posts:
    27
    2 and 4.
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    initially i thought 2 as it receives proper shadows at the surface of the capusule.
    3 simply fetches the screen space shadow map so it receives shadows from the background which looks pretty weird under certain viewing angles where the specular highlight e.g. suddenly vanishes.
    1 and 4 do not receive any shadows.

    but if you think of tinted glass none of them matches...
    it should like the capsule in the middle where the green color of the glass darkens the background but does not hide it (like on the capsule on the right):

    Bildschirmfoto 2019-09-18 um 12.53.01.png
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    here is a comparison of more transparent glass like materials using different approaches.
    simply turning on "receive shadows" on the standard lit shader (3rd from the left) actually is no option.
    we would need a depth pass only shader (introducing new artifacts tho) or have to sample shadows properly (line in the 1st and 2nd capsule) – or go without any shadows (4th).

    tinted_glass.png

    the 2 materials used by the 1st capsule needed to tint the background properly do not really shine in the screenshot above. for this reason here another one from the reversed camera direction:

    Bildschirmfoto 2019-09-18 um 13.19.27.png
     
    osss likes this.
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    I submitted Version 1.13

    ### Added:
    - Glass shader: Proper shadows added for directional lights. No depth write only object needed anymore.
    - Custom node for Shader Graph added: Transparent lighting (the ones discussed above)

    ### Changed

    - Documentation of how to setup complex glass materials. Please visit it again.
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    Version 1.13 is available!
     
  16. Knele

    Knele

    Joined:
    Nov 5, 2018
    Posts:
    2
    Hi, I just purchased the asset and first of all want to thank you for all your work.
    I have a question though: did you bake the skin mask/thickness/occlusion map yourself and how would i do that?
     
  17. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    Probably a really stupid question, but do these work on iOS (and eventually the iPadOS)?
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    you can use substance painter or xnormals to bake a thickness map.
    another common trick is to invert the normals and then bake classic ambient occlusion.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    both platforms are supported: it is LWRP.
    but of course some shaders are more heavy than built in lit (clear coat, ggx aniso, ...).
     
  20. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    Thanks! Purchasing now...
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    i started to work on the tree creator shaders which simply are not supported by LWRP or URP at all.
    so i ported the old style lighting features to LWRP and slightly improved them: additional lights now fade in over the billboard fade distance, specular lighting picks up light color and attenuation. more to come.
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    this one is rather tricky but i hope i will add support for the tree creator shaders soon.
    billboard transitions and all the bending already work so i hope it is just a matter of time:

    Bildschirmfoto 2019-09-20 um 22.33.17.png
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    upcoming version 1.14 will add support for single pass stereo rendering and shaders using the camera depth and opaque texture such as water, glass, particles and decals.

    Singel_Pass_Stereo.jpg
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    Fix will come with version 1.14.
     
    Dark-Table likes this.
  25. Dark-Table

    Dark-Table

    Joined:
    Nov 25, 2008
    Posts:
    315
    @larsbertram1 Thank you. I really appreciate you fixing the LWRP VR issues.
     
  26. Dark-Table

    Dark-Table

    Joined:
    Nov 25, 2008
    Posts:
    315
    RE: getting a model with multiple materials to render with an outline.

    I've had success using the Custom Forward Renderer feature in the more recent LWRP versions.

    They demo the technique in this video (around 13 minutes in):


    Basically you can easily create a custom renderer that applies to objects on a specific layer and performs an additional shader pass on them. I've been using it to apply outlines, xray and rim lighting effects to objects.
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    that involves a full screen image effect (sobel filter) and will be more expensive than just drawing the object twice.
    however – this will let you get proper outlines even on alpha tested geometry and smoothed geometry.
    so it is up to you.
    the included outline effect is way faster.

    edit: from what got from the arm dev site: adding a new "pass" will cost you a full local to shared and shared to local memory copy which may be quite expensive.
    applying outlines within the same pass simply using the stencil buffer therefore should be way faster and less energy consuming.
     
    Last edited: Sep 22, 2019
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    Version 1.14 has been submitted:

    ### Added:
    - Added Single Bass Stereo support for shaders using the camera depth and opaque texture.
    - Tree Creator shaders added.
     
  29. Dark-Table

    Dark-Table

    Joined:
    Nov 25, 2008
    Posts:
    315
    I think we're talking about different implementations. I'm using your outline shader, but I'm only applying it to objects on a specific layer. The object gets rendered twice, first time is the normal pass with the Lux/Lit Extended shader and the second is with the "Depth Culling Outline" shader.
    outline.png
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    that sounds performant :)
     
  31. Dark-Table

    Dark-Table

    Joined:
    Nov 25, 2008
    Posts:
    315
    @larsbertram1 BTW, I love the stencil buffer stuff exposed in the Lit Extended shader. Before I got this asset I was using an empty shader that just wrote to the stencil buffer.
     
  32. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    Apols, newbie here. Is this the view from a Windows PC, 'cos if it is then you have a new customer
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    yes, vr rendering is from windows 10 and oculus perspective.
     
  34. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    Thank you Lars. Will this work using the Mock HMD option in the XR Settings?
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    what is that?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    Version 1.14 is available:

    ### Added:
    - Added Single Bass Stereo support for shaders using the camera depth and opaque texture.
    - Tree Creator shaders added.
     
  37. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    It is in the XR options for Unity that gives the side by side view:
    upload_2019-9-24_23-40-18.png
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    i only have oculus on dx11. and it does not offer such option.
     
  39. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Congrats to @larsbertram1 for Lux LWRP's mention in a Unity email ad I received today. :)
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    thanks! how does this email look like?
     
  41. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    that works, thanks!
     
  43. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    Hi Lars,

    OK, I may just have to bite the bullet and get this asset and just see what happens. :)
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    let me know how it works.
     
  45. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    I'm away from my development system but will give you an update in the morning.
     
  46. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    OK, got the shader.
    Can I confirm whether the distortion and sbs display was created by your shader or from the Oculus component built into Unity?
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    Version 1.15 is available:

    Added

    • Package containing tweaked shaders for URP 7.1.2.
    Fixed
    • Albedo meta pass for Clear Coat shader graph fixed.
    • Tree creator lighting fixed.
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    Looking into spot light cookies:

    Bildschirmfoto 2019-09-26 um 15.18.57.png
     
  49. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    So that's a no then. Ah well, back to Reshade and Depth3D
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    oh, i missed your last post and this one.
    actually i do not really understand what kind of distortion you are talking about?
    regular objects (all opaques e.g.) use the built in single pass stereo rendering functions while i only added special support to the shaders which need to sample from the camera opaque and/or depth texture like water or decals.
    i checked it in 2019.1. and 2019.3. beta and i can not see any distortion...