Search Unity

[Released] Lux Lit Particles

Discussion in 'Assets and Asset Store' started by larsbertram1, Jan 27, 2019.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900


    Lux Lit Particles provide advanced particle shaders which add high quality yet performant real time lighting including normal mapping, wrapped around diffuse lighting, translucency and directional shadows in order to make your particles just fit your scene’s lighting.

    Lighting Features
    • Support for real time directional, spot and point lights (per pixel and/or per vertex).
    • Per pixel lighting and normal mapping for 1 or 4 lights.
    • If only one light uses per pixel lighting 3 additional lights will be shaded per vertex.
    • Particles may receive directional shadows (per vertex or per pixel).
    • Wrapped around diffuse and simple translucent lighting.
    • Ambient lighting: Skybox, gradient and color are supported (per vertex or per pixel).
    • Particles support Light Probes (per vertex or per pixel).
    • Particles may cast shadows (WIP).

    Particle Features
    • Lux Lit Particles have been written with classic view aligned billboards in mind. Other billboard modes like Horizontal Billboards or non view aligned billboards are only partly supported.
    • The provided shaders only support alpha blended particles.
    • Flipbook blending is supported.
    • Lux Lit Particles may use tessellation in order to enhance per vertex calculated lighting and shadows while still rendering at high speed.

    Compatibility
    Lux Lit Particles have been successfully tested on DX11, OpenGLCore and Metal (desktop). Mobile platforms neither have been tested nor are recommended. DX9 is not supported.

    Limitations

    To find out more about any limitations please refer to the docs.

    Asset Store / Documentation





     
    Last edited: Feb 2, 2019
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    [Reserved]
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    Version 1.01 has been submitted.

    ### Fixed
    - Lux Lit Particles Tess Bumped shader: Missing emission feature added.
    - LuxParticles_AmbientLighting.cs: Ambient lighting is calculated OnEnable.

    ### Added
    - Per pixel ambient lighting support.
    - Light Probe support.
    - Dedicated albedo texture support.
     
    NeatWolf and hopeful like this.
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    Version 1.01 is live.
     
    NeatWolf likes this.
  5. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    255
    I suppose your new particle shaders do not change the fact that large particles cause significant overdraw issues?

    I mean, how would they, but one can hope. It looks good either way. Might try it out.
     
  6. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Hi there!

    I'm really interested in purchasing and I'd love to make a few questions

    Could you please make a Lux vs native Unity lit particles (specific version/RP) comparison table?
    I must have got lost in the lit particles upgrades Unity did along the way :p

    I'm pretty sure your solution is either more performant or has a broader scope, but I can't visualize that at the moment
    (split Lux/Unity screenshots would be cool as well)

    This is not an attempt to deprecate your work, I'm just genuinely confessing my ignorance in this field here, as I haven't tinkered with lit particles enough :oops:
    My best guess is that Lux implements accurate per pixel lighting/shadowing, regardless of the rendering pipeline (or, using the default RP?).

    Is Lux NGSS2 compatible? Does it depend on native Unity shadow system?
    (I'm browsing through the docs right now, I missed the link above)

    Are there any plans to make it LWRP/VR compatible (single pass) or make it work with no dominant direct lighting (eg.: in a corridor of an alien spaceship, but in a point where the sun/direct lighting contribute isn't noticeable)?
     
    Last edited: Mar 27, 2019
  7. LosTChG

    LosTChG

    Joined:
    Apr 7, 2015
    Posts:
    7
    Hello!

    I was thinking about buying this. Does it work on 2018.3?

    Thank you in advance.
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i haven't tested it – but in case you use the "legacy" rendering pipeline it should work properly as it is more or less just a shader. some scripts are needed to provide ambient lighting and the main directional light but they are pretty basic.
    in case you come around any problems in 2018.3 – just let me know.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    sorry for my late reply – but i did not get any notification...

    lux lit particles are built for the standard or legacy render pipeline. i do not know much about lwrp or hdrp, so all i can say is related to the standard render pipeline.
    here "native unity lit particles" are either using the "lit particles" or the "standard particle shader".
    while the first one does all lighting in the vertex shader and supports spot lights, the latter uses per pixel lighting for 1 directional light only (as it uses "noforwardadd") and applies all other lights in the vertex shader. per vertex lighting here uses the standard surface shader lighting which does not support spot lights. spot lights here are treated as point lights.

    lux lit particles combines both. it is based on per vertex lighting thus it can shade up to 4 lights within a single pass including directional, point and spot lights. but it combines this approach with per pixel lighting and supports bump mapping.
    furthermore it supports sampling the shadow cascades of the main directional light so particles may receive real time shadows.
    last but not least tessellation is used to improve per vertex lighting and supports proper ambient lighting.

    lux lit particles rely on the shadow cascades to sample shadows – just like ngss does. i haven't looked into ngss2 but i hardly doubt that is renders its own cascades. it just replaces the screen space shadow sampling based on the provided cascades. so it should be fine
     
    Last edited: Apr 29, 2019
    NeatWolf likes this.
  10. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Thanks for the reply! :)

    This month I tested the asset pretty intensely and managed to get some awesome trail smoke with NGSS2 and Aura2.
    Aura2 messes up the rendering order, so the sunshafts appear -behind- the particles and a lot of other shaders. But that's an issue of Aura2 alone that I already reported several times to its creator.

    Apart from that, I'm utterly satisfied and just left my review :)

    One thing that I'm missing is fading particles out as they come closer to the camera (adding a fadeNearCameraBegin and fadeNearCameraEnd parameters). I could probably try tweaking the shaders myself, but all changes would be wiped out on the next update :)

    I wish I could have paid it more to boost the attention of the developer on it, burning down the whole roadmap! :)

     
    Last edited: Apr 29, 2019
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hmm, that should be already in?!
     
  12. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Yes, but I believe is 0 based. That is, begins fading from 0 distance.
    I was wondering if it would be possible to define a distance from the camera where the alpha is completely 0, and then it fades to 1 until it gets to the distance that's actually the very first value here (x):


    Basically I'd like to have thick particles as soon as possible but with no clipping (otherwise I'd just have increased the camera nearclip or tweaked the zOffset of the particle, but that's something I'd love to avoid).

    Basically you'd have an extra value to push on the left of the above interface:
    clipFadeBegin, nearFadeEnd(what currently is x), farFadeBegin(currently y), clipFadeEnd(currently what z is)

    No particle gets rendered before nearFadeBegin, saving a few calls.
    I could tweak the gradient of the particle system but it would be emitter speed-dependent.

    I know it's something very specific, so instead of having to tweak this every time the asset gets updated, I was hoping to have it natively in the shader :p
    (and would help my OCD to ignore that unused W :D )
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i may have a look into this.
     
    NeatWolf likes this.
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    Version 1.02 is on its way and will bring near fade start.
     
    NeatWolf likes this.
  15. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Hello,

    Can Lux Lit Particles work with the new HD Render Pipeline? I am looking for particles that can use normal maps that can also work with the HD render pipeline.

    If not, is there any way you could work on making it work with the HDRP? Just wanted to ask. Thanks.
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    no, they are written for legacy.
     
  17. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Ok, thank you.
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i submitted version 1.03 which adds support for LWRP and Unity 2019.1 / Unity 2019.2.
     
    Rowlan likes this.
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    version 1.03 is available.
     
  20. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Hey, I'm using this for snow particles (not falling snow, but kicked up from the character moving through deep snow), but there's too much difference between the particle brightness from different angles. See screenshots -- from above, and from the side -- I guess in the latter, the particles farther away are shadowing the particles closer? Might be great for other objects, but it's too much for snow. (I've enabled directional shadows but not any per-pixel toggles -- those are likely great for other materials but didn't improve these snow particles.)

    So I'm hoping that I can tweak the shader to reduce this range of brightness. Is that reasonably easy for a novice to adjust in the shader code? If so, could you point me to where to do it?

    thanks!
    Dave


    particles from above.png particles from side.png
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hey dave,
    the shaders use per vertex lighting. so if your particles are very large lighting will become inaccurate.
    so try to reduce their size.
     
  22. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Oops, my apologies -- this scene I was testing in didn't have the LuxParticles script assigned to the directional light. Adding that is a big help, of course!

    But that gets me back to what was actually my original question -- the particles are too dark in shadows compared to in sunlight -- which is probably accurate for a lot of substances, but seems too much for snow. It should still be pretty white even in shadow, not near-black. Is there anything I can tweak in the shader code to reduce that?
    picturemessage_u4ela0hb.lzn.png
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    not sure - but you may try to add backside ambient lighting. so evaluate the sh ambient lighting twice.
     
  24. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    ok...how do I do that?
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    find the section in the shader taht deals with: // Per Pixel Ambient
    assuming that you use sh ambient lighting (from the skybox) oyu would simply add another lookup like so:

    // Per Pixel Ambient
    AlbedoOut.rgb += color.rgb * Lux_ShadeSH(float4(-normal, 1) ) * yourfancycustombacklightfactor;
     
  26. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,274
    Lux Lit Particles again to the rescue! :) My dust particles were bright as day at night. Not anymore :D

     
  27. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Thanks -- I tried that, but not seeing any effect. Quite possibly I'm doing something wrong though. I'd be happy to pay for a bit of consulting time to get it looking how I want it, via Skype....
     
  28. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Hi, do these work with URP?
     
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    iddqd likes this.
  30. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Hi,
    I'm using Lux Particles and it's really good as it works.
    I've a question.
    I know that you write "Lux Lit Particles have been written with classic view aligned billboards in mind." but I'm achieving nice results using also mesh mode. I'm using mesh so I can create an octagonal mesh to cut away a bit of overdraw.
    The nice thinkg about mesh mode for particles is that you use the GPU instancing but this feature must be coupled with a shader that are compatible with instacing.
    So, my question is if it's possible to add an "Enable GPU instancing" button in the shader to be compatible with GPU instacing particles.
    What do you think? Is doable?
    Thanks in advance.
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    it is doable, but you will have to add all the needed code manually. refer to the unity documentation on gpu instancing.
    nothing i can look into right now, sorry.
     
  32. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    OK.
    thank you for your reply.
    I'll try to understand how to do it...not sure to make it happens..but let see.
     
  33. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    102
    Hi,

    Particles may cast shadows or is it still in development?
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    particles may cast shadow.
     
  35. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    339
    hi,@larsbertram1
    i want to know could this particle shader work with light cookie and realtime shadow at same time or not?
    light cookie simulated cloud shadow is important to me and your shader is my last hope.
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    it does not, sorry.
    one could add this but it needs some more work in the shader.
     
  37. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    339
    oh,so sad,
    i'm not good at shader coding so i think it's impossible.
    thank you for reply.
     
  38. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    @larsbertram1 I have a question does Your shader need to work with particles only to receive shadow, We just looking for some fade/ transparent shadow that is able to receive shadows, for our spider webs 3d models. How do You will it work with standard geometry? and will then that geometry support GPU instancing then with YOur shader?
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi jakub,
    for the shader, particles are just geometry with some extra information like vertex colors and some blend values stored in additional uv channels. so it should work with regular geometry as well.
    i never looked into gpu instancing tho as it does not make sense with particle systems. shaders are written in cg so there is no simple checkbox.
     
  40. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Just passing by since I read the email-notification

    Looks like Valheim is using Lux particles for its smoke! (or, at least, while I was modding it as per normal procedure, I found plenty of Lux references in the assemblies! :) )

    On the right: just a few but big cloud particles receiving direct-light shadows from the pixelated tree branches.


    I'm not 100% sure, but, if so, congrats! :)

    Also, are there any updates for the asset?
    Is its roadmap at the end? :(
     
    Last edited: Mar 18, 2021
    PutridEx and hopeful like this.
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    if so i am very happy!
    anything needed?
    i have been workign with urp and hdrp during tha last year most of the time and think that lux lit particles are more or less done?
     
  42. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    I'm probably missing something. Can we already have transparent particles with shadows in URP out of the box?
    I still haven't used URP in production.

    btw, ILspy-ing Valheim assembies (errr... it's part of the Valheim modding process) I believe you may find something familiar (or, it's just a coincidence?)



    I'm currently developing for Xbox series S|X, default pipeline/Deferred/Linear color space. Do you believe it's going to be compatible?
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    yes (it landed a few months ago), but my Lux URP Essential package contains Lux Lit particle shaders which do shadow sampling per vertex (cheap) and support tessellation (nice).
    if the buiilt in render pipeline supports these platforms: why not?
     
  44. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Oh, right! I got it way before URP got widely supported, and, errmm, sorta forgot it was there!
    As long as I can have alpha faded shadow-casting/shadow-receiving particles, I'm a happy kid! :p
    (especially since I'm using TAA - I had a peek at your paper about lux, and if you're using blue noise to animate the dither, I can't really ask for anything more!)

    OT: I'm surprised to see people complaining about the free version of the framework having some issues/requiring update. But, as per most free assets, it's normal to have an insanely high number of inexperienced users not actually paying attention to the docs :p
     
  45. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    @larsberteam1
    I have a question we have a problem with standard lit particle from unity as even when using all lights to important when there ios few lights around particle like 6-7 lights start to pop in etc. I dont know if there is any limitations in unity particle standard shader, but what with Your shader, How it behaves if there is like 10 lights around long emited particle, are there any visible pops up of the lights on different angles ?
     
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    na, unfortunately no chance. particles are forward. in forward unity pushes the 4 most important lights. that is all. and these 4 most important lights may change from frame to frame thus the popping.lux lit particles can not work around this: the engine simpley does not provide more data, just the 4 most important lights per frame.

    so in order to reduce popping you will have to make a little number of lights being important. and the rest of the lights being non important.
    like: the magic spell point light, the held torch light and one effect light = important.
    all other lights from local camp fires e.g. = non important.

    this does nt affect deferred lighting. only transparent materials.
     
  47. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    The problem is that even When I set up all lights to not important (wit unity particle shader) it seems like it still enlights the particle and pops up. This is why I'm confused. So I wonder how it works on Your shader. When light is not important it just not enlight particles at all? How it behaves, cause with unity shader its strange to understand, why not important light still give light to particles.
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    na, if you only have 2 lights lighting the particles, one is important the other is not, both will affect the particles.
    so i have to correct my last answer...

    usually you have up to 4 per pixel lights (one light per draw). then 4 per vertex lights (added to the first per pixel draw). the rest goes into spherical harmonics (added to the first per pixel draw). this will give you up to 8 lights.
    lux lit particles however always uses unity's vertex lighting mode and fakes some per pixel lighting out of it - so it can render up to 4 "per pixel" lights within a single draw. but it will only take 4 lights into account.

    nevertheless it depends on which lights unity will bind to the draw. and this may just vary...
    so in order to avoid any popping you will have to "manually" control the lights using render mode (important, not important) and Culling Mask.
    actually important or not important is not that important at all: depending on the position of the light and the center of the particle mesh an important light may be dropped while the unimportant light will be added to the draw :(
    so best way is to use the lights' culling mask.
    - let the directional light affect particles
    - let all spot and point light NOT affect particles
    - then choose up to 3 point or spot lights in your scene which may affect the particles, like: torch held by the player, the main effect light curently present and one more.

    use tricks to reduce the number of needed lights on particles like: smoke from a fire does not have to be lit by the fire light. you can simply use emission to fake lighting from below and fade it out over lifetime.

    in case you need more control you would have to script it :( theoretically - if you tweeak the shader and push all light using script - you should be able to get 8 or 16 light per particle avoiding all popping.



    standard forward rendering:



    https://docs.unity3d.com/Manual/RenderTech-ForwardRendering.html
     
    hopeful likes this.
  49. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    Thanks a lot for clarification that helped me a lot!

    The last 2 questions, all those limitations are per particle (like one particle billboard) or per particle system? Cause we have like pretty long particle stystem going like throw hole interior

    second question is. How do You think will we be able without no problem to modify Your shader to work together with Enviro sky volumetric light. Below is like instruction to modify some other transparent shader for enviro sky. There is thing if I remember about fog. lease take a look at it and let me know if that modification will be also easy with Your shader. I think it might be usefull iformation for anyone using Enviro or Aura2
     

    Attached Files:

  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    per particle system :(

    the shader is written in cg. so it should not be a problem.