Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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
    Lower the shadow bias on the light to an acceptable level. If your roof is just a quad it would be worth extending it to have some thickness. The artifact you are seeing are due to the shadow maps.
     
    hopeful likes this.
  2. Miguel-Herrero

    Miguel-Herrero

    Joined:
    Jan 19, 2015
    Posts:
    21
    All prefabs are cubes, so they have depth. I tried tweaking both shadow bias and shadow normal bias up and down, and the issue still happens.

    It improves using no shadow cascades, though, as there's more space for the shadows in the distance, but it looks horrible up close. I'll try changing the cascade levels individually and try to get a decent enough behaviour, but I haven't found the sweet spot yet.

    I may have to do it some other way on indoors environments (like using independent spotlights for the ceiling holes.
     
  3. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Chances are your final cascade distance was turned up way too high.
     
  4. BATTLEKOT

    BATTLEKOT

    Joined:
    Oct 2, 2016
    Posts:
    140
    Any news about upcoming update of HX Volumetric Light for LWRP render?
     
  5. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    183
    Hi @Lexie, any chance you can take a look here? It's still a common problem that causes tons of unnecessary conflicts in work.
     
  6. wyatts

    wyatts

    Joined:
    Apr 15, 2014
    Posts:
    14
    Hello! I'm working on a very simple shader that snaps vertex world positions. Naturally the HxVolumetric camera doesn't recognize the custom vertex positions out of the box as seen with this rotating cube:


    Is it possible / not overly complicated to get the HxVolumetric shader to draw around my new vertex positions? If so could you point me in the right direction on what I'd need to do?

    Here's my current shader (didn't include the properties for readability)
    Code (Cg):
    1.                
    2.                 #pragma surface surf Standard fullforwardshadows vertex:vert
    3.                 #pragma target 3.0
    4.  
    5.                 void vert(inout appdata_full v)
    6.                 {
    7.                     float4 vertexWorldCast = mul(unity_ObjectToWorld, v.vertex);
    8.                     vertexWorldCast.x = floor(vertexWorldCast.x * _XSnap) / _XSnap;
    9.                     vertexWorldCast.y = floor(vertexWorldCast.y * _YSnap) / _YSnap;
    10.                     vertexWorldCast.z = floor(vertexWorldCast.z * _ZSnap) / _ZSnap;
    11.                     v.vertex = mul(unity_WorldToObject, vertexWorldCast);
    12.                 }
    13.        
    14.                 void surf (Input IN, inout SurfaceOutputStandard o)
    15.                 {
    16.                     fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
    17.                     o.Albedo = c.rgb;
    18.                 }
    Thanks!
     
  7. AcornBringer

    AcornBringer

    Joined:
    Mar 22, 2015
    Posts:
    69
    Hey there!

    I ran across a post on the Hitbox Team website about colored light cookies with volumetric light. I'm trying to create a scene with some light shining through stained glass and was curious if this is somehow possible with this package since I already have it.

    Thanks :)
     
  8. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    284
    Is anyone getting huge framerate drops with Hx after extended playtime? After approximately 1 hour of play, I am getting hammered by frame drops, despite there being no changes in the scene. If I disable Hx, the framerate returns to normal.
     
  9. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    OMFG thank you, you just saved me so much time. I wish you 1000 years of good fortune!!!
     
  10. sabojako

    sabojako

    Joined:
    Jul 7, 2017
    Posts:
    14
    Hello @Lexie ,

    Very impressive system, love the deep controls that are available!!

    I have 2 concerns however that I would need support for my project:
    1- Would you be able to support Orthographic Camera projection, using the orthographic depth texture?
    2- On Nintendo Switch, the effect does not seem to work when using Resolution.full (2019.3)

    Thanks :)
     
  11. sabojako

    sabojako

    Joined:
    Jul 7, 2017
    Posts:
    14
    This is a surface shader, so simply add the addshadow parameter in your surface declaration should do it. It will generate your shadowcaster pass using the vert shader.
    Code (CSharp):
    1.                 #pragma surface surf Standard fullforwardshadows addshadow vertex:vert
    More on this: https://docs.unity3d.com/Manual/SL-SurfaceShaders.html
     
    glenneroo and wyatts like this.
  12. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    78
    Is there a way to make the Hx density not render through geometry without having to use shadows? Or is it possible to do it without having expensive (real-time?) shadows. We have a lot of static point lights as shown in the attached video, but I think it's overkill to have shadows enabled on all of them just to not render through walls and ceilings.
     
  13. wyatts

    wyatts

    Joined:
    Apr 15, 2014
    Posts:
    14
    Sabojako -- wow, that was incredibly simple and straightforward :) Thanks so much for the help!
     
  14. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    58
    Any support for Single Pass Instanced rending in VR? Unity 2019.2.8f1 - Thanks!
     
  15. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    140
    How does HX Density Volume Script work?
     
  16. Miguel-Herrero

    Miguel-Herrero

    Joined:
    Jan 19, 2015
    Posts:
    21
    Is there a way to make a custom surface shader with alpha:fade work with the volumetric lights? I'm adding the lines

    #ifdef VTRANSPARENCY_ON
    albedo = VolumetricTransparencyBase(albedo, IN.projectedPosition);
    #endif

    to the surf function and it seems to not be doing much (I have the define enabled and the projectedPos should be ok, as I'm using it to do soft particles and that works fine).

    Is there a way to use it with a transparent surface shader?

    The example in the docs show a way to do it with regular vert/frag shaders, and the plugin includes a modified Standard shader that works fine, but I need a couple of modifications and I don't want to redo the whole Standard shader.
     
  17. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    46
    Unity 2019.3 has been released. Can we expect an update soon for URP support?
     
    BATTLEKOT likes this.
  18. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    706
    Not officially it is, 2019.2.14 is still the latest official version, but 2019.3 will be right around the corner.
     
  19. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    46
    Weird - I could swear when I opened Unity Hub this morning, 2019.3 was in the top "Official Releases" section, and now it's back down below. I wonder if the 2.2.1 hub update moved it, haha :-D
     
  20. Rotecks

    Rotecks

    Joined:
    Dec 17, 2014
    Posts:
    81
    Hello! I have a big problem.
    Rays pass through the junctions of polygons and light rays appear in these places.I checked the model, there are no any gaps in the corner.
    https://imgbbb.com/image/LXOnzd (Sorry, idk how to attach this image)
    Red arrow shows a ray that should not be here. Green arrows show the direction of a direction light.
    I downloaded the latest version of HX Volumetric Light.
    How to fix this bug?

    UPDATE: Changing "Bias" / "Normal Bias" helps, bus some wrong light rays still exist :/
     
    Last edited: Dec 3, 2019
  21. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    How do I prevent interior scenes from getting Volumetric lighting from the directional scene light? I have an outdoor area and some interior spaces that you can get to, but the volumetric lighting is present everywhere, including indoors where it shouldn't be seen at all.
     
  22. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    34
    Hi.
    What is HxUsedShaderVariantCollection.shadervariants in HxVlumetricLighting / Resources folder and why it created hundreds of empty materials in my project? Can I somehow clean up these materials?
    Thank you.
     
  23. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    46
    Ugh. I feel like this project has been abandoned. :-(
     
    Anticleric likes this.
  24. BATTLEKOT

    BATTLEKOT

    Joined:
    Oct 2, 2016
    Posts:
    140
    maybe we will get some news after Christmas
     
  25. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    34
    Another issue: build stuck on "packaging assets" stage, and I have several "Unity Shader Compiler" processes in task manager.
     
  26. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    247
    The build version of the game seem not to be able to account for shadows:

    While playing in the editor:

    1.JPG

    When running the build:

    2.JPG
     
  27. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    247
    Clarification: the above effect was achieved in the editor by playing with Fog Height and Above Fog Percent.

    EDIT/UPDATE: changed this:


    Code (CSharp):
    1. float GetFogDensity(float3 worldPosition)
    2. {
    3. #ifdef HEIGHTFOG_ON
    4.     float fogDensity = lerp(1 * FogHeights.z, 1, (smoothstep(FogHeights.y, FogHeights.x, worldPosition.y)));
    5.  
    6.     fogDensity = Noise(worldPosition) * fogDensity;
    7.  
    8.     return  GetVolumeDensity(worldPosition,fogDensity * Density.x);
    9. #else
    10.     return GetVolumeDensity(worldPosition, Noise(worldPosition) * Density.x);
    11. #endif
    12. }
    into this:


    Code (CSharp):
    1.  
    2.  
    3. float GetFogDensity(float3 worldPosition)
    4. {
    5. //#ifdef HEIGHTFOG_ON
    6.     float fogDensity = lerp(1 * FogHeights.z, 1, (smoothstep(FogHeights.y, FogHeights.x, worldPosition.y)));
    7.  
    8.     fogDensity = Noise(worldPosition) * fogDensity;
    9.  
    10.     return  GetVolumeDensity(worldPosition,fogDensity * Density.x);
    11. //#else
    12. //    return GetVolumeDensity(worldPosition, Noise(worldPosition) * Density.x);
    13. //#endif
    14. }
    in "HxVolumetricLightCore.cginc" and now fog height is working in the build.
     
    Last edited: Dec 31, 2019
    hopeful likes this.
  28. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    183
    Hi, in case anyone has issues with HX Volumetric Lighting serializing runtime-only matrices to the scene (and thus causing merge conflicts when using a VCS), there is an easy fix, just add [System.NonSerialized] to the following matrices (LastMatrixVPInv,VP2 and VPInv2 are not used in the code, you could delete them but I prefer to make minimum changes to plugins' source).

    Code (csharp):
    1.  
    2. +    [System.NonSerialized]
    3.      public Matrix4x4 BlitMatrix;
    4. +    [System.NonSerialized]
    5.      public Matrix4x4 BlitMatrixMV;
    6. +    [System.NonSerialized]
    7.      public Matrix4x4 BlitMatrixMVP;
    8. +    [System.NonSerialized]
    9.      public Vector3 BlitScale;
    10.  
    11.      [HideInInspector]
    12. +    [System.NonSerialized]
    13.      public Matrix4x4 MatrixVP;
    14. +    [System.NonSerialized]
    15.      public Matrix4x4 LastMatrixVP;
    16.      public Matrix4x4 LastMatrixVPInv;
    17.      public Matrix4x4 LastMatrixVP2;
    18.      public Matrix4x4 LastMatrixVPInv2;
    19.      [HideInInspector]
    20. +    [System.NonSerialized]
    21.      public Matrix4x4 MatrixV;
    22.  
     
  29. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    46
    So 2019.3 and URP are officially released today, how soon might we see an update to HX Volumetric?
     
    BATTLEKOT likes this.
  30. GoldFireStudios

    GoldFireStudios

    Joined:
    Nov 21, 2018
    Posts:
    63
    Another ping to see if URP support is going to be released or if this asset has been abandoned?
     
    zackblack likes this.
  31. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    420
    There is a problem with Unity 2020. When ever I open a project that has Volumetric script on it unity get crash. Can you please fix it o_O
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    The author's last response here was September 5, 2019. Looks like this asset has been abandoned. You might try using their support e-mail. Maybe you can get a response there.
     
    Crossway likes this.
  33. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    420
    :(! This asset is part of my project for years! Why he would leave this asset behind?

    Lexie
    Please update this asset for Unity 2020 my game looks bad without it.
     
    Last edited: Mar 23, 2020
    twitchfactor likes this.
  34. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    49
    Unity 2020 is still beta and not officially released so I suspect the author's answer will be the same for other beta builds people asked to support in this thread. Anyways, why should he spend the time to support something that will probably break a lot until it is officially released? Unity beta versions are known to change drastically until final version.
     
    wetcircuit and hopeful like this.
  35. Rotecks

    Rotecks

    Joined:
    Dec 17, 2014
    Posts:
    81
    Lexie
    I have a few cameras which render different game objects. HXVolumetricCamera attached to the last "FinalCamera".
    I have to have light rays from all scene objects. As I understand, I should replace _CameraDepthTexture with _CameraCUSTOMDepthTexture which contains the whole scene depth. Right?
    I have tried, but it works weird. Some light rays drawn on the top of everythings.

    Please, explain, how I can get shades from all scene objects?
     
  36. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    542
    As soon as i switch shadows on directional light the hxv breaks.
    u 2019.3.3f1 , forward renderer, any hacks i need to do to make it work?

    No shadows - works always.
    Hard shadows - work sometimes, if i reimport hx, and restart unity (not reliable)
    Soft shadows - never.
     
  37. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    497
    does this work with webgl?
     
  38. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    497
    im using the latest unity beta, everytime i try to add the volumetric light script to the directional light, unity crashes ... any ideias?!?!
     
    ksam2 likes this.
  39. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,042
    Best on its own type!

    I've tested Aura and other volumetric lights tool too but I can't get quality that I get with HxVolumetric. Really cool please keep this updated my projects depends on this asset now :)
     
    twitchfactor likes this.
  40. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    497
    does it work with the latest unity beta then?
     
  41. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,042
    No. I hope developer update it soon I need to move my project to unity 2020 too.
     
  42. erwinbrennerSM

    erwinbrennerSM

    Joined:
    Nov 26, 2019
    Posts:
    1
    Hi, does this asset support cameras using an oblique projection matrix? In our project, we're using portals that have their own volumetric camera rendering to a rendertexture. In order to not render things between the portal camera and the portal plane, we're creating a oblique projection matrix with a near clipping plane aligned to the portal normal. See image below.

    This method is lifted from Sebastian Lague's video on the topic. When setting the camera's projectionMatrix to this oblique matrix, the volumetric lighting does not render. Any help would be appreciated!

    (we're using deferred rendering)
     
  43. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    441
    Can anyone confirm if this renders correctly on PlayStation 4 in VR?
     
  44. dizzymediainc

    dizzymediainc

    Joined:
    Apr 6, 2014
    Posts:
    177
    I keep getting this error when importing to unity 5.6.0

    "The type or namespace name "XR" does not exist in the namespace", my game is not VR so not sure why this is throwing this error.

    It's on the HxVolumetricCamera.cs script, any thoughts as to why it's doing this and how to fix it?

    I've reached out to the dev but no word yet, coming up on a week now.
     
  45. Cela1

    Cela1

    Joined:
    Jul 7, 2019
    Posts:
    2
    Assuming that the dev comes back at some point... could you please add Single Pass Instanced support for VR? The new Unity XR plugins have dropped support for non-instanced Single Pass, which is the only one of the two that this works with currently.
     
  46. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    699
    We need to use different setups of hx volumetric lighting for different scenes. We can't use a separate camera for each scene though as that's loaded for the character. Is there any best practices for this? I couldn't see any profile system (like post processing).

    Is it possible to just copy variables at runtime from one instance of hx volumetric lighting to another? (Something like CopyComponent.)
     
  47. StarsideStudios

    StarsideStudios

    Joined:
    Jul 15, 2013
    Posts:
    50
    Anyone having issues with HX lights being seen through walls? Works fine on my PC, but testers for my game have sent pictures with hundreds of lights being seen through walls.
     
  48. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,192
    Is it just a HX issue? Or do regular lights shine through as well?
     
  49. StarsideStudios

    StarsideStudios

    Joined:
    Jul 15, 2013
    Posts:
    50
    Just seems to be HX. I can see the density/fog of the lights through walls. Kinda a blurry pic, but sent from someone testing.
     

    Attached Files:

    • wall.PNG
      wall.PNG
      File size:
      398.1 KB
      Views:
      34
  50. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,192
    I don't think I can help, but it would be good note what Unity version you're using, and anything else that might assist someone in figuring it out.

    You could also benefit from using the support email address. @Lexie hasn't posted in this thread since last September (getting close to a year).
     
unityunity