Search Unity

Making particles appear above scene objects?

Discussion in 'Editor & General Support' started by michaeleconomy, Jun 11, 2020.

  1. michaeleconomy

    michaeleconomy

    Joined:
    Aug 28, 2018
    Posts:
    58
    Hi

    I can't figure this out and would love some help. Is there a simple way to have particles (from a particleSystem) always render above the MeshRenderers/SkinnedMeshRenderers in my scene (regardless of position)?

    My big particles get obstructed off by the floor, and i want them to always render the entire particle.

    I'm using unity 2019 and URP.
    particle_covered_up.png
    Thanks for your help,
    -Michael
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    In the Particle System, try playing with the Renderer section. Specifically the Sorting Layer ID and Order in Layer.

    upload_2020-6-10_19-47-48.png

    I believe higher sorting layers will render after (on top of) earlier layers.
     
  3. michaeleconomy

    michaeleconomy

    Joined:
    Aug 28, 2018
    Posts:
    58
    Thanks, I experimented with the sort order pretty extensively and it doesn't seem to effect anything (in my setup). But maybe I'm missing something obvious?


    If i changed renderer.renderMode to "mesh" this fixes it. I'm unsure what else this change will break though, would love some advice here if anyone has dealt with this before.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Maybe render your particles on a separate camera? Set the second camera to have a higher depth value, so it renders after the main camera.
     
    PraetorBlue likes this.
  5. amxxvi

    amxxvi

    Joined:
    Dec 23, 2017
    Posts:
    12
    So, here we are in 2023, and I've been doing this, but it's extremely expensive.

    I only have 1 object in my entire game that's on a specific layer that I have an extra camera for.

    Reducing cameras is an easy way to increase FPS/performance of your game, so I'd like to know if there's a solution to this problem without requiring another camera.
     
    HaiderBassim04 likes this.
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    And you have checked in either the Profiler or Frame Debugger that this is actually a problem??

    I question both of these assertions. Are you properly culling what each camera sees?

    If Camera1 sees everything EXCEPT these particles and Camera2 sees ONLY the particles, the result should be nearly identical performance-wise.

    Go see for yourself in the Frame Debugger... Window -> Analysis -> FrameDebugger.

    Yes there is a tiny bit of overhead but I certainly wouldn't call it "extremely expensive." Plus the overhead seems to be constant regardless of how many objects are seen by either Camera, for a given scene.