Search Unity

[RELEASED] Hx Volumetric Lighting

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

  1. kentmw

    kentmw

    Joined:
    Nov 1, 2016
    Posts:
    4
    I don't want to bother you when you know there are some bugs in the latest patch, but I'm wondering if anyone had this type of error. It was working great showing volumetric lighting in a 2D world, then I updated and my camera view looks like this. Hope it's just the latest bugs in 1.1
     

    Attached Files:

  2. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Are you thinking of mie scattering
    Setting Mie scattering to something high like 0.8-0.85 would give you a similar look as the above image.

    You can simulate in scattering a few ways currently. Override the shadow strength on each the light and set it to 0.1-0.2 (causes bleeding) or add bloom to your game.
     
  3. OCASM

    OCASM

    Joined:
    Jan 12, 2011
    Posts:
    328
    I actually haven't bought your product yet because I'm short of cash, but with Unity's version being DX11 it's just a matter of time :p

    The effect I'm talking about actually consists of blurring the scene behind the fog depending on how dense this is. Bloom is essentially a blur of bright areas in a scene so that's why it looks similar.

    I think these are better examples from the real world:




    Some time ago I tried to achieve the look with a simple depth-based blur post processing effect for the standard global fog asset in Unity:





    As you can see it gives a soft look which ends up looking much more realistic, shrouding the mesh instead of just being on top of it. Since your product is essentially fog, which is then affected by lights (instead of the old method of lights creating their own fog) it makes sense to add such an effect for added realism.

    Just my two cents.
     
    Last edited: Nov 2, 2016
  4. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Ok, I think everything is solved and I have temporal sampling all working, Going to submit first thing in the morning, For now I'm going to bed. Sorry for the bad build everyone. Should be all sorted out soon.
     
    Crossway and MrArcher like this.
  5. MrArcher

    MrArcher

    Joined:
    Feb 27, 2014
    Posts:
    106
    Thanks so much for the hard work, Lexie! The copy I'm using is on a company account but I'll see if I can get permission to leave a review from it :)
     
  6. shawnblais

    shawnblais

    Joined:
    Oct 11, 2012
    Posts:
    324
    Just curious, if you submit today, when would it go live? Any chance you can post a link to the current version, or PM?

    Just working on a VR prototype, and it would be great to be able to dial in our lighting for the scene.
     
  7. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Ok version 1.1.1 has been pushed to the asset store

    Changelog

    Temporal Sampling

    This effect is on by default and will allow you to drop the sample count on the lights to a very low number (2-8)
    I've modified the defaults sample count to reflect this change. The effect costs around 0.1ms and gives you the illusion of a sample count about 3-4 times greater.

    VR support
    There were a lot of bugs in the first build for VR, Single pass and two camera setups should be working correctly.
    Temporal sampling works with VR as well.

    Bug fixes

    Lots of bug fixes, Should be back to normal now. Let me know if anyone has any issues.

    If you would like the build before its live on the asset store. Please PM me your invoice number and ill send you a build.
     
  8. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    The new 1.1.1 works well in 5.4.2, but in 5.5b10, temperal sampling seems to introduce a strange shadow bleeding effect.

    Picture is fresh import into an empty project and in play mode, linear color space.
     

    Attached Files:

  9. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    COOOL, Ill download the beta and see whats happening.

    Edit: Looks like unity have changed the way depth textures work in 5.5b Ill have to figure out whats changed.
     
    Last edited: Nov 3, 2016
  10. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    New version still have the same issue. you are killing me :D
     
  11. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I am curious that many users have asked for web demos and you have ignored them, I have very strict standards and have had annoying experiences where products looked good but weren't practical or performent. I need a web demo to trial this plugin before I can take it more seriously.
     
  12. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I've been adding features I had promised from the start so I haven't had time to set up some web/downloadable demos. Once all the bugs for VR are sorted out ill dedicate time to making marketing material and demos.

    This plugin is something I use for my game, so It's more important for it to be functional and performent than to market it.

    TLDR: Right now I only have enough time to work on my game + add features i had promised. Once those are added I can add marketing/demos to the list.
     
    Last edited: Nov 5, 2016
    Skyfly, rrahim, yc960 and 2 others like this.
  13. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
  14. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Transparency support is only for things close to the camera, Generally around 32-64 units away.
    For a cloud system you would normally render before the volumetric pass.

    To make this render and get affected by the volumetric lighting you could resample the results for the volumetric pass. Its not the best solution but the easiest.

    Modify the CloudBlender.shader

    Add this sampler to it

    sampler2D VolumetricTexture;

    Then edit this line

    half4 output = tex2D( _MainTex, input.uv);
    to
    half4 output = tex2D( _MainTex, input.uv) + tex2D(VolumetricTexture, input.uv);
     
    Last edited: Nov 7, 2016
    yc960 likes this.
  15. Ulther101

    Ulther101

    Joined:
    Jun 26, 2016
    Posts:
    3
    Hi, getting an issue very similar to this, wasn't with earlier version. Hopefully you have some idea what it is, cause I have no idea :)

    Thanks
     
  16. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    In the unity 5.5 b10 it doesn't work correctly, sky becomes black.

    Almost I made all my assets to work with Unity 5.5 except this asset and SEGI.
     
    Last edited: Nov 8, 2016
  17. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Unity changed the way the encode and decode functions work in the graphics backend.
    I've solve that problem but I can't get spot lights working. Still tracking down what they changed.
    The shadow map I'm getting from the light seems to be empty.

    Unity tends to change a lot of backend render stuff between every beta so I won't be releasing a version that supports 5.5 until its officially released. Ill PM you a build that resolves the black sky issue though.

    EDIT: Honestly expect this to happen with this package everytime unity updates something major. They change all the backend rendering for lighting/shadows pretty much every time, its actually the worst.
     
    Last edited: Nov 9, 2016
  18. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    True, unity 5.5 changed lots of things to resolve some old limitation and issue, I think it was worth it unity is now a lot better.
     
  19. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I see what they change in the backend every time that effects this plug-in, I can assure you nothing has gotten better when it comes to shadows and dynamic lighting.
     
    Crossway likes this.
  20. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    This pic is from HX example scene can I remove this big sun (light resource) without changing Mie Scattering?
     

    Attached Files:

  21. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Some options
    1)You can enable Map to LDR in the advanced settings to map the HDR image to an LDR image if your not doing tone mapping your self.

    2) Use height fog so the sky isn't as foggy as the ground.

    3) lower the air density to a small number and use density particles in areas you want to be more foggy

    4) Increase the extinction and extinction effect
     
    Crossway likes this.
  22. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    I am still not able to make noise feel cloud like. if no plan to rework it just add a magnitude slider so I tweak it myself.
     
  23. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Don't worry I haven't forgotten about improving the 3D noise, Just been a little busy adding everything else.

    I'm currently working on a bunch of looping baked Perlin + value noise textures so you will have a bunch to choose from and ill add a contrast slider as well.
     
    wladm, yc960, elbows and 1 other person like this.
  24. wladm

    wladm

    Joined:
    Oct 4, 2015
    Posts:
    7
    Can't wait for that update as well! Amazing asset btw!
     
  25. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I think I have unity 5.5 support all sorted, Just waiting for the next update of the beta because a couple more things are meant to be changing. Basicallly in some cases all the zDepth is reversed. As you can imagine this would cause some issues when working with the Zdepth directly.

    I've also fixed an issue with spot lights not showing up in some cases when you build out a player.

    I'm working on 3D noise now as well as a tool to generate your own 3D noise textures.
    I might just open source this part of the tool as its using an open noise lib as a backend to generate perlin noise.
    The tool works by generating a lot of different 3D tileable noises at different resolutions and then blending them together to make interesting noise patterns.

    Here are some samples so far. These are all 3D textures that tile.



    The old noise was just straight up static, so it would be impossible to generate cloud like structures. Needed to do this before i bothered expanding it.
     
    Last edited: Nov 11, 2016
    CWolf, punk, yc960 and 1 other person like this.
  26. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I've submitted version 1.1.2 to the asset store.

    Unity 5.5 beta is supported now.
    VR + Single pass stereo + forward rendering should work correctly now.
    I've added better 3D noise as well as a contrast slider for it.
    Edit:Fixed is with enabling/disabling the script with temporal sampling enabled.
    Added the ability to change the amount of slices the density particles and transparency support use.

    As always, PM/email me your order number and I can send you an early build.

    Updates should start slowing down soon as this build should hopefully be very stable.

    There are three things id like to add still.
    Zones - make it a bit easier on level designers, This would either control all the lights in the area or modify the current cameras settings and do some blending between zones.
    Personally i rather using density particles to do this as they look a lot nicer and arnt too expensive to render if you use temporal sampling.

    Atmospheric scatter - Right now the directional light only calculate Mie scatter, If i add rayleigh scatter it will give better results at large distances as well as render a skybox for you. There are cases when you only want Mie scatter though so i think Id have a different component for an atmospheric directional light.

    Ocean rendering
    Its pretty hard to get ocean plugins to work with the volumetric lighting, This is because of the render order for lighting and transparency. I know a way to make it look a lot nicer but would require me to have custom shaders for every water plugin out there. I could probably make a base system and make a tutorial on how i modified the shaders to work with it and then leave it up to users/asset creators to make shaders to work with the volumetric pass. Still not sure what the best method here is.

    I'm still looking into Unity's new VR render mode to see if ill be able to support it or not. So no word on that yet.
     
    Last edited: Nov 15, 2016
    elbows, punk and yc960 like this.
  27. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Hey Lexie, just emailed you for a download link ;)
     
    Lexie likes this.
  28. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Does 1.1.2 also fix the issue that "sometimes", switching on the HxVolumetricCamera component while in the game will result in "a lot of stuff" (not everything but a lot of things) are being rendered black?

    I'm running into this with 1.1.1 (not perfectly sure about the version number but the version from the Unity Asset Store, downloaded just a few days ago) in a VR game that uses SteamVR and several other plugins as well as the new Unity PostFX. This does not occur when in my testscene (here, HxVolumetricCamera is active from the beginning). Also, it's not a permanent error: When disabling / enabling the component in the editor a few times (while playing), and doing other things like enabling / disabling TemporalSampling, it eventually works.

    At first, I thought I could simply work around this by deactivating / activating TemporalSampling from script (in a coroutine with a few frames waiting in between) - but then it turned out this only helped one single time (in other words, when I tried this "trick" in the editor the next time, it didn't do anything at all).

    So at the moment, I only know that after some time, when "changing settings" in the editor / inspector, the problem disappears but I don't know what exactly would fix it.

    Will be sending a request for 1.1.2 via private message in a minute.
     
  29. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646

    Thanks for the report, I just fixed this and included it in the newest build.
     
  30. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    It turns out the problem in my project was that I had the PostProcessingBehaviour component after HxVolumetricCamera for some cameras. Here's a video illustrating what happened, some of the investigation while trying to figure out what was wrong, and how I solved it (changing the order of the components on the main camera ... I might have missed this in the docs) ... and finally, playing the super-early prototype of the "clubbing environment" and a little sci-fi environment we already have in the game:

     
  31. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    is there a way to limit the brightness from the particle density feature? It gets a bit unrealistic when particles are dense, especially when combined with usual smoke particles.
     
  32. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    On the HxVolumetricParticleSystem there is a slider called Density Strength that changes how dense the particle emitter is. It uses the alpha channel of the texture * this value to effect how dense it makes the air. So its a combination of these two things
     
  33. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Yes, but the fact remains the the center of the smoke where particles overlap will be too bright whereas the edge will be barely visible. realistically there is a limit on the particle system contribution, a clamp on the brightness from the particles might do. I am thinking a simple clamp of brightness contribution or percent contribution should be easy to implement.
     
  34. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Oh i see what your saying, I added the ability to have different blend mode that you can choose from, Max can work pretty well. Its not what your thinking but might work well for now, You can select it in the HxVolumetricParticleSystem.
    Ill look into adding an exponential sampling.
     
    yc960 likes this.
  35. Purpleshine84

    Purpleshine84

    Joined:
    Apr 8, 2013
    Posts:
    194
    Does anyone know if this asset works with U sky?
     
  36. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    I have tried it. Nothing exploded….
    They compete somewhat, for instance both will make a visible "sun".
     
    Purpleshine84 likes this.
  37. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I'm pretty new to this, but my first attempts are generating this odd pattern. This is with Helios, using the 2D camera, and Unity 5.4.1p4, Windows 10 Pro.

    This is a single directional light. A single point light works great, but I understood that directional lights were also supported.

    Any ideas please? Thanks.

     
    Last edited: Nov 22, 2016
  38. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Volumetric light supports orthograhic cameras? How would that work?
     
  39. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    It wouldn't, but Helios is not orthographic.
     
  40. xmanoux

    xmanoux

    Joined:
    Jul 9, 2015
    Posts:
    19
    I've got a weird problem on my project. HxVolumetric was broken.
    To repair : I copy pasted the projectSetting/QualitySetting.asset from an OK project, to the broken project.
    But in the editor, quality settings were apparently the same.
    It takes me hours to understand so I would be happy to have some understanding.
     

    Attached Files:

  41. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Looks like your using the 3D noise option, That can be an artifact if you have the noise scale very low. Try increasing the scale of the volumetric noise to something higher, you shouldn't see that repeating effect if its higher.

    I might have forgotten to change the default noise scale when I implemented the new 3D noise textures.
    I can generate some higher res 3D noise if you want to have a small scale on the 3D noise with out that strange hyper cube looking artifact.
    But the file size for the noise starts getting very large.
     
    JBT27 likes this.
  42. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    What version of unity are you using with this quality setting.
    Also what graphical preset in it are you using that create this bug.
    Also what is the bug, do the lights just stop casting volumetric rays?
     
  43. xmanoux

    xmanoux

    Joined:
    Jul 9, 2015
    Posts:
    19
    I can't reproduce the copy paste quality setting fix so maybe not consider my previous post.
    Anyway, I've got a project A with a simple point light volumetric where I can see the white "fog" around the light.
    A project B where I can't see it.
    The two scenes are the same : a plane a light with HxVolumetricsLight on light and HxVolumetricsCamera on camera
    I try to understand what is ok in A that is not ok in B and it's quite a headache.
     
  44. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    If its a shadow casting light, check to make sure the current Graphical settings have shadows enabled in the quality settings and the shadow distance is high enough.

    Old versions of the volumetric plugin also needed two objects to cast shadows otherwise unity wouldn't fire off the volumetric event with forward rendering. This is no longer the case
     
  45. xmanoux

    xmanoux

    Joined:
    Jul 9, 2015
    Posts:
    19
    I have copy pasted the ProjectSettings.asset from project_OK to project_Weird.
    The volumetrics now are prefect in the editor in Project_weird, but, with one scene, I have a total different render between Play Mode, and Standalone Mode (both with same quality settings)
    See the linked pics
    Have you an idea what could fix this behaviour ? level_begining_playmode.JPG level_begining_standalonemode.JPG ?
     
  46. Purpleshine84

    Purpleshine84

    Joined:
    Apr 8, 2013
    Posts:
    194
    Is the one better than the other or is it just different? And if so, how is it different? I see that this asset has an incredible beautiful fog effect.
     
  47. Purpleshine84

    Purpleshine84

    Joined:
    Apr 8, 2013
    Posts:
    194
    Oh, before I forget: how is the framerate? Does it drop many frames or is the performance good overall? Also if you use them together? (U SKy and this asset)
     
  48. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Would you be able to construct a scene similar to the include one in this package in that bugged scene, Its hard to diagnose when in both i'm just looking at a pink screen.

    There is an object called HxUsedShaders, If you select that and tick all the boxes and hit build shaders it will include a shader variant for every type of light. It will take a while to generate the shaders.

    Normally the plugin tracks the shaders it needs, If you started with an old build then it might not have had the chance to track all the shaders you use in that scene.
     
  49. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    They are different, with some overlap in this one area of a daytime haze effect. uSky also has it's own haze effect which I was not a fan of, but I believe that effect has recently been rewritten and I have not tried the new version…. To my recollection there was no significant impact using them both together. Both have been updated since, and I think HX has had a major speed boost….

    tbh I didn't really love them together so I stopped pursuing it, uSky is pretty because of it's rich luminous color, but that was mostly washed out by the volumetric haze. My perception was that uSky's haze was developed for large distances (like mountains) and retained the uSky color (perhaps unrealistically), while HX seemed best with dramatic nearby shadow casting – more like a misty fog that turns the sky greyish white. There were no problems, but I didn't feel there was any advantage

    But again I didn't pursue it, and both have been updated since, so I may not be doing them justice. A more subtle effect that preserves uSky's color might be possible.
     
    Purpleshine84 likes this.
  50. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    Finally got around to trying it in VR, looks absolutely stunning