Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  3. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Foggy Lights

Discussion in 'Assets and Asset Store' started by DavidMiranda, Apr 8, 2014.

  1. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Official thread for Foggy Lights Asset.

    Any useful info is welcome, bug report, features request... Feel free to express yourself.


    Asset Store link
     
  2. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    714
    great tool.
     
  3. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Looks cool, oculus rift compatible?
     
  4. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    I don't have an Oculus SDK to test. But in theory, its should work because the Depth texture used is generated by Unity
     
  5. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Purchased... It works :) Nice tool
     
  6. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Nice! Questions, suggestions, feature request...anything you want, here we are.
     
  7. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    I am really curious to ask you something offtopic,

    as I am a damn noob, i really would like to ask you how you get those beautiful lights in your scenes


    Many thanks
     
  8. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Which lights?
     
  9. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,051
    Does it affect back surfaces like GI does ?
     
  10. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Back surfaces? Anyhow, it works as any other point light.
     
  11. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,051
    Ok, i though it did some kind of global illumination trick too.

    At least that is what seems like in the asset pic below, but probably i misjudged the angle the surface sees the light and was just direct illumination.



    If the light does not directly see the back surface (the one we see and which seems to not look at the light), then it would be indirect illumination and seems so from the pic, at least for the blue light. But seems there is a small angle that the surface actually sees the light.

    Thanks for clarifying
     
    Last edited: Apr 10, 2014
  12. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    I just baked the lightmaps :)
    I recommend you to check the videotutorial, so you can see it as it is.
     
  13. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Very nice effect

    I interested for this asset but can you explain me if it is the same of a billboard circle attached to light with alpha controller? :)
     
  14. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Nothing to do with textured billboards. It computes spherical light extinction and takes depth into account for soft intersections.
     
  15. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    While i don't see much use for it myself, yet, i wonder if it could be a pretty neat special effect if the volume could be modulated by 3D noise of some kind, animated even. I guess it's not a volumetric effect in the classic sense (not that i'm any expert) but the extinction be able to be broken up? Changing intensities with this kind of modulation could get pretty intense!
     
  16. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Thanks for info.

    But what is the benefit of this approach than alpha billboard texture? Your approach is more expensive? ... I think yes ;)
    I ask because I use all assets just on mobile device.
    Thanks :)
     
  17. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    It will give you a foggy/volumetric feeling. I did it because somebody using Fog Volume wanted to put lights inside it.
    A billboard will intersect with the environment, and it will rotate when you move around. Intersection + noticeable rotation is not desirable. This wont occur with Foggy Lights. It's easy to set up and the result is good.


    $13-04-2014 16-38-55.jpg

    Soft Intersections:
    $13-04-2014 16-50-03.jpg

    + Fog Volume
    $13-04-2014 16-55-15.jpg
     
    ylil13579 likes this.
  18. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    HI David,

    I ask you if you can add foggy light also to conic / spot light to add a fog effect for example to headlight car.

    I would be a very interesting features ...

    Thanks
     
  19. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,456
    Those street lights with glass luminaire tops aren't in the Unity asset store, are they?

     
  20. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    No, this was for a freelance I did.
     
  21. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,456
    Are they included in the asset? I'm trying to model a US park scene where they'd fit right in.
     
  22. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    No Sir, there isn't any art content in the package.
     
  23. 3d_Artist1987

    3d_Artist1987

    Joined:
    Jul 9, 2012
    Posts:
    662
  24. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Up :)
     
  25. mitchtheriault

    mitchtheriault

    Joined:
    Aug 4, 2013
    Posts:
    24
    This seems like a good little tool
     
  26. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Thanks for the suggestion. It would be possible with some math. I'll add it to my TODO list.
    Cheers.
     
  27. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Upcoming update announcement

    • New feature
      • Foggy Lights is connected now with Fog Volume. By adjusting Fog Volume Visibility, Foggy Lights will be also attenuated.


    • Bug Fix
      • Effect won't disappear any more in editor mode
     
    ylil13579 likes this.
  28. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    157
    Thanks for this awesome effect, will use this in our game Darkfield VR.
    I also read your blog and I'm pretty impressed. Some nifty work you've got there.
    Do you have plans to make the fog volume affected by real point- spotlightsources in later builds or is this too hard for real time rendering?
    I'm also thinking of a combination with lightmapping to color the fog where it's affeced by lightsources but sadly the beast lightmapper can't be accesed via scripting. Or am I wrong?
     
  29. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Thanks for your comment.

    I really tried to lit fog the way you have suggested. I had no luck, and that's the reason why I ended up creating Foggy Lights :)

    Tinting Fog with lightmaps doesn't sound possible if you ask me.

    Revision 1.02 is waiting for approval. As mentioned above, you can connect Foggy Lights with Fog Volume to control it's visibility. As an extra, it's been tested on mobile succesfully.

    $MobileTest.jpg
     
  30. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    157
    I will look into your shader code when I've got some time. Maybe I find a way to get to fog light affected.
    But not today! I didn't watch your video to the end and spend the last hour to get the light attenuation working just to see it's in the next version. That's the sign to stop working for today :D
     
  31. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Hi,
    I tested Foggy Lights and have some problems or misconceptions with the Asset. I only see the Foggy Lights when I turn off the DX11 mode. But if I want to use it in combination with the FogVolume Asset I have to turn on DX11 mode. So how should this work? Or is there a bug? I use Unity 4.5.1 with the latest FoggyLights release (1.02)
     
  32. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    You can check here it works on both



     

    Attached Files:

  33. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Hm.
    it didn't work on my machine (ATI Radeon 7700 Series) when I turn on Direct3d 11. (I'm on WIndows 7 64 bit)

    Another problem I realized is that Unity crashed every time when I turn off the 'Attach Light' option and the attached light is enabled. :(
     
  34. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Any news on that problem?
    I made some screenshots from the sample scene.
    I'm frustrated that it doesn't work on my machine. :( . Can anybody confirm these problems?
     

    Attached Files:

  35. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    121
    Hello!

    I just bought this asset and it looks beautiful so far.
    However, if I use it with the standard Unity fog, the glow is always on-screen (in the fog colour), shining through objects.
    (It looks kinda weird to see glowing points though the terrain.)
    Is there a way to avoid this? It works fine without fog, but I'd rather keep it.

    - KW
     
    Last edited: Nov 2, 2016
  36. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    I finally got it work! :) I had to update my Catalyst driver to the latest version. Had an two years old one running.
    (But the problem with crashing when turn off an attached light still remain)
     
  37. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    121
    Edit: Alright, found the solution. =)
    Added "Fog { Mode Off }" to "FoggyLight.shader".

    - KW
     
    hilllo likes this.
  38. negativecap

    negativecap

    Joined:
    Jan 27, 2013
    Posts:
    98
    Foggy lights are awesome! Really look cool on my flickering torches. But I'm running into a problem. I need to have the foggy light nested in a prefab, and when I put it in there with a particle system the particles for some reason render through opaque geometry. With the foggy light disabled the particles are occluded. This is no good, and I'm wondering if you have any thoughts? (That's a character standing in front of a line of torches, and you can see torch fire through his chest!)

    FoggyLights.gif
     
  39. hollywoodcolor

    hollywoodcolor

    Joined:
    Jul 12, 2014
    Posts:
    35
    Can you do black fog lights?
    And could you then scale them just on y in order to do fake shadows or dust?
     
  40. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    264
    gorgeous! Gonna put this on the wish list, glad to see they are volumetric and not a faked billboard effect
     
    DavidMiranda likes this.
  41. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Are you using Fog? If so, can you try the fix Endorphin mentioned?
     
  42. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    This is an additive effect because it's meant for lighting effects. You could try to change the blend mode.
    We can't scale it in a specific axis because the shape is defined by code.
     
  43. NickHVenden

    NickHVenden

    Joined:
    Aug 3, 2013
    Posts:
    33
    Bought both FoggyLights and Fog Vol. Wonderful work, but the materials and shader i.e., the "FogMaterial" and its shader are hidden--not available outside of your demo scene. What am I missing? I'm in OS using Unity 4.5.5f1
    Thank you, looking forward to using this in my projects.
     
  44. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Hi!. Well, you don't really need the material for anything. All the parameters are exposed in the object.
     
  45. NickHVenden

    NickHVenden

    Joined:
    Aug 3, 2013
    Posts:
    33
    So great to have your instant reply.
    Solved what I was doing wrong:
    When I built a Foggy Light or a Fog Vol starting from an empty object, I needed to add the mesh filter and renderer before adding the script. Everything seems fine now.
    What you've created is really a beautiful solution for my "arty" project (about evanescence, spirit....)
    Thank you David!
     
  46. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Thanks. But... do you know there is a FoggyLight and FogVolume "creator"? Or maybe you are creating them in execution time?
     
  47. NickHVenden

    NickHVenden

    Joined:
    Aug 3, 2013
    Posts:
    33
    I'm getting some stunning effects by gently moving the fog, with its gradient, up/down along the Y axis.
    Your fog, as mist moving across the Unity ProWater, looks great as well.

    Yes the "creator" is there. I was thinking I had to build these at runtime/play, quasi-procedurally.
    As they say, the Allgor/ Sky Manager is not compatible. Maybe someday....?
    Thank you so much.
     
  48. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Allgor? Sky Manager? Do you mean Marmoset?

    2014-12-10_13-31-41.jpg

    About the crash when detaching the light component. I didn't crash before, but anyway, I have realized it's better to turn it off instead removing it. By doing so you will be able to keep your light parameters. I have also added Fog { Mode Off }
    I'll upload it right now!
     
  49. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    I'm having an issue... when I create a foggy light, I get this error. I'm not getting it in the sample scene...
    Thanks

    NullReferenceException: Object reference not set to an instance of an object
    FoggyLight.OnEnable () (at Assets/FoggyLights/FoggyLight.cs:62)
     
    Last edited: Jan 20, 2015
  50. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    187
    I just purchased foggy lights- it was working well for a few minutes then all of a sudden it stopped working, the light turned pink and I'm getting these errors

    It was working well- didn't change anything so I'm not sure what to do- any ideas? Thanks- On Unity 4.6.1 btw