Search Unity

[RELEASED] Hx Volumetric Lighting

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

  1. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    508
    Can I attach that particle density to my camera to make it move along camera?
     
  2. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    Yep.
     
    Crossway likes this.
  3. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    508
    I need to make this more optimized. After changing resolution to quarter in general setting part it's a lot better now. Is there any other setup I could change to save more frames?
     
    brisingre likes this.
  4. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    I don't know that that much about optimizing HXVL, but I think the other big one is probably the number of raymarched steps. "Sample Count" and "Directional Sample Count" are the variables to change.

    You could also consider using a density volume instead of density particles. Density particles are pretty expensive, I think?
     
    Crossway likes this.
  5. AbyssWanderer

    AbyssWanderer

    Joined:
    Mar 15, 2016
    Posts:
    77
    Hi.

    The plugin is awesome - I bought it straigth away when it was released.

    Still I faced problem - can't see the effect in the build.
    Here is how I see some place in runtime:
    http://prntscr.com/g050fw

    And here is what I see in the build:
    http://prntscr.com/g050o2

    Post-FX and other components on camera seem to have zero influence on this - I've tried switching them all off.
    Any way I can fix this?
    Thanks in advance.
     
  6. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    The system keeps track of what shaders need to be included in the build version. it creates an object called hxUsedShaders. if you're working in a team then a lot of the time members will keep overriding this file so it never gets the chance to track what shaders you use. You can manually assign them by selecting this object and ticking all the boxes and click build shader. Then push the changes so no one overrides them again.

    This will make unity included the shaders in the final build.

    If you have moved the plugin from its intended location then that will cause issues as well.
     
    Last edited: Jul 26, 2017
    hopeful likes this.
  7. AbyssWanderer

    AbyssWanderer

    Joined:
    Mar 15, 2016
    Posts:
    77
    Thanks for quick reply, Lexie.
    Unfortunately, I couldn't fix the problem entirely.
    What I've tried:
    1) Manually rebuilding shaders in hxUsedShaders, with or without different shaders. Put density particles off, of course, as they don't work for now. This does show progress bar while building shaders, no errors were noticed.
    2) Restarting Unity after rebuilding shaders.
    3) Using Forward rendering path
    4) Map to LDR, with or without tonemapping
    5) Changing the resolution to Quater or Full
    6) Reimporting HX Volumetric Light

    Now I don't know whether something of it helped - or yesterday I had the same results - but I've noticed that when camera is away for 20 meters, Volumetric Light instantly switches on. If I go closer it instantly disappears.
    Tried changing light's properties like bias, or near plane - all that surely affects only shadows, not the distance.

    Any advice on this one?
    Thanks in advance
     
  8. thehosse

    thehosse

    Joined:
    Nov 29, 2013
    Posts:
    35
    Does this have VR support yet?
     
  9. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Single pass stereo rendering is supported.

    Have you tried building out a test scene with just a light and my script set up on it.

    Id recommend removing the plug-in and re downloading the newest version. Sometime when upgrading not everything gets overridden.

    You could also try building out a debug build and see if any errors are stopping the effect getting initialized.
     
    AbyssWanderer likes this.
  10. AbyssWanderer

    AbyssWanderer

    Joined:
    Mar 15, 2016
    Posts:
    77
    Have you tried building out a test scene with just a light and my script set up on it.

    Id recommend removing the plug-in and re downloading the newest version. Sometime when upgrading not everything gets overridden.

    You could also try building out a debug build and see if any errors are stopping the effect getting initialized.[/QUOTE]

    Thanks for help.
    Indeed the problem occurs only on one particular scene (which luckily I can throw away, that's just a test).
    Will look into this futher.
     
  11. thehosse

    thehosse

    Joined:
    Nov 29, 2013
    Posts:
    35
    I want to create a red scanning laser effect like this one... go to 1.24.



    It's from the open source volumetric light effect, this demo scene isn't avaliable for download.

    I'm an artist and have limited coding skills, I can't figure out how this effect is created. I've got a spot light with a line cookie but it doesn't look the same really, can anyone lend a hand?
     
  12. AbyssWanderer

    AbyssWanderer

    Joined:
    Mar 15, 2016
    Posts:
    77
    Well, if you seek for a cheap solution, you add texture as a cookie to the light (don't forget to set texture's alpha source to "create from Grayscale" and wrap mode to "clamp" in import settings - http://prntscr.com/g1j323).
    You will get something like this:
    http://prntscr.com/g1j2p7
    The texture for cookie I used looks like this:
    http://prntscr.com/g1j36a

    Now the line where your light touches the surface is constant. So you won't have the scanning effect.
    To have one I would suggest is adding another spot light with cookie, reduce it's spot angle and start rotating the light.
    You will get something like this:
    http://prntscr.com/g1j83k
    But as the second light will move, it will create effect of scanning in between the line of the first light.

    Can work out!
    But let's see if Lexie will suggest anything better.
     
    wetcircuit likes this.
  13. DMCH

    DMCH

    Joined:
    Nov 6, 2012
    Posts:
    88
    Hi. I was wondering what level of control your plugin provides for the shape of the light volume? Looking to create a volume of light from an arched window (see attached) - would this or something passably close be possible?

    Also on performance - I'm using the free LightShafts that I think was created by a member of the Unity Team, but never integrated with the engine - this has around 20 setpass calls per instance, so it's tough on older desktops. How do you reckon your plugin compares performance wise?
     

    Attached Files:

  14. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    This system only supports the shapes unity's dynamic lights support, so cone, point and directional. It only offers as much control as unity's dynamic light system offers. So you'd have to place a light behind that window with a cookie or shadows enabled, but it probably wont be what you want.

    It does support projectors that use the additive projector shader. So you could use one of those with a cookie and orthogonal rendering enabled.

    Performance wise each light is 1 draw call. The base effect does a few draw calls to apply the final result of all the volumetric lights to the rendered image. The actual performance depends on your settings.
     
  15. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    106
    Hi, Im having some volumetric leaking issue...it working fine if I turn off the volumetric on camera

     
  16. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Is that from the directional light? you might have to increase unity's shadow range.
     
  17. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    106
    yap, it from directional light. Increase the shadow range doesn't work, but it work if I change shadow projection from close fit to stable fit
     
  18. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    hmm. pretty sure I fixed the issue with stable fit a few builds ago. maybe a file didn't get updated when you last updated the package. removing the folder and reimporting the newest version might solve your issue. make a backup incase you edited the files.
     
  19. borrowedLadder

    borrowedLadder

    Joined:
    Feb 11, 2015
    Posts:
    21
    Hey there, I've just added hxVL to my VR project. Everything seems to work fine with the lighting if you press play from the editor, however if I make a build of the game - it runs, but the volumetric lighting isnt working.

    Is there something obvious I'm doing wrong? :)
     
  20. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    couple things to check.

    Make sure single pass rendering is enabled in the player settings.

    If you have moved the folder for where the plug-in lives then it causes issues.

    Try building out a debug build to see if there are any errors coming up. If your project has other errors it will stop the volumetric shaders from loading.

    There might be another image effect causing issues when building out, try a version that just has my plug-in on the camera to see if it works.
     
  21. dinosec

    dinosec

    Joined:
    May 24, 2017
    Posts:
    8
    I love this product, nice, beautiful, and works fine in my VR project.
    but it takes about 5ms to render in graphic card. if I turn off HxVolumetricLight, i can save this 5ms.
    is it possible to reduce more rendering time for HxVolumetricLight?
     
  22. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Lowering sample count or the resolution in general settings goes a long way to speeding up the effect. the performance of this effect has to do with how many samples * how many pixels * how many lights. So lowering the amount of volumetric lights, sample count or resolution go a long way to speeding it up.
     
  23. borrowedLadder

    borrowedLadder

    Joined:
    Feb 11, 2015
    Posts:
    21
    Hey there, I've made sure single pass is on, the plugin is in the original folder. I've made a debug build and I'm not getting any errors from there.

    The scene I have is basically empty as I've tried to work out whats going wrong but I can't seem to figure it out. It looks like a similar issue to what AbyssWanderer had. I know he said he could just not use the scene he had a problem on - but I seem to get this issue with even basic scenes I setup.

    Could you give some advice on this please, as its completely unusable for me right now. I'm happy to send over a basic scene showing this not working

    Hierarchy:
    upload_2017-8-14_14-9-34.png

    Game View in Editor (running - light works correctly):
    upload_2017-8-14_14-9-50.png

    Build (running - lighting doesnt work): upload_2017-8-14_14-10-24.png








     
  24. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Unity's default quality setting on low has shadow casting lights disabled. I haven't found a way to access this player setting from script to figure out if shadow casting lights are disabled by the quality setting. This means if a light has shadow casting enabled it expects unity to give it a callback to hook into unity's rendering pipeline. This never gets called if unity has disabled shadow because of the selected quality setting.

    If you enable shadow casting lights in unity's quality settings or switch to a quality setting that allows for shadow casting lights. it should fix your issue.
     
  25. borrowedLadder

    borrowedLadder

    Joined:
    Feb 11, 2015
    Posts:
    21
    It worked! Thanks for the help Lexie, really appreciate it :)
     
  26. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    Hi, we are having some problems with a custom shader on a projector.

    Here is the shader: https://ufile.io/w2m7g
    Code (CSharp):
    1. Properties {
    2.     [HDR]_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
    3.     _Cutoff("Cutoff", Range(0, 1.1)) = 1.1
    4.     _MainTex ("Main Texture", 2D) = "white" {}
    5.     _DistortTex("Distort Texture", 2D) = "white" {}
    6.     _Mask ("Mask", 2D) = "white" {}
    7.     _Speed("Distort Speed", Float) = 1
    8.     _Scale("Distort Scale", Float) = 1
    9.     _MaskPow("Mask pow", Float) = 1
    10. }
    11.  
    12. Category {
    13.     Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    14.     Blend DstColor Zero
    15.     Cull Off Lighting Off ZWrite Off
    16.     Offset -1, -1
    17.  
    18.     SubShader {
    19.         Pass {
    20.      
    21.             CGPROGRAM
    22.             #pragma vertex vert
    23.             #pragma fragment frag
    24.          
    25.             #include "UnityCG.cginc"
    26.  
    27.             sampler2D _MainTex;
    28.             sampler2D _Mask;
    29.             sampler2D _DistortTex;
    30.             half4 _TintColor;
    31.             half _Cutoff;
    32.             half _Speed;
    33.             half _Scale;
    34.             half _MaskPow;
    35.             float4x4 unity_Projector;
    36.             float4x4 unity_ProjectorClip;
    37.          
    38.             struct appdata_t {
    39.                 float4 vertex : POSITION;
    40.                 half4 color : COLOR;
    41.                 float2 texcoord : TEXCOORD0;
    42.             };
    43.  
    44.             struct v2f {
    45.                 float4 vertex : SV_POSITION;
    46.                 half4 color : COLOR;
    47.                 float4 texcoord : TEXCOORD0;
    48.                 float2 uvMask : TEXCOORD1;
    49.                 float4 uvShadow : TEXCOORD2;
    50.                 float4 uvMainTex : TEXCOORD3;
    51.                 UNITY_FOG_COORDS(4)
    52.  
    53.             };
    54.          
    55.             float4 _MainTex_ST;
    56.             float4 _Mask_ST;
    57.             float4 _DistortTex_ST;
    58.  
    59.             v2f vert (appdata_t v)
    60.             {
    61.                 v2f o;
    62.                 o.vertex = UnityObjectToClipPos(v.vertex);
    63.                 o.color = v.color;
    64.  
    65.                 o.uvMainTex = mul(unity_Projector, v.vertex);
    66.                 o.texcoord.xy = TRANSFORM_TEX(o.uvMainTex.xyz, _MainTex);
    67.                 o.texcoord.zw = TRANSFORM_TEX(v.texcoord, _DistortTex);
    68.                 o.uvMask = TRANSFORM_TEX(o.uvMainTex.xyz, _Mask);
    69.                 o.uvShadow = mul(unity_Projector, v.vertex);
    70.                 UNITY_TRANSFER_FOG(o,o.vertex);
    71.                 return o;
    72.             }
    73.  
    74.             sampler2D_float _CameraDepthTexture;
    75.             float _InvFade;
    76.          
    77.             half4 frag (v2f i) : SV_Target
    78.             {
    79.                 half4 distort = tex2D(_DistortTex, i.texcoord.zw)*2-1;
    80.                 half4 tex = tex2D(_MainTex, i.texcoord.xy + distort.xy / 10 * _Scale + _Speed * _Time.xx);
    81.                 half4 tex2 = tex2D(_MainTex, i.texcoord.xy - distort.xy / 7 * _Scale - _Speed * _Time.xx * 1.4 + half2(0.4, 0.6));
    82.                 tex.rgba *= tex2.rgba;
    83.                 half mask = tex2D(_Mask, i.uvMask).a;
    84.                 mask = pow(mask, _MaskPow);
    85.                 half4 col = i.color * _TintColor * tex;
    86.                 UNITY_APPLY_FOG(i.fogCoord, col);
    87.                 half m = saturate(mask - _Cutoff);
    88.                 half alpha = saturate(tex.a * m * _TintColor.a * 2);
    89.  
    90.                 half clampMutliplier = 1 - step(i.uvMainTex.x, 0);
    91.                 clampMutliplier *= 1 - step(1, i.uvMainTex.x);
    92.                 clampMutliplier *= 1 - step(i.uvMainTex.y, 0);
    93.                 clampMutliplier *= 1 - step(1, i.uvMainTex.y);
    94.                 half projectedCordZ = i.uvShadow.z;
    95.                 clampMutliplier *= step(projectedCordZ, 1);
    96.                 clampMutliplier *= step(-1, projectedCordZ);
    97.                 clampMutliplier = clampMutliplier;
    98.                 clip(alpha - 0.02);
    99.                 return saturate(col * (1-col) + col * (1.2 - alpha*alpha) - alpha + 2 - clampMutliplier);
    100.             }
    101.             ENDCG
    102.         }
    103.     }  
    104. }
    105. }

    What things should I modify to make this shader work properly? The programming of shaders is difficult for me, so I would appreciate a good explanation :)
     
  27. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    For things like this you should consider using a deferred decal system instead of a transparent object. The issue with using a transparent blood splatter is they wont receive shadows from unity's lights. this can make them stand out especially in a dark game. I think there are a few implementations on the asset store that you could check out.

    Deferred decals will run a lot faster and allow you to add a lot of small details like this blood/dirt splatter to your world with out them looking out of place. they also work a lot better with other post processing effects like SSAO etc.

    Saying that I can get this shader working with my volumetric plug-in if you want. But a deferred decal system would look a lot better.
     
    hopeful likes this.
  28. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Additional to the above comment, Alloy has an excellent deferred decal implementation, and also supports Hx Volumetric Lighting.
     
  29. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Hi there! We think about buying this plugin. We just have one question.

    Do I properly understand that this plugin does not have any sort of atmospheric scattering?
    If there is none, can we somehow replicate it by tweaking ambient lighting in it?
    I mean, can we achieve the effect of a rayleigh fog with it? Will it blend to skybox with great distance?
     
  30. emosia

    emosia

    Joined:
    Feb 19, 2013
    Posts:
    11
    Hi, We have been using your asset for sometime and it is great so far, congrats :)
    However, we can't make it work alongside SEGI in Unity version 2017.1.0f3. It was working well in version 5.5.1f1. Is there something you can do about it?
    Thanks in advance...
     
  31. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I can look into it tomorrow, currently out of office. can you give me more details?
     
  32. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    Hi, sorry to bug you, I know you're busy. I'm trying to get a very simple surface shader to play nicely with the transparency features in HxVL. I tried to follow the instructions in the readme but they only really make sense for a vert/frag shader setup.

    upload_2017-9-10_10-17-33.png
    This is what it looks like with transparency support on (transparent objects draw on top of volumetrics)

    upload_2017-9-10_10-21-52.png
    This is what it looks like without transparency support on (volumetrics draw on top of transparent objects)


    Here's the code. Generated with Amplify Shader Editor and then modified as well as I could based on the documentation.

    Code (CSharp):
    1. // Made with Amplify Shader Editor
    2. // Available at the Unity Asset Store - http://u3d.as/y3X
    3.  
    4.  
    5. Shader "SimpleDepthFadeWater"
    6. {
    7.     Properties
    8.     {
    9.         [HideInInspector] __dirty( "", Int ) = 1
    10.         _Smoothness("Smoothness", Range( 0 , 1)) = 0
    11.         _Depth("Depth", Float) = 0
    12.         _ShallowColor("ShallowColor", Color) = (0,0,0,0)
    13.         _DeepColor("DeepColor", Color) = (0,0,0,0)
    14.     }
    15.  
    16.     SubShader
    17.     {
    18.         Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+0" "IgnoreProjector" = "True" "ForceNoShadowCasting" = "True" }
    19.         Cull Back
    20.         CGPROGRAM
    21.         #include "UnityCG.cginc"
    22.         #include "Assets/Plugins/HxVolumetricLighting/BuiltIn-Replacement/HxVolumetricCore.cginc"
    23.  
    24.         #pragma target 3.0
    25.         #pragma surface surf Standard alpha:fade keepalpha
    26.         #pragma multi_compile VTRANSPARENCY_OFF VTRANSPARENCY_ON
    27.  
    28.         struct Input
    29.         {
    30.             float4 screenPos;
    31.             #ifdef VTRANSPARENCY_ON
    32.                 float4 projPos : TEXCOORD0;
    33.             #endif
    34.         };
    35.  
    36.         uniform float4 _ShallowColor;
    37.         uniform float4 _DeepColor;
    38.         uniform sampler2D _CameraDepthTexture;
    39.         uniform float _Depth;
    40.         uniform float _Smoothness;
    41.  
    42.         void surf( Input i , inout SurfaceOutputStandard o )
    43.         {
    44.             float4 ase_screenPos = float4( i.screenPos.xyz , i.screenPos.w + 0.00000000001 );
    45.             float screenDepth1 = LinearEyeDepth(UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture,UNITY_PROJ_COORD(ase_screenPos))));
    46.             float distanceDepth1 = abs( ( screenDepth1 - LinearEyeDepth( ase_screenPos.z/ ase_screenPos.w ) ) / ( _Depth ) );
    47.             float clampResult10 = clamp( distanceDepth1 , 0.0 , 1.0 );
    48.             float4 lerpResult3 = lerp( _ShallowColor , _DeepColor , clampResult10);
    49.             o.Albedo = (lerpResult3).rgb;
    50.             o.Smoothness = _Smoothness;
    51.             o.Alpha = (lerpResult3).a;
    52.         }
    53.  
    54.         ENDCG
    55.     }
    56.     CustomEditor "ASEMaterialInspector"
    57. }
    58. /*ASEBEGIN
    59. Version=13102
    60. 7;29;2546;1374;1738.953;537.9044;1.3;True;False
    61. Node;AmplifyShaderEditor.RangedFloatNode;2;-774.4686,168.5427;Float;False;Property;_Depth;Depth;2;0;0;0;0;0;1;FLOAT
    62. Node;AmplifyShaderEditor.DepthFade;1;-608.4686,125.5427;Float;False;1;0;FLOAT;1.0;False;1;FLOAT
    63. Node;AmplifyShaderEditor.ColorNode;6;-541.4686,-67.45734;Float;False;Property;_DeepColor;DeepColor;4;0;0,0,0,0;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
    64. Node;AmplifyShaderEditor.ClampOpNode;10;-464.5657,322.1998;Float;False;3;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;1.0;False;1;FLOAT
    65. Node;AmplifyShaderEditor.ColorNode;5;-542.4686,-238.4573;Float;False;Property;_ShallowColor;ShallowColor;3;0;0,0,0,0;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
    66. Node;AmplifyShaderEditor.LerpOp;3;-317.4686,102.5427;Float;False;3;0;COLOR;0.0;False;1;COLOR;0.0,0,0,0;False;2;FLOAT;0.0;False;1;COLOR
    67. Node;AmplifyShaderEditor.SwizzleNode;7;-184.4686,6.542664;Float;False;FLOAT3;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT3
    68. Node;AmplifyShaderEditor.RangedFloatNode;11;-188.849,-120.6846;Float;False;Property;_Smoothness;Smoothness;1;0;0;0;1;0;1;FLOAT
    69. Node;AmplifyShaderEditor.SwizzleNode;8;-142.4686,155.5427;Float;False;FLOAT;3;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT
    70. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;0,0;Float;False;True;2;Float;ASEMaterialInspector;0;0;Standard;SimpleDepthFadeWater;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;True;False;Back;0;0;False;0;0;Transparent;0.5;True;False;0;False;Transparent;Transparent;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;False;0;4;10;25;False;0.5;True;0;Zero;Zero;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Cylindrical;False;Relative;0;;-1;-1;-1;-1;0;0;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;OBJECT;0.0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
    71. WireConnection;1;0;2;0
    72. WireConnection;10;0;1;0
    73. WireConnection;3;0;5;0
    74. WireConnection;3;1;6;0
    75. WireConnection;3;2;10;0
    76. WireConnection;7;0;3;0
    77. WireConnection;8;0;3;0
    78. WireConnection;0;0;7;0
    79. WireConnection;0;4;11;0
    80. WireConnection;0;9;8;0
    81. ASEEND*/
    82. //CHKSM=11E2C66645D562AA9C33B5869E4DCFEF2EF300AF
    I feel like I might be missing something easy. Do you have any advice?
     
  33. Neilsonnn

    Neilsonnn

    Joined:
    Mar 29, 2016
    Posts:
    7
    hey Lexie,

    I'm working on an Oculus VR project where the player is scaled to 50x larger than the world. At that size the volumetric lighting starts having clipping problems (specifically the directional light), increasing the near clipping distance of the camera fixes the problem but it ends up being too large a near clipping plane, the player can't bring things close to their face. The other volumetric point lights also start to have some ghost artifacts at that scale. Any thoughts on a workaround?

    I attached an image of what a player at 50 scale looks like in the test scene while leaving the near clipping plane at the default 0.3.

    Thanks,
    Neilson
     

    Attached Files:

  34. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    you have to build out the shader and then modify it. If you select the shader in unity there is a button called show "generated code" Copy that into a new shader to get a vert/frag setup. If i can some spare time i can convert it for you, im really busy right now though.
     
    brisingre likes this.
  35. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    This is more an issue with unity's shadow maps. They start clipping really bad at large distances, You normally don't see this clipping as the back faces of objects aren't lit. If I scale that scene up by 50x I'm getting crazy light leaking from unity's shadows and insane shadow acne everywhere.

    The work around for fixing unity's shadow maps is to instead scale down your world and have character and camera a normal size. You could even meet somewhere in the middle.
     
  36. Vagrod

    Vagrod

    Joined:
    Aug 4, 2017
    Posts:
    82
    Unfortunately for me, HxVL silently refuses to do anything on Unity 2017. Couple days before, on 5.6, before update, everything was working great. Something is wrong with my scene setup or it is some known issue?

    UPD: No, it started to work as expected! After I restarted Unity twice and rebooted. Straaaange...
     
    Last edited: Sep 17, 2017
  37. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    I think I should be able to manage this.Thanks for your help!

    Unity upgrades are weird. Sometimes it helps to delete whatever asset is having problems and reinstall it from the asset store. Sounds like it's fixed though.
     
    Last edited: Sep 18, 2017
  38. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    try what brisingre suggested. Sometimes removing and reimported can help. Other things to check is that your shadow distance and shadow are enabled in the quality settings.
     
  39. Vagrod

    Vagrod

    Joined:
    Aug 4, 2017
    Posts:
    82
    Thank you! I'll try if this happens again.
     
  40. the_Bad_Brad

    the_Bad_Brad

    Joined:
    Nov 2, 2014
    Posts:
    278
    Still no support for high-end mobile devices such as Note 8 or iPhone X?
     
    Last edited: Sep 24, 2017
  41. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I want to try and use this to cast shadows, but those shadows will be more like "god rays", and I need them to be triggers also, can this asset do that ? long shot I know :)
     
  42. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    Not specifically, but you can detect whether something is in shadow, more or less, by seeing if you can draw a ray from the object to the light (spot or point shadow) or draw an infinite ray from the object in the opposite direction of the light (directional.)
     
    Lexie and wetcircuit like this.
  43. ggevrin

    ggevrin

    Joined:
    Jan 8, 2013
    Posts:
    13
    Hello, I am facing an issue with Hx Volumetric. I guess there is something wrong in my settings but I cannot figure what. The issue is : the volumetric light is passing through objects between the light source and the camera. See the screenshots (the cube is using an unlit material but the issue occurs whatever shader the cube is using) :
    Hx ON : light is seen through the opaque mesh
    BugHx-ON.PNG
    Hx OFF :
    BugHx-OFF.PNG
    This scene has been made only to show the issue so just one volumetric point light and defauilt settings for Hx Volumetric camera component. Made with Unity 5.5.
    Has anyone encountered this issue ?
    Thanks in advance for your replies
    EDIT : after further investigation, it looks that the reesult is erratic with standard shader and the error always occur with unlit shader. It's problematic for us because some meshes need to have an unlit material. Am I missing something ? Do I need to use the shaders provided with Hx instead of the Unity shaders ?
     
    Last edited: Oct 2, 2017
  44. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Hi @Lexie I'm testing this asset right now and I was wondering: how can I control the overall density/intensity of the effect via code? I need to blend in and out of it. Thanks!

    Edit: I think Density (on HxVolumetricCamera.cs) is what I was looking for... ;)
     
    Last edited: Oct 2, 2017
    Lexie likes this.
  45. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    Does the light have shadows turned on? Does the cube cast shadows?

    You could also try turning transparency support on on on the HXV camera script. I'm not sure if it will help, but it sometimes helps this sort of thing.
     
  46. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Unitys unlit shader does not cast shadows. Only shadow casting objects can block light. You will have to write a shadow casting unlit shader if you want it to block light. There are many version of this if you google it. If you cant find an unlit shadow casting shader then i can dig through my old projects and find one.
     
    hopeful likes this.
  47. ggevrin

    ggevrin

    Joined:
    Jan 8, 2013
    Posts:
    13
    Thanks for your answers.
    @brisingre : yep, shadows are on. I tried transparency but no change (seems logical as I do not want transparency).
    @Lexie : ok. It makes sense, I will dig in this way. Thanks. I use also volumetric particles, should I make anything special to avoid artefacts (like rendering order to avoid particles been shown behind the cube instead of being masked) ?
     
    Last edited: Oct 2, 2017
  48. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    rendering lots of particles with low alpha works best to avoid flickering as you move closer or further away from the mass of particles. My system manually render the particle so order doesn't matter for the volumetric part of it. The ordering only counts if you also want unity to render out the particles using its rendering system.

    If you look at the example scene you will note that the rendering on the particle is actually disabled. This means that it only renders to my system so order doesn't matter.
     
  49. ggevrin

    ggevrin

    Joined:
    Jan 8, 2013
    Posts:
    13
    @Lexie : I made a quick test and it looks fine ! Thank you for your fast help. I have still volumetric particles visible through mesh with standard material shader but I'll investigate further before coming back ;)
     
  50. ggevrin

    ggevrin

    Joined:
    Jan 8, 2013
    Posts:
    13
    yep, some of my volumetric particles also use the renderer so I have to made some tests.