Search Unity

[RELEASED] Hx Volumetric Lighting

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

  1. APwn

    APwn

    Joined:
    Feb 2, 2015
    Posts:
    3
    Having the exact same issue. Can you please post a fix?

    EDIT: Nevermind, managed to get it working by editing line 157 in HxVolumetricPointLight.
    Changed:
    Code (csharp):
    1. #if UNITY_VERSION > 565 && (UNITY_VERSION < 20171 || UNITY_VERSION > 201722) //unity switched shadow maps for 2 version for some reason.
    To:
    Code (csharp):
    1.  
    2. #if UNITY_VERSION > 9999 && (UNITY_VERSION < 20171 || UNITY_VERSION > 201722) //unity switched shadow maps for 2 version for some reason.
     
  2. APhilpo

    APhilpo

    Joined:
    May 24, 2018
    Posts:
    5
    I might have missed something, but how do I make the volume beam from a spot brightest near the source? By default it's rather dim and actually fades out as the beam's diameter approaches zero.

    Happy to edit code if you can point me in the right direction.

    --
    Kevin
     

    Attached Files:

    • beam.PNG
      beam.PNG
      File size:
      173.3 KB
      Views:
      914
    Last edited: Jul 9, 2018
  3. sbstn-hn

    sbstn-hn

    Joined:
    May 23, 2013
    Posts:
    3
    Hi, I have a problem with the latest version on 2018.1.5f1 (OSX). The Standard Shader does not compile:
    The same code compiles fine on 2017.4 but it seems like Unity changed the LIGHT_ATTENUATION(x) API somewhere deep down. Does anybody have a fix for that issue?

    Thanks!
     
  4. APhilpo

    APhilpo

    Joined:
    May 24, 2018
    Posts:
    5
    Ah, I think I got what I wanted out of it:

    IMG_5256.PNG
     
    llJIMBOBll and hopeful like this.
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    What did you do to get that, compared to what you were doing before?
     
  6. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    327
    Hi, there is a problem with the shader compilation of 1.3.3 in U2018.2:

    ===================
    Shader error in 'HxVolumetric/Standard': invalid subscript '_LightCoord' at Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxUnityStandardCore2018.cginc(421) (on d3d11)

    Compiling Vertex program with UNITY_PASS_FORWARDADD POINT
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS 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 UNITY_LIGHTMAP_RGBM_ENCODING
    ===================

    Any ideas?
     
  7. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    @Lexie Hi, really beautiful effect. I'm having two issues with the latest version 1.3.3:

    1. There's 320B of GC allocation every frame in HxVolumetricCamera.OnPreCull().

    2. Shadow Fix doesn't seem to be working in my project. With 1 directional light and with volumetric shadows enabled, the volumetric fog disappears when the the camera has no objects in its frustrum. As soon as one object enters the camera's frustrum, fog turns back on. I can confirm that "Shadow Fix" is on.

    If it helps to pinpoint the problem, I'm using two cameras in a space scene, one for the skybox and background, and one for scene objects. HxVolumetricCamera is only on the scene object camera which is set to set to "Depth Only" for "Clear Flags". I'm not sure what's different about my project, but in a simple test with a cube, it looks like "Shadow Fix" does indeed fix the problem in the simple scene, but not in my actual project. Do you know what other variables might be causing "Shadow Fix" to not work?

    2 work arounds I've tried:
    1. Turning off shadows in HxVolumetricLight, but then we lose the beautiful shadows.
    2. Create a gigantic cube which ecompasses the entire play area and set Cast Shadows "On" in the renderer. Set a Standard Cutout shader and turn down the alpha so it's not viewable and we're also inside of it. This makes the camera think there's an object within the frustrum, and the volumetric fog stays on even when not pointed at scene objects.

    This is a strange workaround and I'm guessing the problem has to do with Hx using the depth buffer to test for shadows or something, and there is nothing in the depth buffer when no objects are in view. Is there some other fix? Thanks.
     
  8. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Thanks for the report, will look into this and get back to you.

    Edit: I'm not seeing any GC allocated.
     
    Last edited: Jul 23, 2018
  9. Snufking

    Snufking

    Joined:
    Jan 31, 2018
    Posts:
    2
    Would it be possible to get some tutorial videos using this asset for getting started? For example lighting scenes with different atmospheres and lights. I'm having serious trouble achieving anything with this asset. The current documentation isn't helpful to me and Youtube doesn't have anything.
     
  10. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Put a hxVolumetricCamera script on your camera.
    Put a hxVolumetricLight on any light you want to be volumetric.
    Other then that its just tweaking settings to get the look you want.

    Is there something in the doc that's not explained enough?
     
  11. Snufking

    Snufking

    Joined:
    Jan 31, 2018
    Posts:
    2
    That's exactly what I did.

    Even when I play around with the sliders, I don't get satisfactory results. What I'm looking for is some examples in using it. That's why tutorials exist on Youtube, to get started.
     
  12. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    "RenderingCommandBuffer: invalid pass index 1 in DrawMesh"

    I get this error every time I want to add hxVolumetricLight to point light have no idea why
     
  13. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Make sure you have the latest version from the asset store. If you have updated unity then you also need to check for updates with the plug-in.

    If that doesn't solve the issue, Let me know what version of unity you are using and your general setup
     
  14. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    I just added HxVolumetricCamera.cs script to my camera and as soon I add HxVolumetricLight.cs script to point light it gives this error and weird pink light occurs
     
  15. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    There is the image
     

    Attached Files:

    • 2.JPG
      2.JPG
      File size:
      36.5 KB
      Views:
      826
  16. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    I only get this issue when I'm using Post Processing Stack along with HxVolumetricLight it works fine without post processing you have any idea why?
     
  17. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I am unable to reproduce your issue, let me know what version of unity are you using and double check that the processing stack and hxvolumetriclighting are up to date.
     
    Last edited: Jul 27, 2018
  18. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Do you have a really large near clipping plane by any chance? That could explain why the shadow fix isnt working.
    Again i couldn't find any GC in the plugin at all, could you deep profile your version and show me where its coming from

    Edit: Ok I see it happening with the latest version of unity. Looks like a bug on unity's end when adding or removing command buffers. Will submit a bug report and wait for them to fix it.
     
    Last edited: Jul 27, 2018
  19. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Appreciate you looking into this. Yes, that's exactly it, my near clipping plane is at 1, mainly because I have a very far clipping plane for the style of game I'm creating, and a near clipping plane of 1 allows me to have decent looking shadows with a large shadow distance setting. I didn't realize this could be the issue.

    As far as the GC allocations, yes, it's in 2018.2.0f2. Sorry, should have mentioned that to save you time.

    As an aside, have you had a chance to play with the HDRP volumetric lighting yet? While Unity said it's still very much a work in progress, I was just curious about your thoughts on how it's implemented so far. There's a few threads on it in the Graphics Experimental Preview forum about how to enable it in the current releases of HDRP.
     
  20. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    I just needed to update my plugin to 1.3.3 and it worked
     
  21. APhilpo

    APhilpo

    Joined:
    May 24, 2018
    Posts:
    5
    Just an fyi, I got this error while running in the editor. Unity 2018.1.3f1, HX 1.3.3

    I will try to make a simple test case for you that is reproducible, however so far this has been quite unpredictable.

    Code (CSharp):
    1. ArgumentException: passed shader keyword variant not found in shader Hidden/HxVolumetricSpotLight pass type 0
    2. UnityEngine.ShaderVariantCollection+ShaderVariant..ctor (UnityEngine.Shader shader, PassType passType, System.String[] keywords) (at C:/buildslave/unity/build/Runtime/Export/Shader.cs:22)
    3. HxVolumetricShadersUsed.CheckShaderVariant (UnityEngine.ShaderVariantCollection collection, UnityEngine.Shader source, Int32 i, Boolean point, Boolean projector) (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricShadersUsed.cs:319)
    4. HxVolumetricShadersUsed.BuildShaders () (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricShadersUsed.cs:247)
    5. 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)
    6. HxVolumetricCamera.SaveUsedShaderVarience () (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricCamera.cs:2261)
    7. HxVolumetricCamera.OnDestroy () (at Assets/Plugins/HxVolumetricLighting/Scripts/HxVolumetricCamera.cs:2247)
     
    Last edited: Jul 30, 2018
  22. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Thanks for the report
     
  23. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    Just wondering is it possible to have floating particles which represent dust to be lit by volumetric lighting
     

    Attached Files:

    • 21.JPG
      21.JPG
      File size:
      14.5 KB
      Views:
      846
  24. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    yes/no, You can use density particles to modulate the density in the area, But you cant get the detail of a single dust mote. For that you need to use a different method for generating the volumetric lighting.

    Unity's new HDRP uses this other method of volumetric lighting. It should allow you to light transparent particles like that.
    The downside of this other method is it uses a lot of VRAM and is a lot more expensive to calculate for a small number of lights and the results aren't as fine and can cause a lot of flickering, but you can light particles like that!
     
  25. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    Oh thank you, much appreciated. I tried to adjust the density particles and it's looks great the only problem that I'm having now, is that my particles (dust) is visible everywhere in the scene and you should on see it when a spotlight is on.
     
  26. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    If you turn off the render on the particle system and have a hxDensityParticle script on the emitter it should only show up in the light. Check out the included scene for an example of how to set up the particle system with the plugin
     
  27. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    Could you provide link to the example scene you are referring to thank you.
     
  28. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    Nevermind sorry about that I found the scene.
     
  29. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    This is what I ended up with I happy enough with it, is there a way to make the particle smaller because they appear to large. I tried messing around with the density but could not achieve it. Any idea?? thanks.
     

    Attached Files:

    • 22.JPG
      22.JPG
      File size:
      18.2 KB
      Views:
      952
  30. unity_p_JRNrW0eMKYVQ

    unity_p_JRNrW0eMKYVQ

    Joined:
    Jul 16, 2018
    Posts:
    2
    Hey is there any information on the HX Volumetric Lighting being updated for the Lightweight Render Pipeline? I don't see it anywhere on the roadmap. Thanks
     
  31. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646

    Its a result of a few things.

    1) Change Density resolution to a higher value. (This is all you should need to change)

    2) The volumetric effect is rendered at a lower resolution and then upscaled, changing the volumetric resolution can help

    3) There is also a blur pass to help remove noise, that would also blur the particles. (not recommend lowering this to 0)

    Note: Density particles were more to modulate the particle density in large area. You might get some flickering or strange behaviors if your doing tiny particles.



    When HDRP and LRP come out of preview ill look into the possibility of adding support.
     
  32. Raf95

    Raf95

    Joined:
    Nov 8, 2017
    Posts:
    23
    I tried all of the above and they have fixed my issue, I'm really delighted with the results that I achieved thank you for your help!! :)

    Here is the final look:
     

    Attached Files:

    • img.jpg
      img.jpg
      File size:
      279 KB
      Views:
      784
    hopeful likes this.
  33. NOT_Lonely

    NOT_Lonely

    Joined:
    Feb 2, 2013
    Posts:
    538
    Hi @Lexie
    For some reason I don't see the effect in forward rendering. I use a singlepass VR setup with SteamVR. If I switch to deferred, the effect appears. Could you please help me with that? Thanks!

    EDIT: another interesting thing that I noticed: if I disable the shadow casting feature in the directional light settings or in the global quality settings, or even in the HX Volumetric Light lighting settings (Shadows checkbox), the effect becomes visible. But of course I don't have this beautiful rays effect in this case.
     
    Last edited: Aug 20, 2018
  34. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    What version of unity are you using.
     
  35. NOT_Lonely

    NOT_Lonely

    Joined:
    Feb 2, 2013
    Posts:
    538
    2018.2.2f1
     
  36. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Thanks, ill have a look into it. sounds like unity isn't executing the command buffer attached to the shadow event or something.
     
  37. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I was not able to recreate this issue. Are you possibly using a post processing effect that is causing compatibility issues?
    Could you test the test scene that's included with forward rendering enabled and see if it works.

    Also confirm you have the latest version of the plugin downloaded.
     
  38. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Thanks for your product ! It´s great fun to work with and adds some really nice effects to my scene.

     
    punk, glenneroo, AcidArrow and 4 others like this.
  39. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    Hey I am also getting an error when trying to upgrade to 1.3.3 on Unity 2018.2:

    Shader error in 'HxVolumetric/Standard': invalid subscript '_LightCoord' at Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxUnityStandardCore2018.cginc(421) (on d3d11)

    Compiling Vertex program with UNITY_PASS_FORWARDADD POINT
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS 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 UNITY_LIGHTMAP_RGBM_ENCODING


    We are also noticing hx lights rendering through walls even with shadows enabled. It appears that it might have to do with the 'AfterShadowMap' command buffer? This is on Unity 2018.2.5:
     
    Last edited: Aug 30, 2018
  40. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Thanks for the report, I thought i pushed this fix in the latest version on the store. Ill double check and get back to you.
     
  41. Trainwiz

    Trainwiz

    Joined:
    Aug 25, 2015
    Posts:
    20
    Hey there,
    I've been working with this, and while it works well for the times when my lights are smaller in scope, I wanted to know what settings (if any) I could use to apply this to something bigger, like a sun in a space game.
    Essentially I'm trying to have a lightshaft effect like this or this, but the problem arises that my suns aren't directional lights, they're point lights with a massive range. I keep trying different settings but it either doesn't show up, or it does but I don't get those nice lightshafts you'd expect.
     
  42. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I also just got that error when upgrading to 2018.2. Any word on a fix yet?
     
  43. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    The issue is the Sphere for the light is going outside the far clip plane and not rendering.
    Temp fix would be to increase the far clip plane.
    Ill make it render a full screen quad so it works with large point lights when your inside the bounds in the next update.
     
    Trainwiz likes this.
  44. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Did you download the latest version of the plugin as well when you updated?
     
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I checked and it didn't say there was a new version. I tried importing anyway and it says I already have everything imported. I even logged out and back into the store, but same result. So then I removed the asset from the project and removed the package from the store assets folder in my users/appdata/roaming/… Then I re-downloaded and installed, but got the same error.
     
    Last edited: Sep 1, 2018
  46. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Ok thanks for the report. Ill be looking into this soon and pushing a new build.
     
  47. sandBucket2

    sandBucket2

    Joined:
    Mar 26, 2016
    Posts:
    29
    Does anyone else have issues when adding more than one Hx Volumetric Light script in a project? I'm noticing in Unity 2018.2 that when I add more than one Hx Volumetric Light script in a project, it works fine. However, when I close and reload the project, almost all my scripts break with no console error message. :( Has anyone else had this problem? Let me know and thanks.
     
  48. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Ok it looks like a bug fix i push a while ago has been stuck in unity's new asset publishing pipeline. Will try and figure out what the hold up as its status has been stuck on "In process" for a while now.
     
    Last edited: Sep 7, 2018
    greengremline and magique like this.
  49. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    Just saw that 1.3.4 released, tried updating but there didn't seem to be any changes except for the Examples/DensityParticles.unity - even after deleting the entire Plugins/HxVolumetric folder
     
  50. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I am unable to recreate your issue with lights rendering through walls. My guess is your setup is using a two camera setup that renders the game world with one camera, and then the characters hands with another.

    Since your second camera doesn't render the world at all, the volumetric lights are rendering with no depth blockers.

    Only other thing I can think of is your have an image effect that is clearing the depth buffer for some reason.

    Does the test scene included with the plug-in have the same issue your talking about?
     
    Last edited: Sep 11, 2018