Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Ok, i solved that dull water color with a simple trick. Since I don't use reflections because it kills performance on mobile, I added an else to the #if !defined(_ENVIRONMENTREFLECTIONS_OFF) condition
    and then plugged this code

    half fresnelTerm = Pow4(1.0 - saturate(dot(inputData.normalWS, inputData.viewDirectionWS)));
    half grazingTerm = saturate(smoothness + reflectivity);
    half3 reflections = _ReflecColor.rgb * lerp(specular, grazingTerm, fresnelTerm);
    // Combine specular lighting and reflections
    specularLighting += reflections; // This may give us way too bright reflections!

    Then I added ReflectColor as an input variable, and I set it to about 0.3 white. The result when I look back now is this:

    water3.jpg

    much much better this way. I don't know if you want to incorporate that code. I also added back the normal scale code, i don't know why you were not using it on mobile, it works just fine.
     
  2. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Another thing. I've just checked why some of my devices were running out of memory... surprise, the Lux URP tree bark and optimized leave... each of them take over 110 megas in memory. To give you an idea, the URP Simple Lit takes about 40 megas (And it's pretty horrible). Please check those shaders on Android, that doesn't make sense to run on mobile opengl3.
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    will send you a tweaked shader via pm
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    what is about ambient reflections? if you do not face the sun the water looks mainly comes from these.
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    try to comment:
    #pragma multi_compile __ BILLBOARD_FACE_CAMERA_POS​
     
  6. Adunato

    Adunato

    Joined:
    Nov 3, 2018
    Posts:
    28
    Hey Larsbertram,

    Firstly congratulations on this pack, I still can't believe that you packed all these high-quality shaders into a single asset at such a low price.

    I'm extremely happy with the results I'm getting with the skin shader, the best on URP I have seen by a long way.

    There is however one request, would it be possible to introduce alpha cutoff map for skin? This would be quite useful for clothing clipping.

    Thanks!
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    na, adding alpha testing is quite expensive as you loose early depth testing. best is to skip entire triangles.
    you could do this in shader using a mask. but most efficiently you would just edit the mesh and remove the triangles.
     
  8. Adunato

    Adunato

    Joined:
    Nov 3, 2018
    Posts:
    28
    Thanks, I was afraid you would say that :) but makes sense. I'll look for a geometry-based solution. Unfortunately, with dynamic clothing, editing meshes for each scenario is quite an overhead.
     
  9. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Here is a memory snapshot running on a samsung phone. My kindle crashes on out of memory errors. As you can see more than half the memory is dedicated to the shaders and about 280 megas are dedicated to the Lux shaders (terrain and tree creator). For comparison, the Simple Lit shader (which is horrible in memory too) is 37.5 megas (selected in the screenshot)

    memory.jpg
     
    Last edited: Mar 29, 2022
  10. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    This helped cut the shader in half size. Still, it's 50 megas each, that's about 140 megas total in ram just on 3 shaders. More than all my other assets combined.

    To me something is off. To give you an idea of the memory:
    Lux URP Water: 28 megas.
    Optimized Bark: 55
    Optimized Leaves: 57

    So the barks shader or leaves requires double the memory than the complex water?

    Also, what's the Lux Terrain Shader for? It seems it's a copy from the default Unity Terrain, or at least it keeps loading all the default Unity terrain shaders to add up to 70megas in shaders.
     
    Last edited: Mar 29, 2022
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    please look into shader variant stripping, shader variant collections and your build settings.
     
  12. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    I have all variant stripping, collections and all set up. Outside of the Lux URP shader, the largest shader is URP Simple Lit with 30 mb size. No other shader is even close to 5mb. Lux URP smallest one is the Water shader with 28 mb.
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    what are other shaders?
     
  14. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    I'm using the URP version of Lux Water (the river material), Lux Terrain, Tree creator for bark and leaves.

    All of them are over 30 mb after the adjustments from the private message. Without adjustments, they are over 120 mb. In total, they add about 150 mb after the improvements of removing pragma calls. Still, that's huge on mobile. My whole game is less than 150 mb in memory (meshes, animations, code and textures). The Lux URP Shaders are larger than all the assets combined in RAM. And Lux Terrain is calling all kind of default URP terrain info behind, so it's almost like loading the default URP shader twice.

    I'm sure you can fix this. For what I see, URP is a chitshow by default.
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
  16. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
  18. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Hi,

    I've just upgraded my project to 2021.2.17fa, URP version 12.1.6. I imported the 12.1 unitypackage, and a few of the shaders are failing to compile. I'm suing the clear coat, and amd getting Shader error in 'Lux URP/Clear Coat': 'LuxClearCoatFragmentPBR': cannot convert from 'struct SurfaceData' to 'half3' at Pass.hlsl(197) (on d3d11). Any ideas?
     
  19. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Try deleting the whole folder and redownload. I get no errors when importing.
     
  20. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    401
    I've also recently updated to 2021.2.17f1, URP 12.1.6, and ALL the Lux shaders just broke:

    eg:

    Weirdly, they worked just fine for a while, then I tried doing a build of the game and got that error with one of the shaders. I tried redownloading Lux, and at that point the whole thing blew up. LOTS of magenta going around now.

    EDIT: I'm... pretty screwed, frankly. Looks like the only option is to roll the entire project back to Unity 2020.

    EDIT: Or not! I wasn't able to figure out how to fix the meta pass, but since that's for GI (and I'm not using GI) I could just comment it out of the affected shaders. There was a further error lurking behind that one about AdditionalLightShadow taking five parameters instead of four, but I was able to fix that myself too.
     
    Last edited: Apr 2, 2022
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    i haven't tested 2021.17f1. but with 2021.14f1 they just work FINE!
    baking global illumination on a sphere using the flat shader does not produce any error.
    so i assume that you did not update the shaders using the included package for 12.1...
     
  22. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Hi creat327, not sure if this was directed to me but I've tried that and it's still not working. I have both the LWRP and URP folders in my project, tried deleting the URP folder and reimporting the 12.1 package but still getting the error
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    import the regular package and delete the shaders folder. then import the 12.1 package.
     
  24. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Thanks larsbertram1, if done correctly should I only have the URP folders in there, or the LWRP ones too?
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    only urp folders
     
  26. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    401
    No, I definitely did that. I removed the entire package (and URP) and reinstalled both fresh.

    I'm wondering now if it's the issue mentioned above with LWRP vs URP. Will check and update here.
     
  27. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Thanks, this worked!
     
  28. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    401
    Yeah, the errors are coming from the shaders folder, which is a problem because the shadergraph versions don't support wrapped lighting (which I use everywhere) or rimlighting (which I had customised to awesome effect:

    Transmission shader (looks a bit flat)
    1009085-13819e635fb17da4ab44a313827232bb.png

    Transmission shader with awesome effect (looks like an icky translucent spider leg):
    awesome.png

    Looks as though the only solution is to cobble together a custom version of the old shader outside of the Lux plugin.

    EDIT: Wasn't able to find a shadergraph version of the volumetrics, either, so if you want those, pull them down in the "shader" folder (they still compile okay).
     
    Last edited: Apr 5, 2022
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    delete the shaders folder and import the 12.1 version. it does not bring back all shaders tho as not all have been/will be ported to 12.1.
     
  30. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    401
    Yep, that's what I did. Then I realised that none of the shaders I actually use are in the 12.1 version (no wrapped lighting, no rimlighting on the transmission shader, no volumetrics) so I ended up back with my customised versions of the shader folder, manually patched up to work with the latest URP.
     
  31. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Having a weird issue with the Lit Extended Uber, it doesn't seem to read the metallic/roughness map. In the past I could just delete it and re-add it to the metallic slot, but even doing that it won't render it properly. I've also tried creating a new material.
     
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    works fin for me. and creating a new material should definitely work. the inspector might be a bit tricky tho as it only configures the material on change. but as you mentioned: reassigning the texture should trigger the setup.
     
  33. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Something is very wrong in the water shader when you run it on Oculus Quest VR. When I try it on PC, the VR works fine, but when you compile on Android for Oculus Quest, the water is nowhere to be seen. Not only that, it will also affect the trees and other rendering. The moment I remove the Lux URP Water, I get everything (trees, sky and so on), back to normal.

    I'm using Oculus Quest 2 compiled with OpenGL 3.0 for testing. On Unity 2021.2.19f.
     
  34. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Here another problem

    On an ipad, the objects are rendered like that. You get a "shadow" airplane on the water. I have a similar problem on Built In Lux Water but with the Y axis of that reversed.
    image0.jpeg
     
  35. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Hi, I've met some issues running lux with unity 2021.2's latest urp version 12.1.5, my lux version is 1.82, installed the urp 12.1 compatible package

    For the lux lit extended uber shader, there is an error:
    Shader error in 'Lux URP/Lit Extended Uber': invalid subscript 'tangentWS' at Pass.hlsl(66) (on d3d11)

    and the lux lit extended shader, there is this error:
    'UniversalFragmentMeta': input parameter 'metaInput' missing semantics.

    These shaders were running correctly with URP 11 back when I used unity 2021.1
    Then I upgraded my unity to 2021.2 along with the URP to 12.1.5, then I deleted old lux shaders and reimported the urp 12.1 compatible packages, still there are errors in the shaders. Any ideas how to resolve these?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    the old lit extended shader has not been ported to urp 12 and will be dropped most likely.
    strange, i do not get any errors. which features do you use on the uber shader? forward or deferred?
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    i have no idea what happens to your camera depth texture. why would it be dowscaled?
    have you checked the water in a simple new scene? i can not reproduce any of your issues here.
    any special settings you use?
     
  38. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Nothing. My camera is just a regular camera. It has nothing special. Is there a setting in URP to downscale or auto scale? Maybe the fixed dpi for auto scale resolution?
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    na, also your comments regarding lux water for the built in rp do not make much sense to me. if you look into the code e.g. for alpha blended particles which do softparticle blending against the depth buffer there is no flip y or anything like this. this all is more tha weird.
    not to mention that you are the first and only person to complain about this.
     
  40. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Well, I attached a picture. It's not like I'm making it up lol
    I really have no clue what's going on.
     
  41. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    I'm using forward rendering, the uber lit extended uber shader doesn't work correctly with specular-smoothness map, the data always get lost when I move my model in scene:
    upload_2022-4-15_14-39-21.png

    I can only make it render correctly by deleting the SG map from the material and re-assign it, then it'll look right:
    upload_2022-4-15_14-41-1.png

    But they'll revert back to the wrong rendering from time to time.
    And the only error I can find is on the shader:
    upload_2022-4-15_14-43-6.png

    it says the variable tangentWS is invalid in Pass.hlsl, line 66. But I can't find the shader file called Pass.

    And I tried to re-import the whole lux urp essentials, then imported the URP 12.1 package, it reported 22 errors. Almost every shader got errors on them. Is my importing process incorrect or what?
     
  42. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Edit: I tried another method: I deleted all files inside the Lux URP Essentials folder apart from the URP 12.1 package, then imported the whole 12.1 package with demo resources. Now there is only one error: the invalid tangentWS in Lit extended uber shader. Other shaders seems to work correctly. My unity version is 2121.2.14, would you please have a test in this version of unity and see if you can find the same error?
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    i tested it in 2021.2.14 and urp 12.1.5 already: no errors.
    the only pass that gets included and has something like "tangentWS" at/around line 66 is the DepthOnly pass.
    it compiles fine here in my side but looking into the shader code it looks a bit odd.
    so i did a quick pass over the pass and cleaned it up. works fine for me as well as you can see in the screen shot.
    attached you will find the modified "Lux URP Uber DepthOnly Pass" include.

    depthOnlyPass.PNG
     

    Attached Files:

  44. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    Ah thanks! This fixed my Lit Extended Uber's shader error. Stange things lol.
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    version 1.85 is available - it switches the entire package over to urp 12.1. so you have to import it using unity 2021.2 or above.
    i recommend to backup your project, delete the old Lux URP Essentials folder and grab the latest version from the asset store to make sure that you do not have any old files in your project.

    changes for URP 12.1

    ### Fixed
    - Uber shader: Fixed some keyword combinations and compilining issues, fixed inspector.
    - Cloth lighting HLSL: Fixed missing baked AO.
    - Cloth STL: Fixed DepthOnly and Meta pass.
    - Tree Creator Bark Optimized: Fixed missing support for Shader Model 2 (gles gles3 glcore).

    ### Added
    - Toon & Outline: Added shader to URP 12.1.
    - Fast Outline AlphaTested shader: Added option "Do not calculate width in Screen Space" which - if checked - will create outlines like the "Toon & Outline" shader that scale over distance. Needed and usefull in case you enable Depth Priming.
    - Fast Outline AlphaTested Double Pass shader: Added.
     
  46. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    862
    What's the standard procedure to import Lux 1.85 urp 12.1? Do I only import the URP 12.1 compatible package, ignoring all other legacy files and then import this URP 12.1 package alone?
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    backup your project, delete the current Lux URP Essentials folder, then grab 1.85 from the asset store and install it.
    after the install it is ready to go for URP 12.1. you do not have to install the included 12.1. package.
    deleting the old folder and installing the full new package will update all demos etc and make sure that no old file survives.
     
    Harekelas likes this.
  48. BurkhardK

    BurkhardK

    Joined:
    Jun 2, 2019
    Posts:
    7
    Hi,

    I am trying to use the LUX URP Terrain Lit shader and receiving the following build error:

    Code (CSharp):
    1. Shader error in 'Hidden/Lux URP/Lit (Add Pass)': Fragment program 'SplatmapFragment': Unrecognized sampler 'samplerunity_lightmap' - does not match any texture and is not a recognized inline name (should contain filter and wrap modes).
    2. at line 53 (on d3d11)
    3. ...
    4.  
    In Play mode everything is fine.

    Unity: 2021.3.0f1
    Lux URP Essentials: 1.85
    Universal RP: 12.1.6

    Do I miss something?
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,848
    not really. it should compile fine...
    i did a build test in unity 2021.2. using URP 12.1. and i did not get any error (this was with lightmapping enabled and disabled on the terrain using forward rendering and the provided "terrain demo").
    so maybe urp 12.1.6 has done some bad changes. maybe your shader cache in the library is not up to date or corrupted as you have updated lux urp essentials? or you have any strange shadervariant collections defined?
     
  50. BurkhardK

    BurkhardK

    Joined:
    Jun 2, 2019
    Posts:
    7
    I started a new project with Unity 2021.3 and imported 1.85 and had a bunch of error messages. Seems urp 12.1.6 has some bad changes. Can you confirm this and will you make a fix for this?