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. DaIndieTeam

    DaIndieTeam

    Joined:
    Aug 27, 2017
    Posts:
    7
    I'm sorry, I always thought that the Volund Skin Shader was done by Unity, when it was in fact a spin-off by Morph3D.
    This skin shader set up looks like this:
    volundskin1.png

    I thought you perhaps knew it and could tell me the pros and cons of the Lux Skin Shader compared to other skin shader, in my case the above. I find it incredibly hard to judge it. I even tried to find ways to automate the process of comparing my results to real skin (like Unity does when it changes their graphics code... they run automated tests to see if the results are nearly as excepted so that they don't have to check really many combinations). Unfortunately I didn't see a way to do this, so I thought I might just ask here. Or spend weeks or months just trying it out under all conditions. :)
    But if you think I should just try it myself, I will take the advice and do that.

    Thank you again.
     
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    yes, i think so, because from what i can see in the material editor it does not offer any transmission or any other skin related special lighting feature.
    lux skin shader does.
     
    DaIndieTeam likes this.
  3. DaIndieTeam

    DaIndieTeam

    Joined:
    Aug 27, 2017
    Posts:
    7
    Do you see the "Culling Mode" option in the screenshot that I provided?

    Let's say I have your Skin Shader on the entire body, but parts of it are temporarily covered and can be uncovered, like a bullet-proof vest, would Unity skip rendering these culled regions, or would it be necessary to somehow adjust for this in order to not lose processing power? I don't know how expensive the Lux Skin Shader is and if this is necessary at all, but since the Volund Skin Shader has this "Back / Front / None Culling option", I thought I might ask.
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    culling mode is not relevant here at all. that would be all about depth buffer.
     
  5. DaIndieTeam

    DaIndieTeam

    Joined:
    Aug 27, 2017
    Posts:
    7
    Can you explain that, also in aspect of what it means to me?
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    it means nothing to you.
    culling defines how the shader rejects triangles. usually it is set to back which means that all triangles pointing away from the camera will be skipped.
    your example with the bullet-proof vest does not concern culling but depth testing and rendering order.
    by e.g. setting the skin shader to render at queue geometry+1 you would make sure that it always rendered after the vest – so skin pixels behind the vest would never be rendered.
    on the other hand a building behind the character would be rendered first (queue = geoemtry) and then get overdrawn by skin...
    so simply let unity do the sorting per renderer and live with some minor overdraw.
     
    DaIndieTeam likes this.
  7. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    I've setup up Tropical Forest / Forgotten Ravine DemoScene by Baldinoboy again from scratch in a new project.
    Then I downloaded Lux Plus and imported it.
    I have then changed "Built-in Shader" from this...
    shaders1.png
    ... to that:
    shaders2.png

    The output looks as strange as in my very first attempt:
    shaders3.png


    I want to use the Lux Plus shaders for all my projects because I also want to use the Lux Skin Shaders, so I think I can't use the Custom Tree Importer shaders because they don't provide that Skin Transmission.

    I can only say that when I use the CTI shaders as Baldinoboy does, everything looks perfect, but when I use the Lux Plus shaders (both done by you, right?), the leaves don't look as expected.

    Can you tell me what I could try now?
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    you have to tweak the – quite outdated – cti shaders as written in my posts before.
    then assign the lux plus deferred lighting and reflection shaders – as these are the most advanced ones.
     
    OfficialHermie likes this.
  9. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    I thought that when I replace the Custom Shaders in the Unity settings, only they will be used and not the CTI shaders anymore. Oh well, I guess I was wrong.
     
  10. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    I did it as you told me, but the output is still the same.
    What else may I try?
    If you have the Tropical Forest Pack by Baldinoboy and if you own Lux Plus ( :) ) it would be amazing if you could try it for yourself.
    I'm really stuck.
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    well, i did so: everything is fine.
     
  12. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    I don't think you tested it with Tropical Forest Pack, I guess something interacts with each other.
    I followed Baldinoboys video tutorial exactely, and it looked perfectly as in his video.
    And then I did exactely what you told me to, and it didn't look as I / you would expect.
    So what else should I do?
     
  13. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    cti1.png
    I'm trying to get an overall image of what does what.
    In the screenshot one can see that in the project CTI/Internal-DeferredShading and CTI/Interal-Deferred Reflection is used.

    Just to see if "CTI_TranslucentLighting.cging" has something to do with it, I changed the values as you told me to.
    In the scenshot one can see that nothing changes.

    So this means that CTI_TranslucentLight.cging" has nothing to do with the currently used CTI/Internal-DeferredShading and CTI/Interal-Deferred Reflection, right?

    I just want to make sure that I'm correct as I'm trying to find out where it goes wrong.
    This would be important to me before I even try to use the Lux Plus shaders as a replacement.
     
    Last edited: Oct 19, 2017
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    it has!
    but the CTI/Internal-DeferredShading does not read the 1.0 or 0.6 – but uses a fixed coded number instead.
    as lux plus is more flexible it does not use a fixed number but picks um the value the CTI_TranslucentLight.cging writes out.
    so if you assign the LuxPlus Internal-DeferredShading shader you definitely should see a difference between 0.6 and 1.0.
     
  15. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Perhaps I'm looking at the wrong plants in the Tropical Pack.
    I observed the appearance of the CoconutPalmTree, and it has the CTI/LOD Leaves shader assigned.
    Would updating the values in CTI_TranslucentLighting.cging affect them, or do I have to do something different when the CoconutPalmTree leaves doesn't look translucent?
    cti lod leave.png
     
    Last edited: Oct 19, 2017
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    yes, but you have to reimport the CTI/LOD Leaves shader after editing the CTI_TranslucentLighting.cging.

    and you maybe should raise the translucency from (currently) 0.25 to 1.0 to get a better picture.
     
  17. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    I did as you suggested. After changing the values, I re-imported the shaders. I've recorded a video here:

    As you can see, the "CTI_LOD_Leaves" shader still doesn't produce the same results with the "Lux Plus Internal-DeferredShading" shader as they do with the "CTI_Internal-DeferredShading" shader.

    Changing the "Transluceny Strength" in the CTI-LOD Leaves has absolutely no effect.
    Here is a video:

    (Just to make sure if I actually play with the right shader, I'm adjusting the Alpha in the end of the video, and that does change something)

    What could I check next?
    Do you think it's my problem or yours?
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    i already made it work – so you must be doing something wrong :)
    i have checked lux plus 2.02 and cti shaders inlcuded in tfp.

    please check the specular channel. the leaves should show up there somehow strangle colored but well shaped like in the screen shoot attached.

    Bildschirmfoto 2017-10-20 um 13.36.53.png
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    just another attempt:
    you may send me a strpped package only including the cti runtime components, the lux shader folder, one tree or plant and a simple test scene (including the tree, a camera and a directional light).
    then i will have a look into your files.
     
  20. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Hi Lars,

    thank you for your offer.
    I've created a stripped down project.
    I've recorded a video here:

    As you can see, although the value is even already at 0.1f, it still doesn't get to the CTI look.
    Going higher only makes the problem more obvious.

    I've sent you my project in a PM.

    Can you have a look?
    Thank you.
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    i will look into your project just in a few minutes.
    well, actually cti uses wrapped around diffuse lighting – which is not supported by lux plus as lux plus follows a more generalized translucency approach which is also used by the skin shader and other translucent shaders – not only foliage like in cti :(
    so right now you have to live with that difference i guess.
    more details when i have looked into your package.
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    so now that i have looked into your i guess i have found the major mistake:
    you do not get any translucency in your test scene (lars1) because there is no "LuxSetup" script attached to it.
    the script however is needed to set up all the lux lighting.

    so please create a new game object, the add the "LuxSetup" script to it.
    as soon as you do so, there should be some translucent lighting showing up on your tree.

    the script lets you adjust the base scale factor for the translucent lighting in: translucent lighting -> scale.
    lux uses a factor of 2 whereas the fixed factor in cti is 4. so setting it to 4 should make your tree more or less fit using the cti shader (apart from the wrapped around diffuse lighting).

    then edit the CTI_Translucentlighting.cginc and set the view dependency value or power from 0.2 to 0.8:
    outSpecSmoothness = half4(s.Specualr.r, 0.8h, s.Translucency, s.Smoothness);​
    and reimport the CTI_LOD_leaves shader.
    using a value of 0.8h pretty much fits the thin layer translucency calculation as done by the cti deferred lighting shader.

    but nevertheless: lux plus uses a slightly different approach and will not give you the exact same results as the cti deferred lighting shader.

    edit: and it looks as if the cti deferred lighting shader in 2017.2 creates rather strange results...
     
    Last edited: Oct 22, 2017
  23. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Thank you for the hint regaring the Lux Setup.
    The Translucent Lighting->Scale was already set to "4".
    Even setting it to 8 doesn't make it as bright as CTI.

    Is that how it's supposed to look after applying Lux Setup and fixing with 0.8f? (I guess you mean "0.8f", not "0.8h"?)

    compare2.png
     
    Last edited: Oct 22, 2017
  24. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    When I leave TranslucentLighting->Scale at 4, and if I choose

    outSpecSmoothness = half4(s.Specular.r, 0.2f, s.Translucency, s.Smoothness);

    it looks very much like the CTI output:
    compare2.png

    Can you please tell me if that's a viable approach? I'm asking because I have no idea what lowering the outSpecSmoothing does and which side effects this has that I haven't found out yet.
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    "outSpecSmoothing" is a misleading variable name here.
    but its y (or green) component stores an exponent which controls the "view dependency" of the translucent lighting.
    setting it to 0.1 will result in more or less no view dependency which means that you will get translucent or back lighting even if the sun shines perpendicular to the surface – which would be wrong.
    using a value of 0.8 or 0.7 should give you more pleasant and convincing results.
     
  26. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Isn't there a valid way to do this? I would so much like a clean solution.
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    as i mentioned before: cti lighting seems to be broken in 2017. so it is no goal you would like achieve.
    but adding 100% matching (and corrected) cti lighting to lus plus right now is no option as it would make the lighting shader more expensive.
     
  28. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Will Lux Plus and Colormap Ultra Terrain Shader 3.0 work together?
     
  29. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Do you think it could be made so that I have a combined shader that contains both both CTI-Deferred shader and Lux Deferred shader, and when a material uses CTI, it will use the CTI part of the code and Lux if a material doesn't use CTI?
    I'm just brain storming.
     
  30. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    I need to ask again:

    ctilux1.png

    With your suggestion applied, that's how it looks for me. The transparency on the leaves on the left is almost gone.
    Is that what you suggest I should live with?
    I don't mean it sarcastically, I just want to know if you think that's correct.
    Thank you.
    ps: If you want to, you may glady edit the project that I've sent you and send it back to me so that I don't have to take wild guesses if something is as you expect it to be.
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    yes
     
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    nope. at least not without heavy tweaks.

    it is quite difficult to say as i can't really say which direction the light actually comes from.
    but if i look at the cti image and compare the dry leave in the foreground and single something in the lower left corner then both appear quite translucent: which means that the light comes straight from the back and from the top?!
    as mentioned earlier: cti seems to create inappropriate results in 2017 - for what reasons ever.
    lux plus should give you more reliable results right now. you may however lower the power exponent to your liking.

    well, there is no "correct" expectation on translucent lighting. after all it is an artistic decision and manually tweaked result.
     
  33. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Can you tell me what's wrong with CTI on Unity 2017 in your opinion?
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    to me it looks as if translucency was not view dependent at all.
    you may check this yourself: just place the sun behind your player / camera while there is a plant right in front of it: there should not be any translucency on the leaves because they are lit from the front.
     
  35. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Hi Lars,

    1)
    can you officially update Lux Plus so that we all work with the same version? I'm fighting sooo much with comparing everything and tracking down things. Definitively having the same version would help.

    2)
    I have uploaded a video here, can you please watch it (~2 mins)?

    Are these the differences between CTI and Lux Plus that I have to live with?

    3)
    And do you think you could send me my project updated? I guess you can see that I'm quite motivated and not just asking because of laziness. Then I could see what you see. That would help. Thank you very much.
     
    Last edited: Oct 29, 2017
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    lux is up to date.
    it seems as if your scene again misses the lux setup script. please make sure that it is assigned and set up properly.
    all i did was adding the script... (except from the changes to the cti lighting function – which you have already successfully added).
     
    OfficialHermie likes this.
  37. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    Ok, thanks, I think it looks RELATIVELY the same now with some minor differences that I can live with it. Maybe it was the missing of Lux Setup all the time, I don't know.
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    i guess so. no setup script = no translucency :)
     
  39. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    Alot of the models in the scenes or just showing white, anything I can do to fix that?
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    which version of lux? which version of unity?
     
  41. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    latest version from the store, unity 5.6.3
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    you may check the latest version from github – which works absolutely fine for me.
     
  43. AliceBl

    AliceBl

    Joined:
    Nov 19, 2017
    Posts:
    2
    Are there any plans to bring all your shaders together so that we can work with a single "approach", or do think stacking the assets is the way? I think some of your shaders are better at this (for example touch bending), and some are better at other things (like lighting). Do you plan to put them all under one roof in the future?
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    yes
     
    AliceBl likes this.
  45. TheRealGeorg

    TheRealGeorg

    Joined:
    Nov 21, 2017
    Posts:
    2
    Does anybody know if the Lux Wetness Shaders are still included somewhere? I saw a video on YouTube:


    Or is that a part of Lux Dynamic Weather now?
    Sometimes it's not clear to me where is what. :)
    But on the other side, you always find great new goodies. :)
     
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    a slightly different wetness is part of Lux Dynamic Weather now.
     
  47. jammer42777

    jammer42777

    Joined:
    Apr 21, 2014
    Posts:
    116
    Hi... I'm considering buying lux. However I do have some pet image effects.
    Amplify occlusion (thank you the fix)
    Amplify bloom
    Amplify motion
    Colorful fx
    Camera filter pack
    Tonemapper deluxe
    Ultimate bloom
    And screen space reflections (ssr)

    Has anyone tested these with lux? Which ones break or not?

    Thank you for any help
    --Joshua
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    amplify occlusion should work with the fix provided.
    ssr works out of the box but may show up some strange results on special materials like skin or wet vegetation (using custom translucent lighting). so there is a fix for the ssr which comes with the post processing stack.

    all other effects should not be affected by the way lucx handles the gbuffer.
     
  49. jammer42777

    jammer42777

    Joined:
    Apr 21, 2014
    Posts:
    116
    Thank you so much! Oh BTW there is one other question that I had forgotten to ask:
    is there any easy way to get substances to work in lux? (I just upgraded to version 6)

    Thank you again for the very fast reply!
    --Joshua
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,911
    lux does not have a "dedicated" support for substances: using e.g. one of lux's standard shaders with a substance simply works.
    however when it comes to advanced shading features like mix mapping or translucent lighting substance most likely will not create the needed texture or use a channel layout which just not fits.
    anyway: taking a substance, adding dynamic snow on top and using POM simply works fine.