Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Broken particle rotation when 90 degrees is exceeded

Discussion in 'Editor & General Support' started by UnknwnTrgt, Jun 13, 2022.

  1. UnknwnTrgt

    UnknwnTrgt

    Joined:
    Feb 23, 2022
    Posts:
    8
    Hey all,

    This effect is hard to explain so I'll attach a video...but this effect happens on both Unity 2021.16.4f1 and 2022.1.4f1.

    It seems like the particle gets gimbal locked right at the top and then spins it around to correct itself, rather than just rotating past the top. Like I said, hard to explain so please check the video in the ZIP.
     

    Attached Files:

  2. UnknwnTrgt

    UnknwnTrgt

    Joined:
    Feb 23, 2022
    Posts:
    8
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
  4. UnknwnTrgt

    UnknwnTrgt

    Joined:
    Feb 23, 2022
    Posts:
    8
    I'm just an artist, not much of a programmer...but I'm just rotating the camera, not changing any transforms. I basically just am using everything as it comes with Shuriken. :\
     
  5. UnknwnTrgt

    UnknwnTrgt

    Joined:
    Feb 23, 2022
    Posts:
    8
    Bumping again...

    Can't enable roll because stuff like this happens:


    So how can I make the particles not look so bad?
     
  6. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,690
    Hi!

    The behavior seen in your original video is not a bug: that's what you get for a camera-facing plane, whose local "up" axis must be aligned with the world's "up" axis.

    Now if you enable "allow roll" in the particles, they will roll together with the camera (that is, get their "up" vector aligned with the camera's) which is what you see in the second video.

    In this case if particles continued facing the camera when it rolls up past the zenith (90º up), they would cease to be correctly aligned with the world. If you flipped the camera completely so that it's top touched the ground, particles would be flipped upside down completely (relative to the world).

    There's no other ways of making a camera-facing plane. This is an inherent limitation of approximating an object with a simple plane instead.

    If you want better looking fog/clouds, you might need to try a different technique like volumetrics.
     
  7. UnknwnTrgt

    UnknwnTrgt

    Joined:
    Feb 23, 2022
    Posts:
    8
    Hm...so a lot of older flight sims used particle clouds but rarely experienced the flipping problem because they oriented the particle with the camera and allowed it to flip upside down. How hard would it be to replicate that behavior? Or is there some other way that they did it?
     
  8. UnknwnTrgt

    UnknwnTrgt

    Joined:
    Feb 23, 2022
    Posts:
    8
    Example;
     
  9. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,690
    What shoukd happen when flying directly above a cloud, looking down on it? Would it look “up” or “down”? At which point should it flip to keep its orientation aligned with the world?

    I guess you could change the world’s “up” direction used by particle quads to align it with the camera’s up when the camera looks up/down more than 45º, but that should be done in a custom vertex shader. I don’t think it is possible to do custom aligning directly in the particle system inspector.
     
  10. UnknwnTrgt

    UnknwnTrgt

    Joined:
    Feb 23, 2022
    Posts:
    8
    Thanks for all your help with this. I guess what it should do is keep the same world normal but invert the polygon when it switches...

    I'm trying to see if I can use the VFX graph to build some logic in to flip the polygon when the angle exceeds a certain amount. Unfortunately I can't find a simple boolean switch operator in there - is it something I'm missing?

    EDIT: Nevermind, it's "Branch" for anyone looking at this in the future.
     
    Kurt-Dekker likes this.
  11. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,690
    You're welcome! :)

    Wouldn't inverting the polygon instantly (and hence the texture in it) be more jarring that the default behavior of smoothly rotating towards the new orientation? I was under the impression that you were looking for an even smoother result, that's why I suggested 45º as the point at which particles begin interpolating to the new "up".