Search Unity

Question Particle System with bigger size is rendered behind the sprite.

Discussion in 'General Graphics' started by Deleted User, Jun 22, 2020.

  1. Deleted User

    Deleted User

    Guest

    I have a 3d scene with a simple sprite in the middle.
    If I place particles in front of the sprite - it renders in front. If behind - it renders behind. (Not using any sorting order by index, etc. Just by the distance to the camera)
    But if I increase the size of the particle system, all of the particles start to render behind the sprite, although they are still physically in front of the sprite.
    What I mean by size: increased lifetime or increased speed or bigger shape but not individual particles. Anything that makes the particle system take a bigger space. If the space the particle system is occupying is somewhat bigger than the actual sprite it starts to render the sprite in front, which is clearly something no one would want.

    I am assuming it has something to do with a pivot that the particle system creates always at the middle of the shape? No idea...
    Please help?:)
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    The center of the bounding box of the particle system is used for sorting. Changing the size of the shape will affect where the particles appear, and thus change where the center of the bounding box is.

    You can click "show bounds" when the system is selected in the scene view, to see it. (bottom right corner of scene view).

    You can set the shape to be a 2D shape by setting its transform.z to 0.0 (in the shape module settings). Then all the particles will be created on a plane.

    Hope this information helps.
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    Thank you for your answer!
    If definitely works for static particles with scale.z = 0. But for moving particle system, which leaves particles behind itself in world space (which was my aim, I should have specified in the beginning) there is still a 3d bound being created because it is a 3d scene nonetheless, and therefore if the bound is big enough, it will be kicked behind the sprite. Is there perhaps any workaround for this case?
     
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Sorting layers or sorting fudge are 2 options that spring to mind :)

    The sorting fudge applies a bias to the sort distance and it is in the particle renderer settings