Search Unity

How to stop my particle systems from being frustum culled

Discussion in 'General Graphics' started by GenericJoe, Oct 30, 2020.

  1. GenericJoe

    GenericJoe

    Joined:
    Apr 27, 2012
    Posts:
    33
    Is it possible to control the culling of particle systems in Unity 2019? I am referring to the entire system, not individual particles.

    In my use-case, I am modifying the vertex transformation to get the "distant object effect".

    When the camera thinks it is not viewing something it will cull it (frustum culling). For most game objects you can get around this by inflating the size of the bounds to make the camera think it is within its frustum and therefore not get culled. However, particle systems are not a single object, they are many particles and I can’t see a way of manipulating the total bounds of the system.

    Any ideas?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    No it's not possible.
    One thing you could do is force the bounds to be larger by adding 2 particles, one in each corner at a very large value.
     
  3. GenericJoe

    GenericJoe

    Joined:
    Apr 27, 2012
    Posts:
    33
    Hi, do you mean with invisible "dummy" particles? How would I control it so that only 2 particles appeared in the corners?
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    You can call Emit with an infinite lifetime.
    One at 10000, 10000, 10000 and one at -10000, -10000, -10000
     
    Last edited: Oct 30, 2020
  5. GenericJoe

    GenericJoe

    Joined:
    Apr 27, 2012
    Posts:
    33
    Thank you for the answers, I have managed to get this working now. Much appreciated for taking the time.

    Needless to say, this solution does feel very hacky, it's a shame Unity doesn't give us more control i.e. stop individual culling. Anyway, maybe a future feature.
     
    richardkettlewell and karl_jones like this.
  6. oTaijjo

    oTaijjo

    Joined:
    Nov 3, 2019
    Posts:
    30
    Maybe someone else might find this helpful:
    We had this problem, too, in 2021.2.17. With us it was because the ParticleSystem was inside a container moved in code. We fixed the problem by switching the ParticleSystem's Simulation Space to Custom, and injected the ParticleSystem's parent (the moving object) into the the Custom Simulation Space field. That fixed the problem for us.
     
  7. teasully

    teasully

    Joined:
    Nov 26, 2016
    Posts:
    17
    For anyone else wondering, the only solution I found was to convert my particle systems to VFX graph particle effects. Luckily, the vertex shader I am using uses ShaderGraph, which seems to be the only way to use a custom shader using VFX Graph.

    To get a ShaderGraph shader working with VFX Graph:
    1. Have ShaderGraph and VFX Graph installed in project
    2. Edit -> Preferences -> Visual Effects -> Check "Experimental Operators/Blocks" (seen in 2nd post here)
    3. Create a shader in Shader Graph
    4. In the shader in Shader Graph, open the Graph Settings, scroll down, and check "Support VFX Graph" (seen in 2nd post here)
    5. Create a Visual Effect in VFX Graph
    6. Make the output a "Output Particle Mesh" node
    7. Insert your Shader Graph shader into the "Shader Graph" section
    8. Rejoice