Search Unity

  1. Going to #UniteBerlin? Bring a buddy & get 25% off the 2nd ticket! More info here.
    Dismiss Notice
  2. Famed game designer and creator of The Sims, SimCIty, and Spore is looking for a 3D artist to join their team. Join the challenge.
    Dismiss Notice
  3. Unity 2017.4 has arrived! Read about it here.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. We've opened a new World Building sub-forum to faciltate all your world building discussions! Drop in and ask any ProBuilder, ProGrids, or PolyBrush questions.
    Dismiss Notice
  7. 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:
    361
    thanks bro, the manual way worked for me
     
  3. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    243
    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:
    23
    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:
    9
    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:
    9
  7. caoyuxi

    caoyuxi

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

    caoyuxi

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

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    515
    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:
    2
    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:
    515
    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:
    44
    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:
    515
    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:
    44
    Thanks a lot for the detailed answers! I appreciate it.
     
  15. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    245
    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:
    515
    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:
    245
    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:
    515
    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,927
    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:
    515
    Should be fine. The compiler will still compile with the warning though.