Search Unity

  1. Dismiss Notice
  2. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  3. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  4. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. larsbertram1

    larsbertram1

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

    i am a github noob too. so please: what did yo try to pull?
    one more if: if(AssignedMeshes around the original loop?

    you are welcome. fortunately it was just 1min of work and 4min of waiting for the shader to be compiled...

    lars
     
  2. jmatthews

    jmatthews

    Joined:
    Jul 27, 2011
    Posts:
    199


    yeah, otherwise the next line references a game object that may no longer exist.
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    ok, i have updated the repo, thank you.

    lars
     
  4. jmatthews

    jmatthews

    Joined:
    Jul 27, 2011
    Posts:
    199
    There seems to be something odd about the reflections. I made a short video showing what I'm talking about.

    The reflection has a line in it about 4 meters "in" and then the interior scene is stretched out and pinched at the deepest point. That may be a function of the technique, but I want to make sure I'm not missing a setting or something.



    You can see when I look at the reflection from a large angle that you can make out bits of the scene. But when looking head on it almost looks like there's a tile in the way of the rest of the reflections that is stretched and pinched.
     
    Last edited: Apr 15, 2014
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    thats not a feature – but (i hope) caused by some mistake you have made in the setup.
    you have to setup to probe size accordingly to the size of of your room which you probably will know.
    so i i had t set up all rooms i would just start with a pretty simple one.
    - remove all roughness texture from the faces that should reflect the box projected cubemaps to get the best possible preview.
    - place and bake the probe.
    - size it and assign all related surfaces
    - preview it in the editor window
    - tweak the probe’s size untill the reflections look fine

    you will have done all this already so where is the mistake?
    try to simplify your scene by deactivating all but one room. does it show up correctey?
    if so proceed with the next room.
    if it breaks: check your materials and check the probes settings.

    lars
     
  6. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Wow, I can't wait for your pbr version of AFS. Looks great!

    I looked through your various docs but I couldn't find any tutorials on your lux tree shaders. I tried to wing it but I got a lot of specular aliasing on the bark areas (plus the billboards didn't look much like the actual trees). I think I have not packed the correct maps together or something since they (the tree shaders) don't seem to work like your default pbr shaders.
     
  7. jmatthews

    jmatthews

    Joined:
    Jul 27, 2011
    Posts:
    199
    Ok. So I've tested this for a few hours now.

    I built a new room using cubes instead of planes, thinking that make be breaking the math(X size of 0 maybe), but no joy there. I'm using a small rectangle room with a mirror cube at one end to avoid roughness distortion.


    $Screenshot 2014-04-15 00.34.53.png

    As you can see i still get a weird cube like map followed by a very stretched by proper reflection.

    $Screenshot 2014-04-15 00.31.40.png

    to get an accurate reflection I can go to the mirror game object and go to the bottom of the bumped specular box projection shader. The last two configs are: Cube position worldspace and cube size.

    If I input the mirror objects world space and size the reflection is near perfect. What it is mapping is the environment probes position and size, which is giving the odd pinching. The first thing I did was roll back the extra null check we discussed earlier but that's not the culprit. this pretty much has me beat at this point.
     
  8. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    AMAZING WORK GUYS! Keep it up!
     
  9. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Been using this for a day, and this is what I've got so far. Excellent work on this!
    $Lux.png

    Only 2 problems:
    1. a Cubemap gets leaked every time I save the scene. It's annoying to have this flooding the console
    2. IBL lighting makes everything FAR to bright.

    Still, minor issues compared to the great stuff in this package. Keep it up; really great tool you've got here!
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    hi squared55,

    very nice screenshot – and excellent work on the textures as far as i can say.

    1. i have seen that – and will have to look into it.
    2. that should depend on your settings (lux setup script): here you can adjust diffuse and specular ambient exposure (I usually go with something around 0.3). and make sure that you set the checkbopxes (hdr) acordingly to your cube maps.

    and please let us see more of your work.

    lars
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    leaking cubemap issue is fixed.
    get the upfated setuplux script from the repo.

    lars
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    @jmatthews:
    although i spend some hours on working with the box projection feature i could not 100% reproduce your problem but was able to get more or less "correct" recflections.
    nevertheless i have to admit that the current method (shader and editor) is not very easy to handle...
    so i switched back to a simpler box projection model in the shader and tweaked the editor.
    now it is much easier to setup (as you can specify the box projection size by simply typing the probe’s scale in the inspector) – but the probe and all your "walls" have to be perfectly aligned with the global xyz axes.
    i don’t know if this drawback would completely ruin your scene though. just let me know.

    lars

    $Bildschirmfoto 2014-04-15 um 21.45.10.png
     
  13. jmatthews

    jmatthews

    Joined:
    Jul 27, 2011
    Posts:
    199
    I've put it down for a little bit. I'll build a fresh scene and update from your repo when I have my stamina back. :) I appreciate you looking into it. If it's working on your end we can assume it's an error on my part. I would be curious to see someone else set up a simple scene with a mirrored wall on one end and see the screenshot. I worked pretty hard trying to get it to line up and just couldn't get it.

    The global cubemaps work great, I just couldn't get the box projection to line up.


    edit**- just looking at your picture I see yours is perfect, or "perfect enough".



    Just to reiterate your steps.

    You create an empty game object and put the environment probe on.

    you switch the probe type to box, exposing the list of game objects to add.

    You add all of the game objects it is to effect, making sure that each included GO has a box projection shader on it.

    You size the environment probe to as close as you can to the surface of the walls it is to effect.

    You hit, bake map.

    You convolve your map in the probe.

    Presto, magic?

    haha.
     
    Last edited: Apr 16, 2014
  14. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    Thanks. :)

    Unfortunately, I found another, completely show-stopping problem. The LuxCubeProcessor has a parsing error that prevents any builds of the game from being made.
    "Assets/Lux/Lux Scripts/Lux Cubemapper/Scripts/LuxCubeProcessor.cs(1040,8): error CS8025: Parsing error"
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    have you downloaded the latest version from the github repo?
    lars
     
  16. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818
    No, but I'm worried about the MIT license. I don't want to release my game under that license for obvious reasons. Unless I'm interpreting it wrong? :)

    EDIT: That said, it DID fix the issue. :)
     
    Last edited: Apr 18, 2014
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    i think you get the mit license wrong. as far as i understand it it allows you to do anything with lux you want.
    so it should not be any problem to include lux in your game (even if you want to sell it).
    at least that is what i meant...

    lars
     
  18. jmatthews

    jmatthews

    Joined:
    Jul 27, 2011
    Posts:
    199

    Yes, MIT is free as in free beer, except you agree to a hold harmless for any outcome that your use of the software causes.
     
  19. squared55

    squared55

    Joined:
    Aug 28, 2012
    Posts:
    1,818

    Oh, OK, awesome!

    (What's also awesome is your response times. Really appreciate it. :) )
     
  20. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I did a bit of a wrong-post on the old thread, but ill reiterate in short and simple terms:

    I'm entering a competition soon that will be 12 weeks of gruelling work and if im going to do gruelling work im gona darn well make it pretty - my choices were, having set on a pbr system, lux and skyshop, lux is free, i'd bought skyshop, would choosing skyshop be the no brainer? I had a this thought and it irritated me intensely, so i decided to start with Lux and see how far it got me. Bear in mind i only started with it 2 days ago in an 'intense' fashion, and decided to give a daz model a makeover, i grabbed something from daz studio, decimated, moved to max, then the game was on. The model took a little bit of reshaping, i wanted object that shared a material to have its own object etc, at least until i bake everything together later if i fancy, anyways, tangential. After bugger loads of work, learning making spec/gloss maps (really need to grab dDo i hear its lovely for this) and various stretches of reading i present to you, Toady, possibly quite a primitive characterin the eyes of profesionals but hey im proud anyways:

    $Toady1.jpg

    I made a point of featuring the eye shader, which i think is wondrous, and as my wax/translucency inquiry with lars got an incredible response, he really did a stellar job at delivering it, its what the toad frog things skin is made of.

    This is just the tiniest prod into what i can see Lux doing, it's really impressive and if it manages to hold up through further slightly more weird tests then it's going to be my choice of the frameworks to do the competition with. I have some feature requests but theyre pretty much based on features coming in upcoming releases of those that shall not be named, and considering it, i may find implementing my own versions of those features quite possible - break an area into boxes for projection mapping, prebake the skybox etc for all boxes in a scene (this could be very time consuming possibly although gpu assisted methods seem to be available - If so you need only bake the boxes you need, on the fly) and with the boxes being married with a box collider trigger, suitable skyboxes (the custom slots i guess) be applied to to objects within that collider with some nifty smoothing

    Its probably all been discussed but this is a kinda make or break for me as im not using the hdrs just for 'ambience' as such, i'll be very keen on using Candela screen space reflections alongside it and the box projected shaders are absolutely great solution to the shortfalls of screen space reflections

    From what i've personally found through experientation, really very fancy pretty things can result from this marriage so my fingers are crossed i guess! If you need any visual provocation and you like it, ive got part 2 starting tomorrow - making a home for toady, which will be good fun and hopefully the ideal chance to leap the uncanny valley and go for some real realism, because you need a penthouse apartment abode for a translucent toad

    None of these things are towards the competition, that said, its all workflow training so i know what planet im on when im trying to create so may things
     
  21. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,458


    ;)
     
    Last edited: Apr 20, 2014
  22. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Guessing this is SSRR and not box projected cubemaps?
     
  23. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,458
    Nope, all box projected. Corrected and improve a bit. just wait from lars to push the update :)
     
  24. larsbertram1

    larsbertram1

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

    as rea just has mentioned: i have been working on the box projection shaders and the environment probe scripts as i have to admit that they had some issues... sorry about that.
    the latest version should iron out most if not any of those and give you pretty robust and flexible box projected reflections.
    objects using the box projection shaders now can be batched.
    you find the updated files in the repo:

    https://github.com/larsbertram69/Lux

    happy easter,

    lars
     
  25. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Dear larsbertram,

    Happy Easter and congratulation for amazing shader framework ( and open source approach).

    I d like know if lux is supported on mobile device

    Thanks :)
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    happy easter too.
    lux was not written with mobile devices in mind – but it has been successfully tested on those.
    so it runs on mobile devices which support shader model 3.

    lars
     
    Last edited: Apr 21, 2014
  27. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646




    Thank you for these great shaders. Now I'll try to combine them with a Glow shader. :D
     
    Last edited: Apr 21, 2014
  28. Pig

    Pig

    Joined:
    Mar 6, 2014
    Posts:
    2
    I don't know if it's a bug or i'm doing something wrong, but objects with the lux bumped specular shaders are visible in complete darkness, unless you disable the specular IBL map, which removes reflections.

    http://imgur.com/QTvgSiq

    As you can see, the door handle is visible in a completely dark room (specular cube IBL enabled) but the door which is attached to isn't visible (diffuse and specular cube IBL disabled)

    I tested this in LuX's demo scene too. I turned off all the lights and objects with the default unity shaders went black whereas the ones with LuX's shaders remained visible, as if self-illuminated.

    I don't know if that behavior is intended or not, i'm quite the shader noob, just wondering if there's a fix/workaround without disabling the specular cube IBL.
     
  29. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    It's as intended. IBL stands for Image Based Lighting, so the cubemaps act as a light source in addition to any direct lighting you have.
     
  30. larsbertram1

    larsbertram1

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

    as niosop2 has already written: the both cube maps replace the simple built in "ambient light" and therefor are not directly connected to direct lighting.
    in order to reduce the overall lighting in your scene you will have to dim the direct lighting and may reduce the "Lux_IBL_diffuse_exposure" and the "Lux_IBL_specular_exposure".

    you may have to edit the "setuplux" script and change:
    "void UpdateLuxIBLSettings ()"
    to:
    "public void UpdateLuxIBLSettings ()"
    if you want to change the exposure values using an external script.

    lars
     
  31. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    @rea: they see you reflectin' they hatin'! ;)

    Well done on the screenies, they look real nice! defintely something for indie users to take advantage of to add realism to their scene.

    @Pig: yes, like lars said: the cubemaps add cubemap based ambient lighting to the shaders, and this is what can help make some truly impressive scenes. (like rea's, only his was a custom cubemap generated with lars' tools!)

    @Lars: BTW, not to sound rude, but your post said: "Happy Eater!" Reminds me of my sister, who would do anything to get her hands on chocolate!

    @ZJP: You could give my indieEffects a try. just follow the link in my signature! I presume you use unity free, so this can help you. At the moment though, i don't recommend using both bloom and another effect as for some reason, they break each other. and BTW, nice screenshots! That robot model yours?
     
  32. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,458
    So....I know that every of you who use Lux or maybe any PBL pipeline having trouble doing the same thing over....... and over.......... again to create the RGBA texture......especially when you were in the middle of texture tweaking which tweak...copy it into designated channel......save it. And........doing it again to make a tweak......
    Make you crazy huh???
    well, now you can relax "a bit"... because i made a photoshop action that can help you on some repetitive task on that process. And since i share your paint so i decide to share it to all of you :)

    Alright....now lets take a look at the actions file.
    now you should have a new Actions Group Folder in you Actions Tab called RGBA Texture Helper (Assuming that you already load the action ), and you can see that there is two actions in it (See image attached).
    Now this is important, you have to run the action in correct order to make it works

    First Setup Document
    This isthe first action that you have to run to setup the document with all helper Layer for the first time "if" you are working on a new files. After you run the first action you will see a couple layer group with it owns name as in the attached image . And Please don't change the Layer naming or Reordering the layer, Just in case. But you can Hide the group, to help you working on specific channel group, just make sure to Unhide the group when you finished.

    Now you can start working and tweaking the texture as you like, but make sure you put it inside the designated group.
    After you finished or just want to test the textures you can export it by running the second actions

    RGBAExport
    Now before you run this action, you need to make sure that all the group are not Hidden.
    If you sure that everything is ready, now let's run the second action.........
    and pray.....;)

    Alright.....that's all from me today folks, Have Fun with Lux.........
    or
    whatever you are doing right now :p
     

    Attached Files:

  33. Botanika

    Botanika

    Joined:
    Nov 2, 2013
    Posts:
    59
    Great job everyone !

    Box Projection reflections work like charm now.
     
  34. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,808
    Do you still have to make a new cubemap for each room's reflections? I never understood the appeal to box projection reflections since you cant scale it without an insane amount of effort.
     
  35. Botanika

    Botanika

    Joined:
    Nov 2, 2013
    Posts:
    59
    depends really on how shinny your environment is, if it doesn't contain large reflective surfaces, and rooms have fairly similar lighting, then you can get away with reusing cubemaps.
     
  36. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    @rea: at the moment... i am at school! nice post though, i presume a template like this would be needed for PBR texture creation
     
  37. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    EDIT: sorry for the double post, my computer only just woke up...
     
  38. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Good to know.

    However I hope you will have time to optimize algorithms and pragma for mobile because it will be much more interesting shader framework :)

    Thanks
     
  39. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    Pitty Lux doesn't support my tab... for some reason, a lux-powered APK wouldn't install on my device!
     
  40. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Thank for the tip. Robot is from 3DRT.
     
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,107
    so just another tip: i you want to really unleash the power of lux you should add more details to your roughness map ;-)

    lars
     
  42. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    @ZJP: Anytime bro. And like lars said, the more 'rough' your roughness, the better the robot may look. i actually have a snow scene that uses lux detail bump spec and TWO roughness maps so that both light and heavy snow is simulated! I also am planning on adding rocks to the project for better realism, and there is already a snow and cloud system for it.

    If you like, i can post this. note however that it's a work in progress!
     
  43. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    @larsbertram1, @FuzzyQuills
    Thanks guys for the reply. These shaders are fantastic. So, i'm a coder, not an artist or designer, and i've to confess that i've some difficulty to understand how to modify or configuring the 'roughness maps' things. Maybe en tutorial will be fine for people like me.

    BTW, for those are interested, i've (with success) mixed LUX and Heathen's Selective Glow Essentials. Pretty easy. :D
     
  44. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    74
    Last edited: Apr 23, 2014
  45. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Hi dnnkeeper,

    I would pleasure to check and analyse your scene.
    I hope you will contact me in PM

    Cheers
     
  46. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    This a webplayer? Chekin it out now!

    EDIT: It is! Now waiting for it to load... :/
     
    Last edited: Apr 24, 2014
  47. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    720
  48. Botanika

    Botanika

    Joined:
    Nov 2, 2013
    Posts:
    59
    dnnkeeper : :eek: Awesome Man !

    You could've made it even more awesome, if you used FuzzyQuills's Image effects for Unity free.

    btw, how did you blend between Cubemaps for box projection?
     
  49. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,874
    @Botanika: thanks for the support! dnnkeeper could try my bloom effect to give the scene a visual boost, but IMO, that scene has enough eye-candy! adding just one effect from my scripts or another pack would be mind-blowing!
     
  50. larsbertram1

    larsbertram1

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

    in order to fight the specular aliasing (at least a little bit) i have added a texturepostprocessor which will prefilter your roughness textures in order to reduce the flicker of specular highlights on rather smooth surfaces.

    Get it from the repo and please make sure you read the text file:
    https://github.com/larsbertram69/Lux

    lars





     
    Last edited: Apr 24, 2014
unityunity