Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug Particle Systems with Lights Bugged

Discussion in '2019.3 Beta' started by Skitto, Jun 12, 2019.

  1. Skitto

    Skitto

    Joined:
    Jun 3, 2017
    Posts:
    19
    Hello, I recently upgraded my project to Unity version 2019.3.0a5 and my HDRP packages to 6.7.1. I also added the VFX Graph 6.7.1 package to my project when updating.

    Pretty much the reason for updating everything was that I wanted to work with the VFX Graph, and my outdated Unity and Pipeline wasn't playing nice with it.

    Everything works fine, until I noticed that any Particle System that has a light enabled will cause a gray screen and immense lag if on screen. (VFX Graphs have had no problems, just the older Shuriken particle systems) I've had to disable all of the lights on my particle systems, which is not ideal. Any ideas on what's causing this?
     
  2. Skitto

    Skitto

    Joined:
    Jun 3, 2017
    Posts:
    19
    Okay, found out that whenever the bug happens, this error is thrown:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Experimental.Rendering.HDPipeline.LightLoop.PrepareLightsForGPU (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Experimental.Rendering.HDPipeline.HDCamera hdCamera, UnityEngine.Rendering.CullingResults cullResults, UnityEngine.Experimental.Rendering.HDPipeline.HDProbeCullingResults hdProbeCullingResults, UnityEngine.Experimental.Rendering.HDPipeline.DensityVolumeList densityVolumes, UnityEngine.Experimental.Rendering.HDPipeline.DebugDisplaySettings debugDisplaySettings, UnityEngine.Experimental.Rendering.HDPipeline.AOVRequestData aovRequest) (at Library/PackageCache/com.unity.render-pipelines.high-definition@6.7.1-preview/Runtime/Lighting/LightLoop/LightLoop.cs:1809)
    3. UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.ExecuteRenderRequest (UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline+RenderRequest renderRequest, UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Experimental.Rendering.HDPipeline.AOVRequestData aovRequest) (at Library/PackageCache/com.unity.render-pipelines.high-definition@6.7.1-preview/Runtime/RenderPipeline/HDRenderPipeline.cs:1603)
    4. UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Camera[] cameras) (at Library/PackageCache/com.unity.render-pipelines.high-definition@6.7.1-preview/Runtime/RenderPipeline/HDRenderPipeline.cs:1449)
    5. UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera[] cameras) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipeline.cs:72)
    6. UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, UnityEngine.Camera[] cameras, System.IntPtr loopPtr, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineManager.cs:67)
    7. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    8.  
     
  3. JustLoren

    JustLoren

    Joined:
    Nov 12, 2017
    Posts:
    5
    This is related to issue #1059208 in the issue tracker. It was supposedly fixed, but it's back now.
     
  4. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    I am experiencing this in 2019.3.0b12
    Is this a known issue? I couldn't find it in the issue tracker
     
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
  6. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    If particle system has light module with one light, light is not seen. Did anyone experience that?
     
  7. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    Thank you. It seems that it has been an issue after the initial fix since July, so I messed around for a bit and found a temporary fix. Please only implement if you know how to code.

    the issue is the light that is passed into the processing loop in LightLoop.cs. I don't have visibility into where the light is assigned and passed as a CullingResults but this is relatively low risk to implement, and definitely less harmful than the null light getting passed around and throwing errors.

    in LightLoop.cs PerpareLightsForGPU around line 2030 (will be different depending on build) replace:
    Code (CSharp):
    1. if (!aovRequest.IsLightEnabled(light.light.gameObject))
    2.                                 continue;
    with
    Code (CSharp):
    1. if ((object)light.light != null)
    2.                         {
    3.                             if (!aovRequest.IsLightEnabled(light.light.gameObject))
    4.                                 continue;
    5.                         }
    this was throwing the error because light.light was null and so gameObject wasn't defined.
    then in HDAdditionalLightData.Types.cs at the beginning of the last function:
    Code (CSharp):
    1. internal HDLightType ComputeLightType(Light attachedLight)  
    around line 422, insert:

    Code (CSharp):
    1. if ((object)attachedLight == null)
    2.             {
    3.                 return HDLightType.Point;
    4.             }
    The VFX i use are all point lights, and i didn't test but i assume it probably wouldn't work as intended with other light types, but it's better than nothing.

    Again, please only implement if you understand what it is doing.
     
    Zandarn and Bordeaux_Fox like this.
  8. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
  9. MajorParts

    MajorParts

    Joined:
    Sep 27, 2014
    Posts:
    88
    2019.3.0f1 and HDRP 7.1.6

    No errors and rendering of the scene doesn't stop anymore, but the lights don't actually light anything.
     
    BigRookGames likes this.
  10. Vita-

    Vita-

    Unity Technologies

    Joined:
    Jul 2, 2019
    Posts:
    121
  11. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
  12. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    221
    I'm too interested in this :)
     
  13. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    it's available now:
    upload_2020-2-27_8-42-58.png
     
  14. MajorParts

    MajorParts

    Joined:
    Sep 27, 2014
    Posts:
    88
    Still a problem with this when the light prefab used has shadows enabled.