Search Unity

[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,900
    this is how it looks like in 2019.3.0b4 (windows 10, oculus rift):

    oculus_2019.3.PNG
     
  2. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    Hi Lars,
    I get that too when I use the Mock HMD option in "XR Settings" and selecting "Occlusion Mesh" within Unity.

    However, i was hoping that by using your quite brilliant shader within Unity that we could produce an output such as this when "Mock HMD" is selected:
    upload_2019-9-26_20-0-50.png
    in a similar way as to what Reshade produces. However, Reshade works outside of Unity and needs to point to the Unity produced build.exe in Windows.
    I was hoping that your shader could produce the same but from inside Unity and appear in a Windows project build.

    Oh, and thank you very much for replying :)
     
    Last edited: Sep 26, 2019
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    but i still not really get the point here, sorry.
     
  4. JerseyFlymo

    JerseyFlymo

    Joined:
    Jun 8, 2017
    Posts:
    15
    No problems.

    I am trying to create a SBS view with the barrel occulsion from within a Unity project so that when a build is created to run on a Windows desktop it retains the 'binocular' style view as above.

    Hope that helps :)
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    I submitted Version 1.16.
    ### Added:
    - Procedural stochastic and procedural sampling node for shader graph.
     
    Lars-Steenhoff likes this.
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    version 1.16 is available.
     
    Lars-Steenhoff likes this.
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    and this shows what procedural (stochastic) texturing does:

    procedural texturing.jpg
     
    pixelR, osss, Dark-Table and 3 others like this.
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i am looking into flat shading right now – which should give you some nice memory and bandwidth improvements:

    flat shading.png

    the used method the recalculate the normals however does not let us "create" quads. lighting instead will always reveal triangles.
     
    Last edited: Sep 30, 2019
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    here you can see the shortcommings:
    no quads on the right with per pixel recalculated flat normals – as the shader of course operates on the final geometry (triangles)

    Bildschirmfoto 2019-09-30 um 17.43.24.png
     
    Quique-Martinez likes this.
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,524
    I like the triangulated look
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    thanks lars!
    but in case you tweak your geometry and provide planar quads you may even get quad based lighting – just not as simple as using hard vertex normals. not really needed on most of your meshes anyway.
    you will find details in the docs.
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i have submitted version 1.17 which adds flat shading as HLSL shader and lighting node for shader graph.
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    version 1.17 is available.
     
  14. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Hi,

    We're using your refraction shader (which is lovely by the way!) but we're running into an issue with depth of field. From what I understand this is a fairly common issue, where the transparency pass is rendered before the DOF pass and not after, which is causing the refractive material to blur with the DOF. I was hoping you'd be able to point me in the right direction as to where we can tell the shader to render after the DOF/PP. I've tried disabling the ZWrite in the shader, as well as the various settings in the render queue, but nothing seems to work. None of us here are particularly confident with shader programming, so any guidance would be appreciated!
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    thank you!
    i would expect the transparent material to be included in the effect – why do you want to exclude it?

    i did a quick test (actually i never used DOF with LWRP before as it is quite heavy) and it looks as if DOF takes the depth buffer like in its state right after all opaque materials have been rendered aka _CameraDepthTexture – which makes sense, as you do not want to copy the depth buffer over and over...
    So making the glass material writing to depth or not does not make any difference as far as DOF is concerned. It makes sense for glass and all other transparent passes tho.

    Refractive glass and DOF
    Notice the different blur on the glass where the geometry behind it is rather far away (pretty blurry glass) and where is rather close (red cube: less blurriness).
    I guess this is the problem you are talking about.

    Bildschirmfoto 2019-10-01 um 20.37.28.png

    The solution
    In order to make the entire glass show up proper blurriness according to its distance to the camera or depth we have to make sure that it writes to depth during the opaque pass and before Unity grabs the _CameraDepth Texture. But as we want glass to refract the background we need the _CameraOpaqueTexture which means that glass has to be rendered on the transparent queue.
    Luckily Lux LWRP comes with the "Depth Only" shader.
    So simply create a new material using the Depth Only shader and apply it as 2nd material on the glass geometry.
    This will make sure, that the glass geometry actually writes to the depth buffer already during the opaque passes and will be seen by the DOF effect.
    The transparent glass material which renders later on the transparent queue uses ZTest LEqual (less or equal) – and as it should have equal depth it will render even if there is something in the depth buffer already at exact the same position.

    Refractive glass and DOF – using 2 materials and the Depth Only shader
    Now the entire glass surface shows up a proper blurriness. The glass plane on the right still bugs as it does not use two materials.

    Bildschirmfoto 2019-10-01 um 20.39.20.png


    i hope this solves your problem.
    please let me know.

    P.S: i will add it to the docs.
    P.P.S: refractions in the glass of course will not be blurred :( as they are taken from the _CameraOpaque texture – a snapshot which is taken right after the opaque pass.
     
    Last edited: Oct 1, 2019
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    dear customers,

    i hope you all enjoy your purchase of Lux LWRP for which reason ever.
    but as we all live under the dictatorship of likes and dislikes and public performance ratings i would like to encourage you to leave a review on the asset store.
    i hope it will be a positive one :)
     
    tehusterr, Dark-Table and neoshaman like this.
  17. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Amazing! Works great, thank you for the help and write up - very informative!

    Just to let you know, once I'd assigned the Depth Only material, I had to disable then re-enable the refractions on the Glass material (via the Enable Geometric Refractions tickbox) - don't know if that's something unique to our setup, but thought you might want to know if you're going to update the docs :)

    Thanks again!
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    you are welcome.
    i have not come across this problem yet – but i do know something similar from the built in lit shader: whenever i change a feature (like adding a normal map) i have to toggle "enable gpu instancing" to make it work.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i wonder if anybody here actually uses unity's built in terrain.
    and if so under which conditions? like (level) size, resolution, number of detail layers, target platforms ...
    what features/shader do you use right now and what would you expect from a Lux terrain shader?

    i am playing around with a terrain shader right now but i am not sure what to prioritize: support for gles 2.0? only metal, gles 3.0 and vulcan/dx11?
     
  20. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    282
    I think gles 3.0 should be better, 2.0 is going extinct
     
    pixelR likes this.
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i submitted version 1.18 which adds none alpha testing grass and foliage in case you go with a more stylized style and improves performance.
     
    Lars-Steenhoff likes this.
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    thanks. but i will start with a pretty simple version i guess.
    and get the damned bugs out of the terrain shader first.
     
  23. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Mali 400 phone are still plenty and gles 2.0
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i will do an old school first pass/add pass solution first and take the texture limit into account.
     
    neoshaman likes this.
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    version 1.18 is available.
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    this is the first iteration on the terrain shader – height blended parallax mapped terrain with holes (unity 2019.3. only) and alpha blended meshes:

    terrain_blend.gif

    blend details:

    beldn details.jpg
     
  27. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Where does one active MSSA in Lux?
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    msaa has to be activated in the pipeline settings.
    but it only works in game view afaik.

    Bildschirmfoto 2019-10-12 um 13.21.12.png
     
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i submitted version 1.19 which adds the terrain shader and terrain blending shader (experimental).
     
    Rowlan, osss and Lars-Steenhoff like this.
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i am looking into udk based light shafts and stylized rendering right now.
    but unity's progressive light mapper drives me crazy (so i went with enlighten here).
    lwrp and urp shadows do so as well: no chance to get "clean" shadows on hard edged geometry – unless you use specially tweaked shadow caster only geometry. Otherwise i get a lot of shadow acne.
    the camera uses vignette and bloom.

    beams.jpg
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    shadows casted by shadow caster proxies (with smoothed normals):

    Bildschirmfoto 2019-10-13 um 22.33.03.png

    shadows casted by the visible geometry (hard edges):

    Bildschirmfoto 2019-10-13 um 22.33.34.png
     
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    now there is. but it is flagged as experimental...
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    playing around with custom shadow bias on hard edged geometry:

    shadowbias_test.gif
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    version 1.19 is available.
     
  35. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Hi, @larsbertram1! I'm trying to make a make up bottle and after a bit of experimentation have come up with a look I like for the glass. However, when I add the internal opaque geometry I get this unwanted artefact (circled in black) which I suspect is coming from the geometry circled in white. Is there any way to get the shaders to just exclude/ignore this mesh? I've tried ticking the Exclude Foreground checkbox but this doesn't seem to do anything.
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    "exclude foreground" only excludes object which are in front of the refractive glass (and will cause gaps in the refraction...).
    hmm, i can not see any geometry in the white circle...actually i can not see any red geometry like in the refraction at all. but try to play around with "Index of Refraction" and "Thin Shell".
     
  37. Blarghle

    Blarghle

    Joined:
    Aug 19, 2014
    Posts:
    19
    Hi guys, I'm experiencing some weirdness with the decal shader. When the camera gets close to it, I get some weird striping and moire effects. Any idea what could be causing this to happen? Interestingly, the stripes turn white as the smoothness value approaches 1. This issue also seems to increase the farther away from 0,0,0 I am in world space. Is this a float precision issue?
     

    Attached Files:

    Last edited: Oct 18, 2019
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i have not been able to reproduce these.
    do you use some special camera settings like near and far clipping plane?
     
  39. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    @larsbertram1 Would you be able to add tinting to the grass shader?
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    random tinting between 2 colors?
    it is possible but not very efficient doing "nice" random stuff in a shader such as the grass shader.
    sampling a noise texture in the vertex shader?
    actually calculating noise in the shader itself? even more expensive!

    the shader is not really meant to be used on large and dense fields of grass (although one might do it you combined it with a good gpu cpu driven solution) so i personally think it is not that important, is it?
    maybe you can share some screen shots from your current scene?
     
  41. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    I was trying out a stylized open world package and thought to switch the grass shaders over to lux lwrp grass and then going through to GPU Instancer for large and dense fields. But I have other options. The main idea was for me to try using as many lux shaders as possible - to guarantee that all my shaders will work well together and are coded by someone who knows their sh*t ! :) The end result I want is density, shadows, wind movement, with a stylized look. I'm using URP on 2019.3b7 Would you recommend i use another grass shader for this type of look?
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    basically no.
    the shader works well with gpu instancer which gives you a nice speedup as far as cpu usage is concerned.
    nevertheless "large and dense fields" need a lot of instances --> lot of memory in case you do not use any semi procedural approach. minimum would be position (vector3) and quaternion (vector4) per instance = 28 bytes. directly usable a matrix4x4 = 64 bytes. but gpu instancer will keep the original game objects alive afaik and these are quite many in case of grass.
    not to mention the editor where the grass actually is just a vast amount of game objects with transform, mesh and mesh renderer components: so a field of 500x500 meters densely filled may easily need 50, 100, 200 MB?!
    i guess this is the key question here. and it is not only about random/procedural tinting but lighting.

    so if you can give some reference of the desired look we can go further.
     
  43. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Ouch, yeah, 200MB for 500x500 won't work well for iOS or TVOS, I imagine.
    I guess I'm after something a bit painterly. My reference would be something like Legend of Zelda: BOTW though something more typically low-poly would also be fine.



    Procedural would be good. Looking at the above image, you can see the blades of grass in the foreground but aside from that the grass just looks like an animated grain/noise layer - would a technique like that make it feasible to cover my 4096x4096 terrain? :)
     
    Last edited: Oct 20, 2019
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i thought so :)
    you may try the grass shader and deactivate "alpha clipping". this will save a lot of overdraw but needs you to actually model the grass blades... have a look at the vegetation demo scene.
    for a terrain of this size you need some semi procedural approach. so it would be gpu instancer's terrain grass shader or how ever it is called. and before going crazy: just use gpu instancers built in shaders and see how it performs on your target devices.
    then we can have a look into replacing gpu instances shaders with the lux lwrp grass shader (if needed).
     
    Lars-Steenhoff and transat like this.
  45. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Extreme procedure for grass, ... use interior shader, but instead of wall, you have the grass texture, you are obviously limited to square silhouette (up until I find a new algorithm), but it might be just enough to give illusion at distance as LOD, which leave you to pack the close ranges with actual model. Since it's fragment based, you can have infinite (really just the screen resolution) grass blade by cranking down the space between "wall".
     
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    na, i don't think that it will give you the look people are looking for :)
    screen spaced grass never really made it to the point where it was able to replace geometry afaik. still an interesting approach for very special use cases.
     
  47. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    NOT screen space, and only distant grass. But yeah, I said it's extrem(tm) :D
    though I should do a demo next time I raised that point, so I said nothing :p
     
  48. Blarghle

    Blarghle

    Joined:
    Aug 19, 2014
    Posts:
    19
    Not really, my near is .03 and far is 30000, though I lowered that down as far as 100 and didn't see a difference in the stripes.
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    lol, that IS extreme!
    take standard which is 0.3 (one digit less) and 1000 (again: one digit less).
    anything above 9999.999 will lower the precision after the period.
    at 30000 everything should go crazy: graphics and physix.

    have you checked the included demo scene?
    have you gradually increased the camera near and far clipping planes in this scene?
     
  50. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    @Blarghle Does playing around with your lighting settings change your moire pattern? Try the bias settings. With URP you might also need to check for those settings on the lights themselves or in your srp profile.