Search Unity

Particle System occlusion problem on Unity 2017.3.0f3

Discussion in 'General Graphics' started by churi24, Jan 10, 2018.

  1. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    Hi, we are having some problems with particle system when migrated our project from Unity 2017.1.0f3 to 2017.3.0f3 plus.
    The big problem here is the particle, maybe there is some new behaviour and configuration that we missed.
    On Unity 2017.1.0f3 work well, and on Unity 2017.3.0f3 not.

    The problem is when you put a particle system on the bone of the hand, when the Camera rotates, the particle disappear. It's like the bound is not following the bone of the hand despite of be the child of the bone.
    The particle is on the hand, and the hand is always inside the frustum of the camera, so the particle should be rendered.
    You could see the video down below who explains better what is happening.


    We are using this settings:


    By the way, if we change the parent of the particle system, for example, the root of the biped, the particle is visible.
    Any idea of what is happening?
     
    Deleted User likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Hi. Have you tried turning on the bounds rendering in the scene view of the particle system to see if culling is the issue? The option can be found in the Particle System Window when it is selected.
    Are you able to create a simple project with the same issue to share?
     
    richardkettlewell likes this.
  3. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    In the video is activated, is the big and large rectangle on the right side. You could see at minute 0:23, when the camera rotate to the left, the particle (that white line) follows the hand, but the bounds not. (sorry for the low resolution on the video)

    I think Final Ik is interfiering with the bounds of the particles, because if I delete all the scripts that move the hand and torso, the bounds goes to the center of the particle. It's a weird problem because Final IK is a solution to solve the problem of IK, it has nothing to do with particles. So the question is.. is there any way to disable the occlusion? The particle will be always on the front of the camera. I repeat.. this work fine with Unity2017.1.0f3 but not with Unity 2017.3.0f3.
     
    Last edited: Jan 10, 2018
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    No you cant disable culling. This looks like a bug. Can you file a bug report with a sample project so we can look into it?
    Once I get a look at an example I may be able to offer some workarounds.
     
  5. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    oki, I have an example. Do I send a report using Help/ Report a Bug ? I sent you the example by private because the example contains the Final IK asset.
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    I checked your project, looks like a regression. I have filed a bug report. https://issuetracker.unity3d.com/is...s-are-incorrect-when-parented-to-animatoround
    The issue seems to be something to do with the animator. We had some internal changes to the transform and it looks like this is caused by that. We will investigate the bug and hopefully get a fix in a patch. Unfortunately I have not been able to find a workaround.
     
  7. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    okidoki, the link is: https://issuetracker.unity3d.com/is...ounds-are-incorrect-when-parented-to-animator We have to solve this fast because we are close to upload the game to Steam.
    Maybe if we dont parent the particle to the hand, and we use a script on the particle to follow te hand..
    I recently test this:
    Code (CSharp):
    1.     public Transform particle;
    2.     public Transform targetParticle;
    3.  
    4.     public void Update()
    5.     {
    6.         particle.position = targetParticle.position;
    7.         particle.rotation = targetParticle.rotation;
    8.     }
    The bounds of the particle works fine, the particle now is not occluded, but the particle has a small delay when update the transform, so I decided to use LateUpdate. But yes... I've opened the Pandora's box...

    1) The problem is that LateUpdate now has a weird behaviour. The transform that the particle receive is completely different to targetParticle. Maybe I'm wrong, but with lateupdate the transform of targetParticle is broken. When you go with the camera to the left, it update the position and rotation, but with a really big offset from targetParticle. Now when you go to the right with the cam, it has a delay before the particle transform start to updating, and again, with a big offset.

    2) If you put the particle on the hand, the bounds of the particle updates wrong, but if you put the particle on the spine, the bounds updates fine. Maybe it has to do with the hierarchy where the particle is, or maybe not.

    Correct me if Im wrong please, in this case the Update() works fine because is previous to the Animator, but the LateUpdate() occurs after so receive a wrong transform. I think this is a serious problem. I hope the team found a solution soon.
     
    Last edited: Jan 12, 2018
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    The particles are updated internally during Update so anything you do in LateUpdate will be a frame behind.

    However there is actually a much simpler way to fix things.
    You can just force the bounds to expand by adding 2 particles at each corner. Give them an infinite life and make them transparent so they are invisible.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class IncreaseParticleBounds : MonoBehaviour
    4. {
    5.     public float size = 100;
    6.  
    7.     void Start ()
    8.     {
    9.         var ps = GetComponent<ParticleSystem>();
    10.         var ep = new ParticleSystem.EmitParams();
    11.         ep.startLifetime = float.PositiveInfinity;
    12.         ep.startColor = Color.clear;
    13.  
    14.         ep.position = new Vector3(size, size, size);
    15.         ps.Emit(ep, 1);
    16.  
    17.         ep.position = new Vector3(-size, -size, -size);
    18.         ps.Emit(ep, 1);
    19.     }
    20. }
    21.  
     
    churi24 and hippocoder like this.
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey,
    Why exactly are the particles updated internally during Update? Any scripted changes to animation, even something simple like rotating the head bone to look at something needs to be done in LateUpdate so the Animator would not override it. If you had some particle FX on that head like steam coming out from the mouth or whatever, that will still shoot out from where the mouth was in the animation or lag a frame behind if you used a following script and there's nothing we can do to fix that.
    Particles are just a visual effect so they really should be updated last, after all other game logic including whatever runs in LateUpdate.
     
    churi24 likes this.
  10. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    Ok, I will use it.
    The problem extends to anything that needs to get the position of the hand's Transform. Here I'm not talking about only the particle system, the problem is worst.. If you get the position of the hand, the position will be wrong if you get inside the LateUpdate. It's like you said, there is a problem with Animator, and extend to all cases who need to get the Transform on LateUpdate.

    I'm thinking the same
     
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Sorry my mistake. We do update after LateUpdate. I was thinking of something else.

    All the issues you are having sound like they are related to the internal transform changes, not specific to particles.
    We have some particle specific fixes for handling late update in 2017.3.0p2 which may help (https://issuetracker.unity3d.com/is...-not-work-when-moving-it-in-lateupdate-method) however the wrong transform values in script problems sound unrelated to this fix. I have pinged the dev responsible for the transform changes to see if he already knows about the problems. Can you also file a bug report about the incorrect transform values in script?

    Edit: I spoke to the dev, he was not aware of any issues so if you could file a bug report I can pass it on to him. Thanks
     
    Last edited: Jan 12, 2018
  12. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    Thanks for the help! I sent the new example by private.
     
    karl_jones likes this.
  13. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    No this is wrong :p

    It goes like this:

    Script Update
    Particle simulation
    Script LateUpdate

    If you want something custom then don’t use the automatic playback - use ParticleSystem.Simulate instead and then the update happens wherever you want it to be - the downside is that this will only run single-threadedly.

    Any arguments for it working a different way have their counter-arguments (eg this way allows users to access particle data after simulation via LateUpdate, which is useful). But no matter how good your argument may be, too much would break if we changed it ;)

    (This info isn’t a response to the bug reports though - they are indeed bugs that needs fixing. It’s just some info on why the updates are ordered like they are)
     
    churi24 and karl_jones like this.
  14. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    I tried to solve the problem with this, but it doesn't work for me :(
    A possible workaround to this problem is this:
    The idea is to remove the particle from the bone of the hand. Copy the hand bone transform in lateupdate so that the bounds of the particle do not update wrong. In this case the particle bounds should not be affected by the animator

    1) You have to do some script like this:
    Code (CSharp):
    1.  
    2. public class FollowTarget : MonoBehaviour
    3. {
    4.     public Transform handBoneTarget;
    5.     private void LateUpdate()
    6.     {
    7.         transform.position = handBoneTarget.position;
    8.         transform.rotation = handBoneTarget.rotation;
    9.     }
    10. }
    11.  
    2)Change the execution order so FollowTarget be after Final IK scripts. (Thanks Unity QA for this point)


    The bounds of the particle isn't affected using this solution. Thanks for the help! Now I have fire on the candle!! :D:D:D

     
    karl_jones and richardkettlewell like this.
  15. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Cool graphics!
     
    karl_jones and churi24 like this.