Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

[RELEASED] Hx Volumetric Lighting

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

  1. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    187
    Ah right - I'll try that - thanks very much Lexie.
     
  2. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    43
    Hey Lexie, I have been following the development of this and another asset for a while now and have been pondering what the difference(s) between yours and the one called DeepSky Haze is/are (not just in terms of features, but also in terms of performance). Many thanks in advance!
     
  3. xmanoux

    xmanoux

    Joined:
    Jul 9, 2015
    Posts:
    19
    Edit two days later : I found what is the cause.
    I tried to use a "transparency terrain shader" (easily findable code on the web) that allow transparency textures in unity terrain.
    If I do that, it seems to broke any Hx volumetric effects in the scene or issue unpredictible behaviour.
    I've reverted this shader, and remove some Hx Lightning effect and reinsert them, and now volumetric effects work.
    the problem is I made lot of use of terrain transparency shader for a particular effect ( lighting and artistic stuff from below) and so I don't know what should be my strategy now. Do you think this problem is something that could be fixed ?
     

    Attached Files:

    Last edited: Nov 25, 2016
  4. Purpleshine84

    Purpleshine84

    Joined:
    Apr 8, 2013
    Posts:
    185
    Thanks a lot for your long answer!! That helps me a lot.
     
    wetcircuit likes this.
  5. Rumbleboxer

    Rumbleboxer

    Joined:
    Dec 26, 2012
    Posts:
    27
    Hi @Lexie , I'm not sure what I did wrong.. maybe I didn't set it correctly but I'm getting some strange lines with the fog in my scene. Here are some screenshots of it. It becomes more obvious when you are moving... could you take a look?





    I was using the lowest settings so I bumped everything up but still am getting these lines.. what could be the problem?
     
  6. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    310
    Just a quick note to let you know I've recently integrated Hx Volumetric Lighting into my personal project, and it looks fantastic in interior spaces. It's not quite right for my outdoor scenes, as it occludes the skybox more than I'd like (I'm using uSky) and doesn't feel enough like atmosphere- As mentioned earlier Raleigh scatter + generated skybox would be really helpful to avoid swapping between post effects, hoping this is still on the roadmap.
     
  7. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    198
    Hi,
    I'm not sure if and how I changed anything, but suddenly my lights are not volumentric anymore when their Shadow Type is "No Shadows". This also happens with a fresh project in the Example Scene already. It worked some time before.

    Unity is 5.4.2f1
     
  8. mbbmbbmm

    mbbmbbmm

    Joined:
    Dec 28, 2013
    Posts:
    58
    Hi, I think I found a bug: in VR theres a small white quadratic artefact visible that seems to be linked to the directional light. Happens in 5.4 and 5.5 with the Vive.
     
  9. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Its hard to make out what the issue is from these screen shots.

    Does it look like there are bands of light? On my monitor I'm not seeing them but if i boost the contrast i can.
    Banding in low light is more noticeable on monitors that don't have a large color gamut so that could be why your seeing the banding and I'm not.
    If this is the issue your seeing, there is a option called "remove Color Banding" in advanced settings. Enabling this would help if this is the issue you are seeing.

    It might be due to the temporal sampling. Try disabling that to see if it changes anything. If it does you could lower the min and max feedback to make temporal sampling use less information from the past frame, You might need to set dither speed to 0 if you lower these settings too much though.

    The last thing I can think of would be it feels like there is kinda night vision where you can see the outline of surface changes though the fog, This is due to an artifact caused by depth aware upsampling and blurring, It can be mitigated by either increasing the sample count and/or rendering at half resolution instead of quarter. Large blur counts tend to make the effect more noticeable so it is recommended to have the sample sample count high enough to make the volumetric pass look good/acceptable with only 1 blur pass if you need to reduce this "night vision effect outline effect". Normally you don't really notice this effect but because your game is so dark it might be the issue your talking about.
     
  10. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Thanks ill have a look, Is it in the direction of the directional light?
     
  11. mbbmbbmm

    mbbmbbmm

    Joined:
    Dec 28, 2013
    Posts:
    58
    Yes, when I rotate the directional light it changes position as well, when I have e.g. two directional lights from different directions there's two artefacts as well etc.

     
  12. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    198
    Wish I would get an answer too! What caused the removal of volumetric lights for lights that don't cast shadows?
     
  13. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Sorry i had to download and install that version to see what the issue is, Im looking into it now.
     
  14. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    198
    Oh, okay. Which version should I rather use?
     
  15. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Fixed the bug. Just testing in VR now and ill upload a build and send you a download link. Sorry for the wait.
     
    ratking likes this.
  16. Amy_Lee87

    Amy_Lee87

    Joined:
    Sep 29, 2016
    Posts:
    8
    Hiya :)

    Your asset is wonderful. I can't, however, use it on most of my maps due to the fact that my game involves a lot of islands, lakes, rivers, and oceans.

    Bodies of water aren't effected at all by the volumetric lighting. This makes them look so incredibly out of place.

    I read above that you do know how to fix this issue. Any updates or ideas on how to sort out this issue?

    Thank you. It's a great asset and worth every penny.
     
  17. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    I got warning:
    "
    Shader warning in 'Hidden/HxVolumetricSpotLight': 'SHADOWS_NATIVE' : macro redefinition at HLSLSupport.cginc(236) (on d3d11)

    Compiling Vertex program with SHADOWS_NATIVE
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP"

    when building in 5.5.0f3 ver 1.1.3

    should I be worried?
     
  18. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    62
    Hi. Is it possible to create a light with a different shape than a spot/cone light? E.g., using a cookie to create a squared light?

    Below is an example of a squared light using a cookie. However, the volumetric light is still cone-shaped.

     
  19. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    187
    Ditto on the use with water. Aquas has a custom fog feature which allows the faking of fog on the water to match the actual fog, but that's an alpha dependant shader, and most fog assets use the z-buffer, apparently. This is quite a royal pain in the proverbial when it comes to adding haze and fog to scenes with any larger body of water, or rivers. It'd be great to have a better solution.
     
  20. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Nope, the shader actually compiles it out for that version of unity when it builds.
    Its a limitation of unity its self unfortunately. Unity is working on making dynamic area lights but it might be some time. I could add custom shapes but they wouldn't be able to cast lights onto surfaces. Ill look into adding near plane support, you could probably fake it using the lights near plane and a cookie.

    Edit: Also when using a cookie on a spot lights and deferred rendering, its best to stay with in a circle, unity can do some strange stuff when viewing from different angles as it uses a cone mesh to render the spot light in deferred mode
     
    Last edited: Dec 5, 2016
  21. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    89
    Hi, Im getting this error when I editing the scene with Occlussion Visualization
    upload_2016-12-6_16-18-0.png
     
  22. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    38
    hi, I am using Vive with Unity 5.4.
    i turned on the single pass rendering. when I use the script, it looks like there's some kind of translucent plane right in front of my eyes, and it moves as i rotate the head. Also the sun is only visible on the left eye, and it keeps moving as i rotate the head, rather than staying stationary in one place where the light source is.
     

    Attached Files:

  23. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Ill have a look with that version of unity. Looks like an issue with the temporal sampling.

    Ill have a look into it. Thanks for the report.
     
  24. n00body

    n00body

    Joined:
    Dec 17, 2010
    Posts:
    691
    Greetings.

    Not sure if I ever mentioned it here, but Alloy now has easy integration with Hx Volumetric Lighting.
    To use it, just do the following:
    1. In "Alloy/Shaders/Config.cginc" under the "THIRD PARTY" section, un-comment "#include "Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxVolumetricCore.cginc"".
    2. In our "*.shader" files, do a mass replace of "//#pragma multi_compile __ VTRANSPARENCY_ON" with "#pragma multi_compile __ VTRANSPARENCY_ON" to un-comment it.
    Now you're good to go. Enjoy. ;)
     
    KarelA, elbows and punk like this.
  25. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    transparency supported failed on 5.5.0p1, using latest 1.1.3 version. ScreenShot from fresh import into fresh project.
     

    Attached Files:

  26. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    I wasn't able to replicate this, What version of 5.4 is it. Keep in mind VR is only supported in 5.4.1 and above as stated on the asset store.

    I've also fixed a bug where the directional light can cause a 8x8 white pixel block.
     
    Last edited: Dec 12, 2016
  27. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    This is additive particles, This is what transparent additive particles would look like with those settings. Either add more alpha to those particles or add more extinction and set extinction effect to 1 or use a different transparency shader.
     
    Last edited: Dec 12, 2016
  28. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
  29. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    OCASM expressed interest in HX on the 5th page of this thread, and looking at his code I think it'd be quite simple to do so. I think there's a good chance you'll get your wish.
     
  30. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    So I finally actually bought this and first of all it's great. So far so good on modifying it to create density from primitives.


    I'm experiencing some visual bugs with directional lights. They're most visible if you turn up the extinction effect, but they exist no matter what value it's set to.

    The first broad category is angular artifacts on the upper portion of the screen. They look like shadows, and they vaguely reflect the geometry of the scene. You can the suggestions of the arches in these screenshots. (First two screenshots, irritatingly labeled 3 and 5)

    The second category only seems to happen when the camera is pretty much perpendicular to the angle of the light. Under these circumstances, the extinction suddenly gets very abrupt, like light is traveling until it hits the plane containing the camera and then being absorbed almost instantly. If you look a few degrees to either side, it works as intended. It doesn't seem to happen if the dark region contains geometry. (Final 3 screenshots, also irritatingly labelled.)
     

    Attached Files:

    Last edited: Dec 22, 2016
  31. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    It only let me attach 5 images, so I have to make a second post, sorry.

    I've modified the point light shader to restrict fog to a cube around the world origin. I still have a lot of work to do, but I'm pretty sure this will work out.

    A few other first impressions:

    This effect is really shockingly fast. I'm on good hardware, but I can arbitrarily max everything and stand in a fullscreen light with shadows and it doesn't hurt my FPS at all.

    I had a problem with shadow cascades and had to disable them, but I'm pretty much sure it was a Unity problem and not an HX problem.

    Cookies in HX are really incredibly powerful. I was looking for a way to get volumetrics coming off of a lit panel, and a rectangular cookie shaped like the panel and a spot light really covers it. I had to add a minimum distance to the spotlight shader to stop it coming out the back of the wall, and right now that's a hardcoded hack, but it wasn't hard to get working.

    There's been some mention of supporting colored cookies; I tried to fake that with a red, green, and blue spotlight and it worked perfectly -- the colored light shafts look amazing, the nicest light shafts I've ever seen in a game. One would think doing it like this with three lights is pretty expensive, but I'm still getting 200+ FPS standing in the middle of the light, so I guess it's okay.

    I noticed that spotlights in HX are cones, while spotlights in Unity are more like square pyramids. If cookies extend beyond the edge of the circle, they don't get Volumetrics. That's been mentioned before, and it isn't the biggest limitation, but spot light cookies would be more useful if they could use the full texture resolution. Square or rectangular directional light sources are pretty common, I'd use square cookies for lights coming through windows and light coming off of screens. Inscribing them in a circle wastes a lot of texture resolution, which isn't the end of the world, but it would be great if I didn't have to. (It also means that existing rectangular lighting cookies have to be adapted to work with HX, which is inconvenient.)

    Support for cookies on directional lights would be helpful. The repeating mode seems like it would be complicated to implement and it isn't that useful, but the non-repeating mode would be very useful whenever you wanted direct control over some straight light shafts, and I don't think the implementation should be too complicated -- it seems like you'd just march through a square prism in much the same way as you march through a cone in spotlights and a sphere in point lights. But I'm just learning about this stuff now, so of course I'm not really sure.

    I get bad artifacts from temporal sampling when I move the camera quickly, but that doesn't matter because it's no big deal to run it on full resolution with temporal sampling turned off. I might not have temporal sampling set up correctly.

    It's a little weird that ambient lighting doesn't work unless there's a directional light in the scene, but fortunately there's an easy workaround: a directional light with the color set to black allows ambient lighting to work without contributing any light to the scene.
     

    Attached Files:

    Last edited: Dec 22, 2016
  32. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    5.6 went into beta and supports vulcan, will there be benefits for volumetric lighting for switching into vulcan?
     
  33. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    77
    This is propably the best purchase I made in the AssetStore. I use the Asset extensively in my project and in the meantime it became mandatory for its whole artstyle.

    Keeping that in thought I was very confused when I built my project and noticed heaviest artifacts in darker areas(1), not apperant in Unitys Play View(2)!




    I am aware that there is the "Remove Color Banding" option. This results for me in even more distracting artifacts in the built. It looks like the camera lens is really dirty.




    I tried to play with all the settings but didnt saw any results at all. The artifacts are definitely caused by this asset since I tried to disable the other ones. It is also independent of Hx particle systems. Am I missing something?
     
  34. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    I've got it working with a point light and a single transformed sphere. I had to do some nonsense to get it to respect translation, dunno why, but it looks pretty good.
     

    Attached Files:

  35. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    I've gotten my tanks looking pretty good (gotta work on my glass material, but the volumetrics look great)
    HXFishTanks.PNG
    I am running into some problems with transparency though.

    I'm getting artifacts on transparent surfaces at a specific angle (the angle of my spotlight).
    HXTransparencyArtifact.PNG

    Also, when I look at a very dark transparent object through fog, it seems to get brighter. The sphere in the distance is clearly visible through fog even though it's totally black elsewhere. Is there anything I could do about this?
    HXTransparencyBrightness.PNG
     
  36. imtehQ

    imtehQ

    Joined:
    Feb 18, 2013
    Posts:
    230
    I keep getting this error:
    Unity 5.5.0f3
    hx 1.1.3

    Any idea?
     
  37. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    1,026
    Hi I sent you an email the other day and have not hear back, maybe you dont check it.
    1) I cant get the effect to work on XBox One. You say it has console support, but I cant seem to make it work.
    2) when I updated to 5.5, and am in XBox compile mode I get all of these errors about VR support not existing.
     
  38. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Sorry everyone, Ive been away on holidays and away from my computer for some time.

    I'm back at work now and already have another version with a few more fixes.

    Right now I'm working on adding unity projection support, some uses have asked for them.
    They wont handle shadows though.

    Ill look into whats happening there. I'm guess some of the compiler flags for VR don't exist, Ill have to do a check if its compiling for xbox first then.


    Not sure whats happening there, I haven't seen that happen before. That null value is saying the camera its attached to no longer exists, Are you deleting the camera after it starts to render the frame?


    This is a really simple effect to add, It would be able to work with density particles as well so that would be good. Issue is it would really only support opaque geometry though. Ill mess around with it when i get some spare time.
    Hmm, ill have a look and make sure the shaders are including the version that removes the color banding. Not sure what else would cause that issue.

    Looks like its repeating the shadows, There must be an issue with how I'm calculating the cascade position that's causing it to loop. Ill have a look.

    The thing with needing something in the view i could solve, I already have a fix for spot and point lights so ill add that fix to the directional light as well.
     
    JohnRossitter, elbows and Arganth like this.
  39. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    In the spot light shader there is some code to find the entrance and exit points of a ray vs a cone. I could change it so its vs a pyramid instead. That would give you the full cookie. I use a pyramid already to render it to the screen, so thats the only things that would need to be changed.

    Edit: Ive modified the shaders to use a frustum instead. need to do some more testing to make sure everything works, But you should be able to use the full cookie texture in the next update.
     
    Last edited: Jan 11, 2017
    brisingre likes this.
  40. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    Awesome! You're the best.
     
  41. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    1,026
    Thanks, looking forward to some resolution on these :)
     
  42. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    I've got a beta ready for the next patch. If you would like a download link to the beta, Just send me a PM with your invoice number.

    1.1.4
    Fixes

    • IMPORTANT- There was a bug with my gamma support that caused the color to not apply to the scene correctly.This has been fixed but will mean people that use Gamma space will have to modify their settings, Sorry.
    • Directional light not calculating correct cascade settings in some situations. The situation was generally when you had no shadow casters behind the camera or no distance shadow casters.
    • Fixed issue with temporal sampling darkening results in gamma space.
    Added
    • Temporal sampling in editor mode will render extra frames to accumulate correct results when a lights settings are changed.
    • Spot lights now have a has a plane setting.

    Changes
    • Change - Spot light shape has been changed to a frustrum to support full use of light cookies.
    • Change - Extinction range has been lowered from 0-10 to 0- 0.5 the only reason some users requested a higher range was due to the gamma bug.
    • Map To LDR is now optional if you're not rendering in HDR.
    The issue with the color not calculating correctly in Gamma space was causing a lot of smaller issues users were having.

    Known bugs.
    XB1 not compiling because of VR flags.
    Transparency support in newest version of unity has issues with some material settings.

    I'm working towards version 1.2 with some new features. Hopefully I can have those finished soon.
     
    Last edited: Jan 17, 2017
    brisingre, punk and Karearea like this.
  43. imtehQ

    imtehQ

    Joined:
    Feb 18, 2013
    Posts:
    230
    The camera issues where fixed, not sure how i did it tough XD
     
  44. Obsti

    Obsti

    Joined:
    Feb 19, 2016
    Posts:
    1
    Hi. We recently started incorporating your tool into our next 2 projects and overall the results have been incredibly good.

    But now I've stumbled across a bug that is preventing us from properly shading our glass and window assets. We are using your modified Unity Standard Material, which works fine overall but looses all inputs whenever we place a (any) texture into the metallic slot.
    Using Unity 5.5.0f3 and your latest release.
    Here is a screenshot of the problem in inspector and console:
    HXVolumetric_Metallic_bug.jpg
    Is this a known bug or something only we are experiencing?

    Cheers
     
  45. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Thanks for the report, Working on a fix for it today.
     
  46. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    122
    Hi,

    we started using the HXVolumetric/Standard Shader for some cases, however Cloud Build now fails with this error message:
    39821: [Unity] Shader error in 'HxVolumetric/Standard': invalid subscript 'boxMax' at Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxUnityStandardCoreOld.cginc(247) (on metal)
    39822: [Unity] Compiling Vertex program with DIRECTIONAL
    39823: [Unity] Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP
    39824: [Unity] (Filename: Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxUnityStandardCoreOld.cginc Line: 247)
    39825: [Unity] Shader error in 'HxVolumetric/Standard': invalid subscript 'boxMax' at Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxUnityStandardCoreOld.cginc(247) (on glcore)

    Since we heavily rely on Cloud Build we really need to get rid of this error. Any idea what is causing this problem?

    We are using the current Asset Store version.
     
  47. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    Thanks for the error message, i found it.

    Edit: Looks like this is actually a little more complex, going through and redoing the transparency support for each version of unity now.
     
    Last edited: Jan 18, 2017
  48. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    110


    What sort of performance can I expect from this, for reference? I'm currently not on my main dev machine (Lenovo Y470 laptop with Nvidia GT550), but I tried adding a volumetric light to my scene and I got these results. All settings are default except render resolution, which was set to Quarter instead of Half.

    I can optimize if need be, but just checking: is this normal? Or am I doing something inefficiently?
     
  49. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    122
    Ok, thanks just let us know when you got it working! In the meantime i'll add a (positive) AssetStore review ;)
     
  50. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    617
    With version 1.2 comes the ability to define the density with-in an area by using the HxDensityVolume script.
    I've pushed a build to the asset store, Just waiting on approval.

    Simply add a HxDensityVolume script to a game object and use the gameobjects transform to rotate/scale/position the volume in the world. It comes with 4 blending options and a density setting.

    Limitation
    • Each light can only contribute to a maximum of 25 volumes.
    • Only supports rectangular prisms (open to requests for more shapes)
    Fixes
    • Transparency support now works for newer versions of unity.
    • The Included standard shader now supports metallic texture.
    Changes
    • If transparency support is Off the effect will now render over the top of transparent objects by using a script that automatically gets added to the camera called HxVolumetricImageEffect. Changing the position of this script will change the draw order with other image effects.
    • If transparency support is On then a script called HxVolumetricImageEffectOpaque will apply the image effect instead. Changing the order of this script will change the rendering order with other opaque image effects



    upload_2017-1-19_17-3-12.png
    Image of a hxDensityVolume floating in the air
     
    punk, Obsti, elbows and 2 others like this.