Search Unity

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

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

  1. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    What are the script errors? Or do none show up? if the script is erroring out on something like "Editor namespace doesn't exist" or something similar, this maybe because it's trying to compile editor scripts for a game build... :D
     
  2. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    this is the only message i have on building project in 4.6 unity
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @zelmund: did you get the latest version from the github repo?
     
  4. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    on github - no. i got version from asset store. will try github version and reply.
     
  5. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    got version from https://github.com/larsbertram69/Lux
    seems all ok now. shaders working and project builder dont show any errors. thx for advice.

    asset store version is broken and cannot be build on unity 4.6
     
  6. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    216
    Will this work on 5.3 ?
     
  7. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Wat is the interest instead of using Unity 5.3 official supported PBR shaders wortking with Enlighten ?
     
  8. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Better not use it at all
     
  9. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I guess that depends if the current (and quite weird...) lighting changes affect this by any measure. I say make a test scene, and if worst comes to worst, don't upgrade your project to 5.3. ;)
     
  10. Klein97

    Klein97

    Joined:
    Jun 3, 2015
    Posts:
    1
    Hi, please help me. How to lock Snow amount.
    I need to start with the amount of snow is not accrued , and what was so important in the inspector.
     
  11. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Are there any advantages or disadvantages to using Lux in Unity 5.3 instead of standard shaders?
     
  12. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Yes just one advantage! you can't change vertex color in Lux:D
     
  13. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Unity standard shaders uses now GGX and they are now same as the PBR you paint in Substance Painter for example.Why would you use a non official PBR system, not supported when Unity gives you the shaders out of the box ?
    Unity shaders works with Enlighten and all features aounrd like reflection probes.
     
  14. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Performance would be a deciding factor. If I could get better performance with a non-official solution and that solution was also compatible with Unity lighting systems then I would switch. When developing for a console like the Wii U, performance is a huge concern.
     
  15. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    There is other ways like LOD, Designing the levels in a way Umbra will do lot of culling.
    When i tried to use Lux i didn't find it specially fast rendering, you'll have to test it yourself with a same level and materials running with Lux and test it with another Unity 5 version with standard PBR shader.
     
  16. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Of course. I use all those techniques. I just happened to see Lux and thought I'd propose the question to users of Lux whether it had certain advantages or disadvantages. I did a short test of lux versus standard and it seemed equivalent, but without more comprehensive testing I wouldn't know for sure. I don't really want to engage in extensive testing so I was hoping someone had some definitive answers who was experienced with both.
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    if you address low level hardware and can not afford unity's fat gbuffer layout lux might still be a way to go.
    in this case it would be legacy deferred rendering and faked fresnel...
    otherwise i would suggest to go with unity's deferred shading and the built in lighting.

    lars
     
    theANMATOR2b likes this.
  18. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks for the info. I'll work with standard shaders.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    Hi there,

    Lux 2.01 is just around the corner:



     
    elias_t, nxrighthere, hopeful and 4 others like this.
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hey guys,
    do not only "like" the post. answer it, post your experiences, wishes or findings.
    how else should i do any further development?

    lars
     
    Alverik likes this.
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    btw.

    lux 2.01 supports:
    - standard, translucent and anisotropic lighting.
    - vertex color or texture input driven mix mapping
    - parallax and parallax occlusion mapping
     
    Alverik likes this.
  23. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    WHOAOH.
    Da heeel did dis come from?! :D

    Looking good! When I finally have a project that would benefit from PBR, I'll give this a go.
    It has most definitely evolved from when I last used it back in unity 4.x ;)
     
  24. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    Has @hippocoder seen this yet? IIRC, he was interested in something like this not long ago. If so, he might have some input.
     
    hippocoder likes this.
  25. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Argh! I started work on a project a few months ago and decided to use Uber shaders, but if I'd known Lux was getting a 2.0 release (with the exact features I needed) I would've waited, I loved working with the first version of Lux!

    Just a question @larsbertram1, does Lux 2.0 have the same builtin toggle for switching to the Cook-Torrance visibility term?
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    lux 2.01 uses the built in ggx – which more or less is standard these days in most engines.
     
  27. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Hey Lars,
    Can't post my experiences because I haven't had time to look at it, I'll probably take a look this weekend. But it looks awesome to finally have weather built into a pbr shader.

    My #1 wish for a shader the past year has been
    A refraction shader that supports SSR preferably using a reflection probe as fall back when the screenbuffer fails. Both ice, glass and even water would look awesome like that. But please finish this release before you start working on that.
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hmm, refraction shaders usually use a grab pass. and it should be easy to make the refraction always be read from uvs inside the 0-1 range.
    and refractions from e.g. a glass might be very sharp. so using a "blurry" reflection probe combined with pixels from the grab pass will most likely do not look very convincing i guess.
    but may be i do not really understand what you are looking for?
     
  29. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,438
  30. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    I meant proper refractions with a grab pass, and then screen space reflections on top just helping the screen space reflection by adding the sky and stuff like that from a reflection probe. So that looking down on a reflective surface will give you the sky rather than nothing.
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    well, that just should work out of the box in case you use pbs...
     
  32. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    I haven't seen any refraction that works with ssr.

    What refraction shader should I use?
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    well, i had no special shader in mind :) i simply thought: in case you have a refraction shader that uses the transparent queue but in fact is opaque and writes to the z-buffer it might be seen by ssr.
    but ssr is rendered before transparent. so we would have to choose a lower queue – which works except fro ambient reflections which are rendered when doing the grab pass :-( like shown in the image below:

    grab texture misses ambient specular reflections, so high reflective material are simply black.
    Bildschirmfoto 2016-05-03 um 20.19.16.png
     
    FuzzyQuills likes this.
  34. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Other than the odd mess from the pass ordering issues, that's looking nice! :) Good job!
     
  35. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Just saw in the documentation that Lux will have a Pro version on the store - that's great, but it means I probably won't take a look at Lux until I can check out the Pro version - any idea when it will be available?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    well, i do not think that you will have to wait for pro to be available as the free version offers all features like area lights, translucent, skin and anisotropic lighting, diffuse fill lights, dynamic weather, mix mapping or pom. the only difference: free renders translucent, skin and anisotropic lighting in forward, pro in deferred.
    so upgrading more or less just means swapping out some shader include files and recompile. even custom written surface shaders will simply work.
    right now i have no idea when lux pro will be available – but i hope within the next weeks.
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    Overview about some more features of Lux:

    01_lux_area_lights.jpg

    02_lux_translucent_lighting.jpg

    03_lux_anisotropic_lighting.jpg

    04_lux_skin_lighting.jpg

    05_lux_dynamic_weather.jpg
     
    Alverik, thieum and nxrighthere like this.
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
  39. looki666

    looki666

    Joined:
    Sep 5, 2013
    Posts:
    79
    How to add UniqueShadows support from unity Blacksmith demo ?

    Oh , almost forgot , there is some memory leak in the package , usage jump from 3GB to almost 16 GB when opening StandardShader scene and DynamicWeather scene an then Crashes with OutOFMemory error .
     
    Last edited: May 5, 2016
  40. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Yeah. Have not messaged yet about this but realized this recently. Pretty sure it is the cause of the freezing I am having. Checked the control panel and it showed RAM at 100% with 16gb. Does not crash with errors but I have to kill the Unity process to use my computer.

    What version of Unity and OS are you using looki666?
     
  41. looki666

    looki666

    Joined:
    Sep 5, 2013
    Posts:
    79
    Windows 7 , latest Unity 5.3.4 patch 5 ,. Have got 32GB of Ram , but it start eating all free Ram and crash.
    Tested with clean project and it also crashes .
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i haven't looked into this so far. i may do this later though.
    doesn't it work out of the box? right now i can't remember how it was implemented...
    i can't (entirely) confirm this. i get up to 7GB if not all shaders are loaded but some still compile.
    when done it is pretty stable at around 4.7GB (win 10, unity 5.3.2., dx11).
    nevertheless it is very memory consuming... at least in the editor as unity does not seem to handle unused possible shader variants properly – and lux might produce several thousands of those for each shader.

    the only solution i am aware of would be to use less variants by e.g. always sampling the normal map no matter if you have assigned one or not.
    another solution would be to only import the shaders you need or would like to test.
     
  43. looki666

    looki666

    Joined:
    Sep 5, 2013
    Posts:
    79
    The problem is the leak occurs even when creating new material and selecting shader , for example FullFeatures one with no maps assigned .

    Link to UniqueShadows : http://blogs.unity3d.com/2015/05/28/unique-character-shadows-in-the-blacksmith/

    "From the Readme file :
    ### Shader support, you say?

    Yes, the materials used for unique shadows do need to a use a shader that has been prepared with support specifically for this feature.

    Although the specifics might depend on how esoteric your shaders are, most shaders can be unique shadows enabled simply by adding these two lines:

    #pragma multi_compile _ UNIQUE_SHADOW UNIQUE_SHADOW_LIGHT_COOKIE
    #include "Path/To/UniqueShadow/UniqueShadow_ShadowSample.cginc"

    This works both for surface and vertex/fragment shaders. Note, however, that the include needs to go above the include of any other builtin Unity include files."

    I have tried to do this with StandardSkinShader - the simple one and it works , but dont work with shaders with subshaders with Passes like LuxStandardTranslucency . I am no shader programmer , so its probably something simple to do :) .
     
  44. VertexSoup

    VertexSoup

    Joined:
    Nov 25, 2014
    Posts:
    44
    Hi lars,
    just noticed on screens does area light not have proper cull when viewed from back? I suppose this is bug or not yet implemented feature. It is visible on floor when you rotate camera and get to back of light that light reflection is still visible even if you are looking from behind light. (The post where you show 2 videos sneak peak of v2)
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi there,

    in order to address the memory consumption problem i have a) disabled the originally automatically multi compiled fog in forward rendering and b) generally enabled normal mapping.

    a) Lux standard shaders now support exponential squared fog in forward by default. in case you need other fog you will have to edit the "Lux Config.cginc" file and enable the desired fog mode.
    b) As such complex shaders like the Lux standard shaders most likely will always use normal maps i think enabling normal maps generally should be fine. There might be a few materials which would benefit from dynamically enabled/disabled normal mapping but i am pretty sure that this is negligible.

    so with these changes memory consumption went down from 7.4 GB to 2.4 GB for the whole project.

    lars
     
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i guess i do not understand what you mean... sorry. could you make a screenshoot showing "the problem"?
    please note: not all lights in the video cast real time shadows as far as i remember.
     
  47. VertexSoup

    VertexSoup

    Joined:
    Nov 25, 2014
    Posts:
    44
    My bad, I did not blew up video. Just realized they (lights) are actual 3D objects. I did not noticed that on small video player. I was thinking they are planar objects :p All good Lars. So far I like all your work. I'm using new account now, previously aka cupsster (you maybe remember from time when we competed in trees when there were no trees on store :D) Cheers, keep up good work.
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i remember! and was wondering where you were all the time. now i know :)
     
    VertexSoup likes this.
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i just gave it a go and it turned out to work straightforward.
    all you have to do is to define the multi compile and include the unique shadow cginc like described in the readme.

    so the skin shader might look like this:
    (additional code marked in green)

    ...
    SubShader {
    Tags { "RenderType"="Opaque" }
    LOD 200

    CGPROGRAM
    #pragma surface surf LuxSkinSpecular fullforwardshadows vertex:vert
    #pragma target 3.0

    #pragma multi_compile __ LUX_AREALIGHTS
    #pragma multi_compile __ LUX_LIGHTINGFADE
    #pragma shader_feature _LUX_SKINMICROBUMPS

    // Volund additional variants
    #pragma multi_compile _ UNIQUE_SHADOW UNIQUE_SHADOW_LIGHT_COOKIE
    // Include unique shadow functions

    // make sure you set the path properly!
    #include "UniqueShadow_ShadowSample.cginc"

    #include "../Lux Core/Lux Config.cginc"
    #include "../Lux Core/Lux Lighting/LuxSkinPBSLighting.cginc"
    #include "UnityStandardUtils.cginc"
    ...
     
    Alverik likes this.
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    just updated the old lux texturepostprocessor script to support ggx.