Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Lux-an-open-source-physically-based-shading-framework

Discussion in 'Assets and Asset Store' started by larsbertram1, Mar 19, 2014.

  1. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Also I can't make Post Processing Stack v2 compatible with Lux I've done everything you said in document step by step.

    Maybe it's because Post Processing Stack v2 shaders are not in the PostProcessing/Resources/Shaders anymore?
    I removed original ScreenSpaceReflection from PostProcessing/Shaders/Builtins folder then I add Lux ScreenSpaceReflection there and still not work.
     
    Last edited: May 25, 2018
  2. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395

    This is how I changed PP Stack V2. The AO, I didn't see any problems with it, it seemed to work out of the box. But the SSR did need tweaking in ScreenSpaceReflections.hlsl:


    You'll probably need to set the path to whatever you have for your project, this was custom for mine.


    Change that section like pictured.


    change those two sections, and finally, within the same function,


    change that.

    Since I'm messing with this today i'll take a look at Stochastic SSR too, if I can make it work, will post here later.
     
    Last edited: May 25, 2018
    Arsonistic, ksam2 and hopeful like this.
  3. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    For Stochastic SSR, edit SSRLib.cginc like so:

    (again you'll have to customize this path to your installation)


    Expand these two helper functions like so. That's it!
     
    Arsonistic, ksam2 and hopeful like this.
  4. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Thank you a lot, just it looks too dark and weird now! can you please attack the modified code too? Maybe I did something wrong.
     
  5. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    which modified code?
     
    ksam2 likes this.
  6. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Both :) :D I mean Stochastic SSR, SSRLib.cginc and ScreenSpaceReflections.hlsl.
     
  7. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    oh I get it, you want the code I modified. I was confused by 'attack', I think you mean 'attach' hah :)

    For Post Processing Stack v2 (latest version from GitHub)
    https://pastebin.com/RuZLWCEN

    For Stocastic SSR (latest version from GitHub)
    https://pastebin.com/51gYErPa
     
    ksam2 likes this.
  8. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    369
    Hello.

    I am very new to Lux. And I couldn't exactly justify using it. Please answer questions below so that I can understand more about it. The questions may not look new but I'd be glad if someone answers and help.
    1) How is LUX any better than the new Unity shaders?
    2) What LUX Pro does that LUX Free doesn't?
    3) Can "Shader Graph" be used with LUX?
    4) Can low-end mobile devices run a scene with LUX shaders smoothly?
    5) Kindly ask If someone could compare an object with LUX and the new Unity shaders* side by side. This way we can figure out more about the two shader frameworks.

    By "new Unity shaders", I mean the new shaders used in Unity 5.6, 2017.3 and newer.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    hmm, unity 5.6. does not ship with any "new" shaders as well as 2017 does.
    2018 brings the ld and hd rp and new shaders, but these are in "preview".
    so let's talk about the standard shader here.

    so compared to the standard shader lux offers features such as parallax occlusion mapping, mix mapping or dynamic weather. not to mention its lighting features.

    compared to the hd rp i guess there is only dynamic weather left... apart from the fact that lux supports unity's "standard" deferred and forward render pipelines and therefor is "production ready" whereas the hd rp is in "preview".

    nope.

    i doubt. but what is lowfy?

    Lux Plus does everything in deferred while Lux Personal falls back to forward when it comes to anisotropic, translucent or skin shading.
     
    imDanOush likes this.
  10. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    I'm using HBAO on its camera mode and it works good with Lux skin shader but after I assign Lux Plus Depth in the graphic section HBAO doesn't work correctly anymore. So what will I lose if not assign Lux Plus Depth in graphic section?


    Also strongly I request for compatibility with SEGI.
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    i will look into this once there is some time...
     
    ksam2 likes this.
  12. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    I am having a problem with fresh install of latest Lux Plus 2.02d on 2017.4.3f1 (latest LTS).
    Some shaders are outputting white or pink while others are working fine. Custom Shader/Reflection/DepthNormal is set to Lux Plus. Colorspace is Linear, Camera is HDR/Deferred.

    upload_2018-5-29_23-57-28.png
     
  13. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    upload_2018-5-30_0-22-47.png

    Just tested fresh install, properly configured Lux Plus 2.02d into 2017.3.1f1 and same result. I cannot move to 2018.x or 5.x due to compatibility issues.
     
  14. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I use Lux Pro on 2017.4.3f1 without any issues or modifications. Not sure why you're seeing that.

    Try selecting the shader files for the broken materials and right click, hit "Reimport". should either work or give you an error message as to why it won't compile.

    It's also possible it's not the shaders at all, and there's just some textures missing from the material. Kind of hard to debug without more details.
     
    ksam2 likes this.
  15. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    I don't know why it won't work right... not all the shaders are broken.
    Getting a lot of "cast not allowed" errors in the shaders that are not working.

    upload_2018-5-30_4-44-49.png
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    i haven't seen this before. and it works fine for me.
    have you tried a fresh install?
     
  17. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    Yes. I've tried a fresh install (Nothing else but Lux Plus 2.02d) on both 2017.4.3f1 and 2017.3.1f1. And they both have the same broken shader in that scene. These are untouched scenes. The only things I've changed is setting up the Custom shaders, taking off AA and setting Linear Colorspace.
     
  18. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    upload_2018-5-30_5-16-32.png

    Tried out Lux Free from UAS (not from Github) and I have just 1 broken shader.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    i will check this out.
     
  20. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    Thanks!
     
  21. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Yeah now that I think about it, I'm still using 2.02c, I never installed 2.02d for 2017 since it mostly just added support for 2018.
     
  22. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    For Science... I installed 2018.1.2f1 and tried Lux Plus 2.02d.... and boom... everything works perfectly....

    upload_2018-5-30_7-47-41.png

    Could we have a fix for 2017.x ? I can't really move to 2018 yet... although I think it's great that Lux Plus is now future proof...
     
  23. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    There are 2 new features which I am interested in.... and ATG support is the main reason I bought Lux Plus.... I already had Uber but I really want ATG/AFS to work well... and incorporating Lux seemed to be the best way to do it.

    Lux Plus Version 2.02d

    # Basic support for Unity 2018 added.
    # Fixed skin and anisotropic shading on Metal and OpenGLCore in Unity 2018.
    # Skin wrinkle maps shader added.
    # Support for Advanced Terrain Grass lighting added.
     
  24. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Yeah I know. I don't have ATG so it wasn't of use to me and the skin wrinkle maps, while nice, are far outside my budget. I can't afford to have someone sculpt a dozen expressions to make maps. (per character at that heh)
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    i found the bug: my way to differentiate between the unity versions could only handle 5.x and 2018, not 2017.
    so in 2017 the compiler choosed the 2018's path...

    you can easily fix this by editing the "LuxStructs.cginc" file.
    find line 99:
    #if UNITY_VERSION < 2018
    and change it to:
    #if UNITY_VERSION < 201810
    then reimport the buggy shaders.

    and update will come to the asset store soon.
     
    Kaen_SG and hopeful like this.
  26. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    upload_2018-5-30_19-36-39.png

    Worked! Like a boss! Thanks for the quick fix @larsbertram1 :)
     
  27. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    About SEGI actually everything works nice with Lux skin except reflections! even if I disable SEGI reflection still there is some weird reflection on the skin.

    Everything else from SEGI works normally with Lux. Only reflection problem.
     
  28. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Yes, you'd have to modify SEGI's shader similarly to how I modified the SSR shaders. Anything that makes reflections needs to get the normal and specular data through LUX's shader include.
     
    ksam2 likes this.
  29. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Modifying SEGI's shader for someone like me that doesn't know anything about shaders is impossible.

    Anyway I think PostProcessing Stack v2 still doesn't work correctly with Lux skin.
    Please look at below pic. I'm pretty sure that weird reflection stain isn't because of lighting! cause there is no light except a directional light.

    Delet.png
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    ssr does not work out of the box. you will have to tweak it.
     
  31. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    ceebee almost fixed that but there still some weird stains but a lot more less than default script.

    I think also SEGI has the same problem as ssr because all parameters works normally except reflections. even if you disable reflection from segi there is still weird uniform reflection on the skin caused by segi.
     
  32. xtreampb

    xtreampb

    Joined:
    Oct 21, 2017
    Posts:
    3
    So i'm trying to add wind to use this as a vegetation shader. Can anyone point me in the right direction? I saw the waving shader in the folder but i'm unsure as to how to apply this?
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    that is a simple grass shader for the terrain. in case you want bending you will have to write your own wind and bending function or buy afs or atg which both play nicely with lux :)
     
  34. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    My game going to release soon, SEGI support please :D I doubt if that a hard job to do because the only problem of SEGI and Lux is reflection problem, bad I'm too noob to fix it.
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    as far as i remember it uses forward rendering and a custom lighting function.
     
    ksam2 likes this.
  36. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    I have a primary specular map and a smoothness map that I need to use but seems Lux skin shader only supports a smoothness map! Where should I put my specular map?

    ceebeee
    It seems you're an expert at shader matters. Can you please take a look at SEGI to figure out why SEGI have reflection problem with Lux Skin shader? :oops:
     
  37. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Skin has a fixed specular given by the skin pss map.
     
    ksam2 likes this.
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    correct.
     
  39. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I can take a look, no promises. I thought SEGI was a paid package, but I see it's released open source now. Will have to check it out.
     
    ksam2 likes this.
  40. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I took a look, I don't really see anything wrong. I installed the latest SEGI, then installed LUX, set up it's replacement sahders. SEGI looks identical. I put in a cube with Lux's Standard shader, made it shiny, it looks ok.



    reflecting the water on the left, the grass on the right and the stones on the top, nothing looks bad.
     
    ksam2 likes this.
  41. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Thanks alot. Lux skin shader looks purple when SEGI is on (no cascade version).
    Thelebaron, had same issue.

    Even when you turn off SEGI reflection still in dark rooms reflections looks so bad and wrong. Like below pic.


    And when SEGI is off.

     
    Last edited: Sep 13, 2018
  42. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    ok yeah I didn't look at the skin. I'll give it another look.
     
  43. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Ok, I got it to work with SEGI, partially. The one aspect I can't figure out is SEGIs reflection setting. as you can see with Reflection on, it's has a hard chrome look on the shadowy side of the head.



    The head on the left is the Lux Skin Standard Lighting shader, and on the right is the LUX full feature Skin shader.

    if you turn off that Reflection setting, it looks a lot better:


    But you notice it's a bit dark stil, I found this is due to the sky color settings. if you tweak up the soft sunlight a bit, you get perfection:


    So I don't have a clue what is causing the harsh reflection, it may be in the compute side of things, or simply something I overlooked.

    You can get the modified SEGI.shader here: https://pastebin.com/0pT5hNhH
    As always you'll probably have to change the path to the Include to match your project.
     
    ksam2 likes this.
  44. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    An update, I found a way to get Lux to work *with* reflections enabled:


    you can see the blue rock and cube are reflective, but the skin looks fine.

    However, to do this, I had to modify part of Lux.

    in LuxUtilsDeferred.cginc, change these lines in GetLuxSpecular.
    Before:


    After:

    (you're basically copy/pasting the two lines right below exactly as they are.) With that change everything works.

    So I'm not sure if that's a bug in Lux or just some quirky thing SEGI requires.
     
    Baldinoboy, ksam2 and thelebaron like this.
  45. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Cool job man! Thank you a lot. :)
     
  46. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    Your shaders are useless. It becomes magenta, when I reimporting it becomes OK, but on click od model it becoming magenta again, and again, and so on...
     
  47. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    @larsbertram1 Hello I have a question is there option to add On/Off option of emmision to lux shader plus cause I understand than black = no emmission but unity don understand that and In Light Explorer, in static emmisives tab, and I cant turn it off cause it thinks that black is still emmisive. Second question is about lux plus and unity 2018.3 integration, will it work? :)
     
  48. joaobsneto

    joaobsneto

    Joined:
    Dec 10, 2009
    Posts:
    152
    Is Unity 2018.2.10 supported in the paid version? The free version is not compiling anymore.
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    haven't looked into the free version for a while, sorry. Lux Plus runs well.
     
  50. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I use Lux Plus on 2018.2.16, and it works fine. But it's no different than the free really, as far as code structure. Free should be working as well. You may have to manually upgrade some parts of the code, that's just par for the course with unity.