Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Hx Volumetric Lighting

Discussion in 'Assets and Asset Store' started by Lexie, Aug 1, 2016.

  1. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Does it give you any kinda of error?
    Are you using dx9 or 11?
    Do you have the newest build?

    the next update will fix some issues with compiling in dx9 on some hardware (either no shadows or crashes when compiling the shaders) dx11 should work in the current build on all hardware that supports it though.
     
    Shodan0101 likes this.
  2. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    106
    Hi, I'm planning to get this asset, but is it only use for realtime light only?
     
  3. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Only works with real time lights.
     
  4. 5LS-Brent

    5LS-Brent

    Joined:
    Sep 17, 2013
    Posts:
    14
    Is it possible at all to use the omni volumetric fog lights but without actually using a light?

    I've been using this for a few weeks and love it but would like to be able to place a volumetric light in the scene with similar control over density and size etc without actually omitting light into my scene
     
    punk likes this.
  5. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I think you could add a non shadow casting light and set its intensity to zero. then in the volumetric light script, override the intensity to the value you want. Not 100% sure that will work.

    Ill add a dummy light script in the next update.
     
    Shodan0101, Drommedhar and punk like this.
  6. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    141
    Hi Lexie,

    I love your asset and Im really close to purchasing it and supporting you! Just a quick question, Im currently looking at two assets and I need to decide between the two uSky and AzureSky as my main illumination for my scene/game. Do you foresee any problems using your asset and for example AzureSky with open outdoor scenes with large open spaces and large scaled objects?
     
    Last edited: Sep 21, 2016
  7. MU-TH-UR

    MU-TH-UR

    Joined:
    Aug 16, 2016
    Posts:
    20
    Hi Lexie,

    Would you be able to release a demo with VR implementation when you get that settled?
     
  8. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    We are considering buying this. We have a lot of spotlights aligned in a row. Currently, we are using an open source image effect: SlightlyMad/VolumetricLights

    However, as you can see, the volume from each light gets added, so that that it gets very bright when there are a lot of lights aligned.

    How will this work with Hx? Can we avoid this additive effect?

    Here, three lights are aligned along the Z axis (sorry about the blurry resolution):

     
  9. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Thanks for this plugin! Works great on osX. MyImage-(162).jpg
     
    punk, Shodan0101, sarum and 1 other person like this.
  10. IronDuke

    IronDuke

    Joined:
    May 13, 2014
    Posts:
    132
    O_O
    *is mesmerized by the pretty*
    Nice scene!

    --IronDuke
     
    wetcircuit likes this.
  11. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Thank you...
    Here's a short video…. (It's for club visuals)…

     
    Last edited: Sep 23, 2016
  12. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    hi nice looking light man! :)
    does this work with unistorm?
     
  13. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    The math behind his and my plugin are really similar, Its based on how light scatters so my results will be pretty similar with the same environmental settings.

    If you increase the extinction or use tone mapping it will help with the overlapping light issue. My solution lets you map to LDR in the effect so you could use that if you don't want to use tonemapping.

    Not sure, the next update will allow users to more easily control when the volumetric effect renders to the screen, so it will boost the compatibility with other plugins.


    Hmm, not sure if they will work or not... Usky has its own volumetric pass for the sun, if you dont need point and spot lights you could just use the new version of it.
     
    Crossway and Shodan0101 like this.
  14. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,052
    Hey!

    I'm having some issues with using this in scenes which are very darkly lit (almost zero ambient light and no directional light), i end up with a lot of noise in the dark parts of the image:



    I've tried tweaking the settings back and forth as much as I can, but can't really get it to go away at all.
     
    Shodan0101 likes this.
  15. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    Very nice job.
     
  16. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Turn off Remove color banding, its in the advanced settings at the bottom. That will remove the grain effect.
     
    Shodan0101 likes this.
  17. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    You said you will increase "Extinction" to 4.0 but still it's limited on 0.5! that is not enough for me because I removed [ImageEffectOpaque] tag to make my image effects also effects lights too.
     
  18. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    I am having problems with Hx Volumetric Lighting and meshes created via ProBuilder. For some reason, my scenes keep crashing, either on playing/stopping, on saving or sometimes even just randomly. First I thought it was due to the complexity of the scene, but now I have created an scene with the following:
    - Main Camera with the Hx camera script (default settings)
    - One spotlight with the Hx light script (default settings)
    - One cube created with the default Unity method
    - One cube created in ProBuilder (default settings)

    If I turn off the ProBuilder cube, things work as expected. But if I turn on the ProBuilder cube, Unity crashes.

    I am using deferred rendering and Precomputed Realtime GI + Baked GI off.

    Using Unity 5.4.0f3 (a6d8d714de6f) on WIndows 10 (64-bit). I am not sure if it matters, but I recently moved the HxVolumetricLighting folder into an overall "Plugins" folder that I created.

    UPDATE:
    I decided to create a completely new Unity project and test out Hx with ProBuilder in an empty scene. As you can see in the GIF below, it crashes when I just have a simple ProBuilder cube and a volumetric spotlight. When I try to save the scene, Unity crashes.

    The same happens if I use ProBuilder's "Strip all ProBuilder scripts from scene" feature, which removes the special scripts from each object.



    UPDATE 2:
    I just played around with the sample scene. Did not add any ProBuilder stuff (in fact, I removed the entire plugin from my project, just to be sure). When I save Hx sample scene (having done no changes at all), Unity crashes. Why does this happen?
     
    Last edited: Sep 26, 2016
    Shodan0101 likes this.
  19. multiform

    multiform

    Joined:
    Sep 26, 2016
    Posts:
    1
    Hey guys!

    I've been testing your excellent lights out, and I've had no problems except for one admittedly show-stopping one . I noticed the lights leak memory (allocating around 30mb every 30 seconds or so) if Shadows are turned on. The program thus quickly bloats at runtime. Is this a known issue or unique to me?

    I'm on 5.4.0f3. Running on x64 (Win 8.1) and DX9. I checked both my own scene and the provided sample one to see if the leak persists; it happened in both. If shadows are left unchecked, memory is reasonably managed.

    Being that shadows are obviously a huge part of the effect, this is preventing me from using the package in my project. =(

    EDIT: I feel pretty dumb, I read further up the thread and saw the leak was adressed, updated the package, and that fixed the issue. Let my post serve as a heads up. =P
     
    Last edited: Sep 26, 2016
    Shodan0101 likes this.
  20. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    I experienced this the other day, but it was not related to HxVolumetricLighting, it was because I had moved pro builder to a folder called Plugins after which untiy was buggy as hell and crashed all the time etc - it may be unrelated, but I would try leaving both plugins installed in their default locations to see if that fixes your problem
     
    Shodan0101 likes this.
  21. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    Just tried opening a new project and re-importing both ProBuilder and Hx to their default folders --- same problem.

    However, I just noticed that even without ProBuilder, a scene that uses Hx (seems like the camera script in particular) will crash when I try to save it. I just open the example seen and press Ctrl+S, and then Unity crashes. Maybe this has something to do with the issue stated below?

    Using Unity Version 5.4.1f1 (649f48bbbf0f) with DX11 on Windows 10.

     
  22. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    Simply just remove ProBuilder right now, cause you can work with 3Dmax or blender a lot more easier.
     
    Shodan0101 likes this.
  23. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Sorry the last update was more of a hotfix to solve a memory issue cause in 5.4, the extinction has been expanded in the current update branch, it should be live in a few days, Sorry about that.

    Do you have the latest version of the volumetric lighting plugin? There was an issue with 5.4 that caused a texture memory leak, I coded a work around for it till unity fixes the bug.

    There is some code that runs when the scene saves, Its actually only needed for unity 5.1, I've cleaned it up so that code doesn't run in later versions of unity, The update will be live in a few days. That could be the cause of it.

    If you delete the script hxSceneCleaner it will stop the function from executing on scene save. This might have adverse effects but you could see if that's causing the issue. Ill do some testing my end to see if that's the problem.

    Does this issue happen if you haven't imported pro builder into a project at all? I'm working in 5.4.1f1 and not getting a crash when saving.
     
    Last edited: Sep 26, 2016
    Crossway likes this.
  24. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    Yes, it crashes in a completely new project where the only thing that has been added is the Hx plugin (I just assumed it was ProBuilder that was the culprit, but turns out it wasn't). I recently added Autosaver, which also saves the project whenever I go into play mode. This made it even more confusing, since it made Unity crash both when saving and when playing (i.e., auto-saving).

    Will try updating to the latest version of Hx tomorrow. Is there a way to see what version of Hx I am currently using?

    Removing HxSceneCleaner.cs does indeed seem to fix the problem. I just tried saving a few times without any crashing at all!

    Thanks :)
     
  25. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Nearly finished with a new update. It shaves off about 0.3-0.4ms from the tests I've done.

    I'm no longer using a float textures to store the depth and ray direction, instead I'm using a half texture and encoding the depth into it, I've noticed some GPUs struggling to render into float textures. So hopefully this change helps.

    Directional light also has less bleeding at large distances and removes unity's shadow bias correctly now. so over all less light bleeding.

    It also allows you to control exactly when the volumetric effect gets applied in the render queue so it will make it a little more compatible with other image effects.

    VR rendering was too costly because it needed to render 2 camera perspectives, so any speed increases I can make are twice as effective, So these steps are necessary to get VR support working.

    I'm going to start adding some speed improvements that will only effect shader model 4+, hopefully I can get them in before the update.
     
    Crossway and Drommedhar like this.
  26. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    That sounds awesome :D, Re VR - is it working in the new version, currently don't seem to work on shadowed volumes?
     
  27. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    no VR support isnt in the main branch yet, its coming soon though.
     
  28. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Nice one thanks ;)
     
  29. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    This seems like a Unity issue, but maybe someone here knows…? When I use a light cookie on a spotlight, then rotate the spot, the cookie/gobo is like a repeating texture that doesn't rotate with the light…. Is there a fix for this? I've been searching and I think I don't have the right search terms maybe….
     
  30. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    thought I'd drop a new pic - getting some really great results, thanks again
     
  31. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    This looks amazing, but I've got a few questions to make sure it'll work for me. I'm looking for lighting that will look good in game full of fishtanks, which means I need pretty precise control over where you do and don't see volumetric rays. It seems like the ability to drive haze density from a particle system is very close to exactly what I need. Is that system robust enough to handle the abrupt transition in haziness between air and a tank of murky water?

    Are there any other ways to vary fog density other than using a particle system? I really just need fog volumes in primitive shapes, a particle system seems like a very complex way to do that, although I'm sure it wouldn't be too hard to get it to look good.

    Is there a demo I could look at?
     
  32. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    This system is not meant for that, The way the density stuff works is it renders some information into slices stored along the Z of the camera, when the system checks to see how dense the air is it interpolates a value between the two closest slices. Even if I/you expanded the system to allow for meshes to render into the density slices, there isn't enough of them to contain all that dense material inside your fish tanks.

    The system you want isn't to hard to add. Ill put it on my todo list. Basically each light would store what primitives are in its light volume, And then when it checks the air density for a position in the air it would look for collisions with the primitives.
    right now I'm focusing on speed improvements and VR support, so it might be a while till its added.
     
  33. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I have not seen this bug before, Do you have your cookie texture set to the right light type in the import settings?
     
  34. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Ahh, maybe not. What should it be set to?
     
  35. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    This is on the texture for a spotlight cookie, The alpha from grayscale might not need to be on if you have an alpha channel in the cookie.
     
    wetcircuit likes this.
  36. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    I could probably make that modification, it sounds very reasonable.

    How will it break on the tanks? If it just doesn't work on tanks far away from the camera I can work with that, I was probably going to turn it off for performance reasons on those anyway. If it 'leaks' on tanks close to the camera that's a bigger issue.
     
  37. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    It would look bad, trust me. If you had anything in front of the tank it would look like it was inside the tank because the dense air would leak in front.

    The primitive way I mentioned is the way to go and would probably be faster as well and give much better results, downside is its limited to primitive shapes
     
  38. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    106
    wew, I bought it and I really like it. But does it working fine with Mixed Directional Light? Coz I still able to see effect(I don't know what it call) or fog when the environment is cover up

     

    Attached Files:

  39. paxilon

    paxilon

    Joined:
    Aug 9, 2016
    Posts:
    25
    @Lexie
    I am using DX11 and still get as it seems randomly crashes without any error. Once I just simulated a particle system or I converted an EXR as a cubemap as well as have quite a lot geometry . I am using an GTX 1080 here. Are there known problems with that kind of build. Still using Unity 5.4.0f3.

    I really would love to implement your work in our projects here. That would be awesome :)
    Thanks for your support!

    EDIT: I always can make unity crash, when I add the HX Camera, HX Light to a directional light and then move an game object and hit Save = Crash

    In the Console I get this notification:
    OnLevelWasLoaded was found on HxVolumetricCamera
    This message has been deprecated and will be removed in a later version of Unity.
    Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed

    Whe I click it the HxVolumetricCamera opens up an marks this line:

    VolumeScalePID=Shader.PropertyToID("VolumeScale");

    Sorry for more Edit :p : I just tried to exclude "ExecuteInEditMode" and I can save again but of course can't see any changes right away. Is there maybe a null check or something like that missing and my PC is running out of memory while saving because of that?
     
    Last edited: Sep 29, 2016
  40. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    If you delete hxSceneCleaner it will solve your issue, Its needed for older version of unity, But in unity 5.4 the functions it calls crashes some peoples computers, Im pushing an update that disables this in unity 5.3+ so you can either wait for that or just delete hxSceneCleaner for now.
     
  41. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646

    Looks like ambient light, On the hxVolumetricCamera script, Set ambient lighting strength to 0.

    If its not that it could be your shadow strength on your directional light isn't set to 1. You can override the shadow strength for the directional light in the hxVolumetricLight script, tick the checkmark next to shadow strength and set it to 1.
     
  42. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Change log 1.0.4

    Fixes

    • Fixed issue with some cards and dx9 not sampling shadowmaps correctly.
    • Fixed light bleeding on directional light due to unity's shadow bias. The calculations will now reverse unity's directional light bias so bleeding on thin walls/distant objects should be a lot less/zero.
    • Fixed bright spot when sunsize was set to zero
    • Fixed texture memory leak on some version of unity 5.4 (was fixed in 1.0.2b)
    • Fixed the Remove color banding option applying too much grain to the scene causing low light conditions to look overly grainy, Recommend using it now for all the people that turned this feature off.
    • removed one blit function so people should see a tiny speed improvement.
    • Fixed issue with flash on the left side of the screen with some rendering setups.
    Changes/Additions
    • Added the ability to control when the volumetric effect gets applied. (will write up a description in documentation)
    • Switched over to using 16bit rgba texture to store depth and extra information when doing low res rendering. This should speed up rendering on some older cards.
    • Increased extinction range. (was 0-1, now 0-10)
    • Implemented automatic shader stripping. HxVolumetric will now only include shaders actually used in your project. This will significantly speed up build times and lower project file size. for example the default settings will now only build 30ish shaders rather then 1000+.
    • Adding HxDummyLight, This allows you to have volumetric light with out needing to use a unity light. (doesn't support shadows of course)
    • WarmUpShaders has been removed, the system will warm up the shaders you use automatically now.
    The automatic shader stripping was really important to add as it was preventing me from expanding the system with new functionality while also keeping the shaders optimized.

    I think that's all the changes, i'll update this if i can remember anything else I added/fixed.
    I'll push the update in a few hours. Might take unity a day or two to approve.

    I'm going to start working on some demo scenes people can test before buying and a bit of marketing material for now.
     
    Last edited: Oct 1, 2016
    Crossway, Drommedhar, rrahim and 2 others like this.
  43. pgeorges-dpt

    pgeorges-dpt

    Joined:
    Apr 7, 2016
    Posts:
    43
    Hi ;) When can we expect VR support? Thanks!
     
  44. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Still working on that, the above changes were really important before bringing it to the main branch as my shader count was starting to get crazy out of hand. I think my build times where like 4mins every time I changed a script. Now its only a few seconds.

    The next couple of weeks are pretty busy for me, weddings/holiday/steam dev days, Ill try and find some time between it all to get it into the main branch but I might not be able to get it done till after steam dev days... Will see.
     
    punk and Drommedhar like this.
  45. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    Nice changes, I hope asset store approve this new update sooner.
     
  46. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi,

    I'm working on a 'very' large world. I have tested in the past many 'Volumetric Lighting' solution that did not work. I tired of spending money for nothing, so, do you have a trial version?
     
  47. MrArcher

    MrArcher

    Joined:
    Feb 27, 2014
    Posts:
    106
    Hi Lexie,

    Do you have a quick fix to enable VR, even if it's not yet optimized? Or is it a substantial reworking of existing code. I was hoping to do a couple of 360 Renders in time for an industry event. No worries if not, happy to wait for the updates :)

    Thanks! Looks great!
     
    Skyfly likes this.
  48. SERIOUSFRAMES

    SERIOUSFRAMES

    Joined:
    Oct 2, 2015
    Posts:
    3
    Dear Lexie,

    I bought the asset today to add nice volumetric light into a church i'm currently working on but I get a strange behaviour.
    I also tested this one with same results.

    In fact, most of my scene is baked in Unity 5.4 and the volumetric effect ignore all those baked objects. Non-baked object works as expected tough. So in my case, the walls and windows are completely ignored, and i can see the sun on top of it :D

    bakedobjectsignored.jpg realtimeobjects.jpg

    Am I doing something wrong ?
    I though of creating a non-baked and hidden dummy shell for the church but it would be time consumming huehuehue
     
  49. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Unfortunately unity's baked lighting isn't in a format that can be ray marched by the volumetric pass. Only shadows that are rendered in to the dynamic shadow maps will block volumetric light.

    If you duplicate the church model, Remove the static flag, you can change the setting on the mesh render called Cast Shadows, set it to shadows only on the duplicated church, That way it will render into the shadow maps and block the volumetric light and you can still have baked lighting on the church.
     
  50. SERIOUSFRAMES

    SERIOUSFRAMES

    Joined:
    Oct 2, 2015
    Posts:
    3
    Mkaaaaay, thanks for the explanation.

    So today I tried the duplicate shell workaround but I wasn't sastified since it add unwanted shadow on my baked objects (which is kinda logic :D). So I tried to duplicate my sun in order to have one full baked directionnal light (it was on "mixed" preset), and one full realtime directionnal light with your HX script on it, just to see the behaviour. And.... it works ! I don't know if it's suppose to, but it gives me the expected result.

    It feels like :



    Here's a couple of screenshots :

    duallights.jpg duallights2.jpg
     
    Skyfly, Shodan0101 and hopeful like this.