Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[RELEASED] Hx Volumetric Lighting

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

  1. justinmcombs

    justinmcombs

    Joined:
    Jul 31, 2017
    Posts:
    1
    Pardon my inexperience in areas like this - but removing this from where it wanted to originally import (Plugins) caused several issues that are completely absent if left alone in that folder.

    Being new to all this, I'm curious as to why?
     
  2. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    363
    thanks bro, the manual way worked for me
     
  3. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    276
    https://docs.unity3d.com/Manual/SpecialFolders.html

    You can add plug-ins to your Project to extend Unity’s features. Plug-ins are native DLLs that are typically written in C/C++. They can access third-party code libraries, system calls and other Unity built-in functionality. Always place plug-ins in a folder called Plugins for them to be detected by Unity.
     
  4. 4sascha

    4sascha

    Joined:
    Mar 9, 2017
    Posts:
    39
    Hey. Do you have some tips how to get it run with yebis for unity. Tried after and before yebis on camera but there are some "darker ghosting artifacts" on camera up and down movement.
     
  5. caoyuxi

    caoyuxi

    Joined:
    Jul 9, 2015
    Posts:
    10
    Hey guys, I am having issue on compiled version in macOS Sierra. the complied app wont run and unexpectedly quit after i hit play! button while i have Hx_VolumetricCamera Attached to the Camera(still crash even i disable the scripts). how should i fix that?
     
  6. caoyuxi

    caoyuxi

    Joined:
    Jul 9, 2015
    Posts:
    10
  7. caoyuxi

    caoyuxi

    Joined:
    Jul 9, 2015
    Posts:
    10
  8. caoyuxi

    caoyuxi

    Joined:
    Jul 9, 2015
    Posts:
    10
    Anyone got idea why compile version in mac not working?
     
  9. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    I've just finished testing a new build that fixes issues with some version of unity and linux/mac.
    Took me a long time as there is a window of a few versions of unity were they regressed on the shadow map sampling.

    Build should be live in a day or two.
     
    mons00n likes this.
  10. khalvr

    khalvr

    Joined:
    Sep 12, 2017
    Posts:
    4
    Can't get this to work in my project. Just slapped on HX volumetric lights to the lamps and HX volumetric image effect + HX volumetric camera onto my camera, but it won't render. Works well in the sample scene though. Does it have something to do with me using tonemapping through the Post Processing Stack V2? Because other than that, i'm just using the default settings. Have tried both forward and deferred rendering, but i'd prefer if i could make it work for forward since it's for VR.
     
  11. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    You could try disabling the post processing stack for testing. I know the tone mapper in version 2 happens before image effects for some reason. So you would need to use an external tone mapper if you want it to effect the volumetric effect.

    The effect works in both deferred and forward but it is a full screen effect, It's applied the same way the directional shadows are, so it wont be affected by FAA.

    Make sure you have shadows enabled in unity's quality settings if you plan on using shadow casting lights.

    Your density might be too high or too low for the light to scatter. Also make sure the extinction is low. Messing with the mie setting helps. I recommend looking over the documentation to get an idea of what all the values do.
     
  12. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    65
    Hi. This asset looks fantastic in my vr project, but have a few questions about this asset I'm hoping someone can answer.

    1. I'm reading in this forum that this doesn't work with baked shadows. If I set my lights to mixed baked indirect will the volumetric lighting still work? I'm thinking yes because all the lighting data except indirect light would be real time, but I just want to make sure.

    2. Also, I'm noticing a problem with my UI. I have a world space canvas with some windows and when I enable the volumetric lighting the windows look like they're being rendered after the fog. Any idea on how to solve this?

    3. Does this work with MSAA?

    Thanks!
     
    Last edited: Mar 9, 2018
  13. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    1. Mixed lighting modes should work in baked indirect and shadowmask mode. The indirect bounces will not contribute to the effect though.

    2. This is because your UI uses a transparent shader. Either use an opaque shader or enabled transparency support and use one of the included transparent shaders to composite the object with the effect. Note: transparency support will cause the effect to be more expensive to render.
    I suggest reading the transparency section in the documentation

    3. This is a screen space effect that is applied in the same way the directional shadows in unity are applied. Just like unity's directional shadows, it does not support MSAA. You will need to use a screen space AA if you want the effect to be anti aliased, aliasing is only really noticeable if you blow out the effect. A combination of Temporal AA solutions + MSAA can work well if the aliasing from unity's directional lights shadows and the volumetric effect are unacceptable.
     
    RPowers likes this.
  14. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    65
    Thanks a lot for the detailed answers! I appreciate it.
     
  15. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    255
    Hey Lexie! Thank you for making this wonderful asset, it's a fantastic help!

    I was hoping you might be able to help me hack your wonderful work into pieces. For long pedantic reasons that there's no need to get into, I've got a custom depth buffer rendered in the format of a DefaultHDR format RenderTexture, which I stash as a global static object. I've successfully edited Unity's DOF to reference this texture instead of the _CameraDepthTexture, and was hoping to do the same in your shaders.

    The problem is that the HxVolumetricLighting code is much more complex. I am happy to beat my head against the wall (as usual) but if there's any hints you could give in terms of how I might hotfinger my jankery into your code, I'd very much appreciate it.

    Thanks!
     
  16. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    So it uses unity depth buffer in a bunch of places.

    If you define your own sampler2D in each script and do a find and replace for _CameraDepthTexture it should do the trick.

    You might have to create a replacement function for SAMPLE_DEPTH_TEXTURE_LOD as well if you're storing the depth in a strange way.
     
  17. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    255
    hmm thanks, I'll take a look.

    I started by doing a straight-up find/replace for _CameraDepthTexture with _CustomDepth (the name of my global tex) but it didn't work. Compiled fine, but my light dis-appeared, until I tried to move, and I briefly saw a full-screen effect appear, as if the effect was somehow scaled or skewed over an unusual area of space.

    I'll look into that function and see if I can't wrap my head around it.

    Thanks very much for the tip!
     
  18. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    For testing use full resolution, that tends to access the depth buffer the least as its not doing the custom downsampling of the depth texture.
     
  19. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    2,975
    We have now moved from Unity 5.6 to Unity 2017.4.1f1 and I'm getting a warning:

    Code (csharp):
    1. Use of UNITY_MATRIX_MV is detected. To transform a vertex into view space, consider using UnityObjectToViewPos for better performance.
    This is apparently coming from: UnityBuiltin2xTreeLibrary.cginc. UNITY_MATRIX_MV seems to be used two times, in line 44 and 93. I don't know much about shader programming, tbh, is it safe to simply change those two lines to:

    Code (csharp):
    1. float3 viewpos = UnityObjectToViewPos(v.vertex);
    ?

    It does get rid of the warning - I'm just not sure if this might cause any side-effects.
     
  20. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    Should be fine. The compiler will still compile with the warning though.
     
  21. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    54
    Getting this warning message, but everything still seems to be working properly:

    Code (CSharp):
    1. Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricLight.cs(477,65): warning CS0618: `UnityEngine.Rendering.GraphicsDeviceType.Direct3D9' is obsolete: `Direct3D 9 is no longer supported in Unity 2017.2+'
    I'm using 2017.3.1 and Win10.

    Any plans to update the Asset to Directx11 in future? I'm thinking about long-term compatibility.
     
  22. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    1,926
    That warning doesnt mean this asset is incompatible with DX11. It just means there is a line of code that is checking whether the device is a DX9 device and since Unity have removed DX9 stuff from 2018.2, that code generates a warning.

    One thing I will say is that the ShaderModel4 function in HX, where that line of code is, looks like it will always return false! Not sure what the story is there, maybe some leftovers that are now obsolete?
     
    Rich_A likes this.
  23. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,002
    Love the plugin but I've noticed that when I change the lightmapper to "progressive (preview" the volumetric lighting effect is absent from the game view.

    This is not the case with Enlighten, or realtime GI, or none at all. My project is using the Progressive Lightmapper and would love to use your plugin. Can you take a look?

    This is in unity 5.6.1f1
     
  24. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    Set the Mode on your static light to mixed.

    Edit: Progressive light mapper was in beta in 5.6, Hence the "preview" tag. Mixed lighting wasn't supported correctly till unity 2017. You will need to update unity unfortunately.
     
    Last edited: Apr 29, 2018
  25. Bitwaker

    Bitwaker

    Joined:
    May 10, 2014
    Posts:
    11
    Are there any updates on that?
     
  26. khalvr

    khalvr

    Joined:
    Sep 12, 2017
    Posts:
    4
    After upgrading to 2018.1, i get the following error:

    ArgumentException: passed shader keyword variant not found in shader Hidden/HxVolumetricSpotLight pass type 0
    UnityEngine.ShaderVariantCollection+ShaderVariant..ctor (UnityEngine.Shader shader, PassType passType, System.String[] keywords) (at C:/buildslave/unity/build/Runtime/Export/Shader.cs:22)
    HxVolumetricShadersUsed.CheckShaderVariant (UnityEngine.ShaderVariantCollection collection, UnityEngine.Shader source, Int32 i, Boolean point, Boolean projector) (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricShadersUsed.cs:319)
    HxVolumetricShadersUsed.BuildShaders () (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricShadersUsed.cs:247)
    HxVolumetricShadersUsed.SetVolumetricValues (Boolean full, Boolean lowRes, Boolean heightFog, Boolean heightFogOff, Boolean noise, Boolean noiseOff, Boolean transparency, Boolean transparencyOff, Boolean densityParticles, Boolean point, Boolean spot, Boolean directional, Boolean singlePass, Boolean projector) (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricShadersUsed.cs:134)
    HxVolumetricCamera.SaveUsedShaderVarience () (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricCamera.cs:2261)
    HxVolumetricCamera.OnDestroy () (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricCamera.cs:2247)
     
  27. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    it only came out a couple of days ago. I'm looking into what custom code is required to get it working with the custom rendering pipelines unity has made already using scriptable render loops. In the end it will require some code knowledge to get any graphical effect working with it.
     
  28. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    Download the newest version off the asset store, It is confirmed to work with unity 2018.1.
    There are some warnings on a few of the shaders that will not effect the performance of the effect.
     
  29. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    276
    I’ve always had great results using this asset on non compute-shader capable lower end machines so long as I turn down the settings. As the HD SRP has built-in volumetric fog coming up, there would definitely be a niche for you if you found a way to get this functioning on the LW SRP.
     
  30. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    Now that unity has removed DX9 Support, is there really any devices that don't support compute shaders that could even run this effect. mobile devices fast enough to run an effect like this would most likely support compute shaders.
     
  31. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    276
    Sure, point taken. I suppose I meant devices or apps with performance requirements that preclude the HD SRP- for instance HX Volumetric runs fine on my 6 year old Macbook Pro with integrated graphics, provided I dial down the settings.

    To explain my use case a bit more thoroughly, I have a fairly low poly, minimally textured environment, that I push sophisticated environmental effects over the top of- impressionistic rather than detailed (and well suited to the LW SRP). This effect is a core element of that.
     
  32. HsinChien

    HsinChien

    Joined:
    Nov 19, 2012
    Posts:
    19
    Hi
    I am using the hx volumetric light effect. I try to use OnPostRender function on camera to capture the screen shot, but it doesn't capture the volumetric light effect. What shall I do? Thanks!
     
  33. TimNick151297

    TimNick151297

    Joined:
    Apr 21, 2013
    Posts:
    10
    I can't get HxVolumetricLighting to work with Unity 2018.1. Is there something I have to change in the shaders? I'm using the HD Render Pipeline. Thanks for a reply!
     
  34. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    The HD pipeline is Custom rendering pipeline, you shouldn't expect any advanced graphical effects to work with it with out a lot of custom coding. The scriptable rendering loop gives you low level access to the rendering pipeline, the trade off is that it's completely custom and you have to do all the calls for everything through scripting. It no longer uses the events of the inbuilt render loop which graphical effects used to issue their draw calls.

    I'm looking into a way I could possible tap into the custom rendering pipeline with out a complete re-write. But it will be some time before that is complete. I'll most likely have to have my own fork of unity's scriptable render loop that is compatible with my volumetric plug-in. (not ideal)

    Volumetric support for Unity's Custom HD pipeline is on their road map, if you are set on using their custom HD pipeline, You could always wait for that. But I would recommend having a graphical programmer on your team.

    Edit: to take a quote from unity's documentation "only use if you’re super-curious right now"
     
    Last edited: May 11, 2018
    ksam2 and wetcircuit like this.
  35. TimNick151297

    TimNick151297

    Joined:
    Apr 21, 2013
    Posts:
    10
    Alright, thanks for your answer!
     
  36. HsinChien

    HsinChien

    Joined:
    Nov 19, 2012
    Posts:
    19
    Any thought on this? Support please!
     
  37. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    Use this instead

    Even comes with example code for what you are doing.

    Otherwise send me your code. I cant debug your issue with out seeing your code and how you're capturing the screenshot.
     
    hopeful likes this.
  38. HsinChien

    HsinChien

    Joined:
    Nov 19, 2012
    Posts:
    19
    Thanks! I will try it!
     
  39. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    83
    Hi, the plugin not working with 5.6.6f2 and it show this error after I update to 5.6.6

    Shader error in 'Hidden/HxVolumetricPointLight': undeclared identifier 'sampler_ShadowMapTexture' at line 158 (on d3d11)

    Compiling Vertex program
    Platform defines: UNITY_NO_SCREENSPACE_SHADOWS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME
     
  40. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    925
    So we shouldn't expect this to work with LW SRP any time soon?
     
  41. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    51
    Quick question - for a large-area or scene-wide ground fog effect (height fog), should I be attaching a volumetric light to the main direction light (sun)?

    Here I'm faking it with a plane + soft particle shader, but I want to do this properly.

     
  42. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    51
    Don't worry, I answered my own question by trying it on the directional light :)

    Here's the result:

    https://twitter.com/infingame/status/998150609344909314
     
    hopeful likes this.
  43. muberti

    muberti

    Joined:
    May 20, 2016
    Posts:
    3
    Hi, we have a annoying issue with Unity 2018.1: in the game view we can see all the volumetric spot lights, but into the build (ultra quality settings) some of them (the far and biggest ones) are completely not rendered. We cannot figure out if this is a Unity bug or a HxVolumetric Lights bug? Thank you
     
  44. muberti

    muberti

    Joined:
    May 20, 2016
    Posts:
    3
    I solve it changing the Quality settings in Unity, in particular the Shadow Distance parameter.
     
    hopeful and GMax like this.
  45. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    54
    With 2018 in such a state of flux, with so many experimental features, I wonder if supporting it is worth it right now.

    I'll be waiting for 2018.4 (LTS) before beginning a project on it. Pre-production on earlier versions probably, experimental testing definitely.
     
  46. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    555
    Ill be pushing a new version that solves some issues caused by unity 2018.1+ and transparency support. If you don't use transparency support then you shouldn't be effected. Need to do some more testing but it should go live in a few days.
     
    elbows and hopeful like this.
  47. Ekincan

    Ekincan

    Joined:
    Sep 8, 2015
    Posts:
    9
    The current volumetric light asset we are using does not work with baked light sources.
    So it only works with realtime or mixed ones and thats quite a problem for us.

    I was wondering if this asset would fix that problem for us ?
     
    Last edited: Jun 9, 2018
  48. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    336
    Nah, it'll be the same deal. HXVL uses the shadow maps from unity's realtime lights. So it works with mixed, but not with baked.
     
  49. EthnoTekhBrad

    EthnoTekhBrad

    Joined:
    Nov 16, 2013
    Posts:
    6
    Hi, I went to grab the updated version you said you were putting up but latest on asset store says March 13th. Wondering if you have an ETA on the transparency fix?
     
  50. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    221
    Is there a version I can try before I buy with a watermark or something?