Search Unity

!IsFinite(outDistanceForSort)

Discussion in 'Editor & General Support' started by fyrlandt, Jan 22, 2010.

  1. fyrlandt

    fyrlandt

    Joined:
    Aug 20, 2009
    Posts:
    80
    Hi, I have an error that I cant seem to fix or find the cause and doesnt seem to always appear but doesnt seem to do anything weird when I run it in the editor.

    !IsFinite(outDistanceForSort)
    UnityEditor.Handles:Internal_DrawCamera(Camera, Int32)
    UnityEditor.Handles:Internal_DrawCamera(Camera, Int32)
    UnityEditor.Handles:DrawCamera(Rect, Camera, Int32)
    UnityEditor.SceneView:OnGUI()
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
    System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    System.Reflection.MethodBase:Invoke(Object, Object[])
    UnityEditor.HostView:Invoke(String)
    UnityEditor.DockArea:OnGUI()

    [..\..\Runtime\Camera\RetainedRenderqueue.cpp line 334]

    and this as well

    !IsFinite(outDistanceForSort)
    UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean)
    UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean)
    UnityEditor.GameView:OnGUI()
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
    System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    System.Reflection.MethodBase:Invoke(Object, Object[])
    UnityEditor.HostView:Invoke(String)
    UnityEditor.DockArea:OnGUI()

    [..\..\Runtime\Camera\RetainedRenderqueue.cpp line 334]
     
  2. acme3D

    acme3D

    Joined:
    Feb 4, 2009
    Posts:
    203
    Hi, I'm having the same problem; when I start to get that error in the console my character starts falling through the ground and gets lost to infinity...

    Do you get any other odd behaviour in your game when you start to get those messages ? And... did you find a solution the the problem ?

    I also filed a bug report to Unity but with no feedback.

    Maybe if we exchange some info we can understand what is generating this problem....
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    are you moving too far away from the 0,0,0 point in the world?
     
  4. acme3D

    acme3D

    Joined:
    Feb 4, 2009
    Posts:
    203
    I don't know what you mean bytoo far away.... The problem seems to happen only when the character moves on the Z axys and passes value 142 (more or less).

    No odd behaviour when you move along the X axys (values 0 to 296).

    The weird thing is that it seems that the whole physics system gets screwed up: I tried to place another plane with a collider below my normal playfield and the character falls through. It seems that from the moment you start getting those messages any collision is ignored....
     
  5. borrrden

    borrrden

    Joined:
    May 6, 2009
    Posts:
    20
    I also have this problem. The error messages come in such vast quantities that the frame rate drops to about 10 FPS. It starts as soon as the scene is loaded (camera is in a fixed position staring at a wall with a few GUI options). We have no negative or infinite particle settings....and none of the stack traces lead back to any of our scripts.

    EDIT: Update, this also continues to happen after we have stopped playing the scene and are just looking into the editor.

    FUTHER EDIT: Oh, changing the depth of the camera from -1 to 0 fixed the errors in editor mode, and we found the culprit for the others. Don't quite know the reason yet (something is bad about this piece of geometry since it also gaves invalidAABB errors) but will post more info later.
     
    SM03 likes this.
  6. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    I just managed to do this by setting localScale to a vector that contained a NaN, too.
     
  7. MattFS

    MattFS

    Joined:
    Jul 14, 2009
    Posts:
    219
    hi - i'm getting a constant console spam of this error message when using TextMesh (3D Text)
    !IsFinite(outDistanceForSort)
    !IsFinite(outDistanceAlongView)
    UnityEditor.DockArea:OnGUI()
     
  8. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    This problem with 3D text has been logged in a bug report. However, in the meantime, you may be able to fix it by using Unicode for the Character setting in the font importer and/or changing the font size from the importer rather than the TextMesh component.
     
  9. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    This one should be fixed in next release ;-)
     
  10. MattFS

    MattFS

    Joined:
    Jul 14, 2009
    Posts:
    219
    cool, thanks guys! :)
     
  11. TheCheese

    TheCheese

    Joined:
    Nov 25, 2009
    Posts:
    82
    Setting the font size in the textmesh to 0 fixed it for me.
     
  12. striche

    striche

    Joined:
    Jan 4, 2011
    Posts:
    61
    That's really not a good solution. I may be using that font at various sizes throughout the application and you don't want to have a texture specific to each size. That begins to eat up memory and inflate your game's size on disk, which can be a real problem for iOS apps trying to stay under 20mb. You generally want to make one texture, that's big enough so that the highest font size usage still looks good.
     
  13. geyapingcn

    geyapingcn

    Joined:
    Jul 29, 2010
    Posts:
    25
    When divided by zero or NaN, then this error will come. The solution is to test the value of the divisor before calc it.
     
  14. Aram-Azhari

    Aram-Azhari

    Joined:
    Nov 18, 2009
    Posts:
    142
    I still get this error in Unity 4.5.
    The problem happens when I run a command using OnInspectorGUI()


    Code (CSharp):
    1.    public override void OnInspectorGUI()
    2.     {
    3.  
    4.         EditorGUILayout.BeginHorizontal();
    5.         minusClicked = GUILayout.Button("-");
    6.         plusClicked = GUILayout.Button("+");
    7.         EditorGUILayout.EndHorizontal();
    8.         EditorGUILayout.BeginHorizontal();
    9.         path.GeometryWidth = EditorGUILayout.FloatField("Width", path.GeometryWidth);
    10.         CreatePath = GUILayout.Button("Create path geometry");
    11.         EditorGUILayout.EndHorizontal();
    12.         debug = EditorGUILayout.Toggle("Edit", debug);
    13.  
    14.         if (plusClicked || minusClicked)
    15.         {
    16.             if (path != null)
    17.             {
    18.                 if (path.Points == null)
    19.                 {
    20.                     path.Points = new List<Vector3>();
    21.                     path.Rotations = new List<Quaternion>();
    22.                 }
    23.             }
    24.             if (plusClicked)
    25.             {
    26.                 if (path.Points.Count != 0)
    27.                 {
    28.                     path.Points.Add(path.Points[path.Points.Count - 1] + new Vector3(1, 0, 1));
    29.                     path.Rotations.Add(path.Rotations[path.Rotations.Count - 1]);
    30.                 }
    31.                 else
    32.                 {
    33.                     path.Points.Add(Vector3.zero);
    34.                     path.Rotations.Add(Quaternion.identity);
    35.                 }
    36.             }
    37.             else if (minusClicked)
    38.                 if (path.Points.Count != 0)
    39.                 {
    40.                     path.Points.RemoveAt(path.Points.Count - 1);
    41.                     path.Rotations.RemoveAt(path.Rotations.Count - 1);
    42.                 }
    43.         }
    44.         if (CreatePath)
    45.         {
    46.             if (path != null)
    47.                 CreatePathForPoints(path.Points.ToArray(), path.GeometryWidth);
    48.         }
    49.         DrawDefaultInspector();
    50.     }
    Code (CSharp):
    1.  void OnSceneGUI()
    2.     {
    3.         if (path == null)
    4.             path = target as AramPath;
    5.         if (path != null)
    6.         {
    7.             if (path.Points == null)
    8.             {
    9.                 path.Points = new List<Vector3>();
    10.                 path.Rotations = new List<Quaternion>();
    11.             }
    12.             if (debug)
    13.             {
    14.                 if (Tools.current == Tool.Move)
    15.                     for (int i = 0; i < path.Points.Count; i++)
    16.                     {
    17.                         path.Points[i] = Handles.PositionHandle(path.Points[i], Quaternion.identity);
    18.                         //Handles.Label(path.Points[i], path.Points[i] + "");
    19.                     }
    20.  
    21.                 for (int i = 0; i < path.Points.Count - 1; i++)
    22.                     Debug.DrawLine(path.Points[i], path.Points[i + 1], Color.green);
    23.             }
    24.         }
    25.  
    26.         if (GUI.changed)
    27.         {
    28.             EditorUtility.SetDirty(target);
    29.             SceneView.RepaintAll();
    30.         }
    31.     }
     
  15. Paul-Dahuach

    Paul-Dahuach

    Joined:
    Dec 8, 2014
    Posts:
    1
    I'd started to get these when I changed Line Spacing to zero in a Text component (4.6+ GUI System), changed back to 1 and the spam goes away.
     
  16. Neogene

    Neogene

    Joined:
    Dec 29, 2010
    Posts:
    95
    In our case the culprit was the "rich text" checkbox of Text component (Unity >=5) using dynamic font, disabling it stopped these errors to appear.
     
  17. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    In our case it was caused by a rect UV of (0,0,1,-1) on a RawImage, changing it to (0,0,1,1) (and flipping the texture externally) stopped the errors (thousands of them per frame).
     
  18. efge

    efge

    Joined:
    Dec 13, 2007
    Posts:
    62
    Version 5.3.1p3 (= Patch Release 3) solved my issues.
     
  19. Westland

    Westland

    Joined:
    Jan 26, 2015
    Posts:
    27
    I'm in a project which has no text whatsoever, and get the errors isFinite(d), isFinite(outDistanceAlongView), isFinite(outDistanceForSort). They pop up when an instantiated rocket-prefab collides with a terrain object tagged "Ground", resulting in an instantiation of an explosion-particlesystem-prefab, and then Destroy() on the rocket.

    Stuffing a small Destroy() script on the particlesystem stops the errors occurring as soon as the system's removed. Just wanted to add that to the list here, since nobody seems to've bumped into it with a particlesystem
     
    TooManySugar likes this.
  20. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    I am having this with a particles system as well.. What does your "destroy" script do? any what exactly is causing the issue?
     
  21. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    5.3.1f1 has a bug that caused this. Make sure you are using the latest patch before you try any other workarounds.
     
  22. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    where do we get the patch?
     
  23. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
  24. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
  25. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    haha, we posted at the same time :)
     
    karl_jones likes this.
  26. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    also, why do we always need to re-choose the components during install.. can't it auto select the ones currently installed?
     
  27. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Sounds like a good idea. Add it to the feedback.
     
  28. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    I just updated to 5.3.1p4 this morning, unfortunately, I still have the
    Code (csharp):
    1. IsFinite(outDistanceForSort)
    error printing like crazy when I move my camera around in my 3D world. I have no clue what causes this, since there is no callstack.

    Althought, it always seems to happen when my camera goes throught the ground.
     
  29. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Are you using Particles? This error is not specific to particles so could be something else.
     
  30. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    I just upgraded to v5.3.1f1 and get lots of errors, including the one in this thread and the below

    Invalid AABB result

    aabb.IsfFinite()

    The errors ar related to particles (appear when particles get in the scene for example) and reflection script for Water 4.

    Does the patch fix them all ? Also as an asset developer should i release the new asset version with these errors (considering they are internal Unity errors and there is nothing that can be done about them, plus would be fixes in Unity updates) ?

    Also is the last patch enough (does it include all previous ones up to the official release ?)

    And have the standard assets been revised from v5.3.1f1 ? Or i can keep the same to save time ?

    Thanks
     
    Last edited: Jan 25, 2016
  31. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    I thought it was related to something else as well, but we do use SUIMONO plugins which use particles in our scene.

    I tried to remove it from the scene and the error went away. Not sure which of their particle system is causing the issue though, there use a couple. I could always disable them one by one, but I don't think it will help me knowing how to fix the culprit once I find it.
     
  32. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Its not really fixable on your end. Can you submit an example bug and post the number here?
     
  33. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    I have a very easy to recreate error that i think is also related.

    The procedure is:

    - Add Water 4 Advanced prefab in the scene (from Unity standard assets)
    - Go to Scene view
    - Press the 2D mode
    - Select the reflection camera

    The log then produces"Screen position out of view frustrum" errors that are generally fixable when checking for eulerangles != Vector3.Zero in ReflectCamera.Render() in PlanarReflection.cs

    This is the same place (script/code) where i get the error mentioned in this thread, when i enable a particle system when reflections are active (note that exluding particles with layers from reflect camera did not help).

    Another thing i noticed is that i get a variable number of errors, for example when i activate snow particle i get 3 errors every time and when the rain particle i get 80-120 errors before it goes away, both particles are dynamically increasing their max particle counts, so this could be one cause.

    I hope this helps

    This error was not produced in Unity v5.3.0.
     
    Last edited: Jan 25, 2016
  34. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Could you put that into a bug report please? I'll end up forgetting about it otherwise
     
  35. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    I can for the "Screen position out of view frustrum" error, i will start a new project and is easy to reproduce and send over.

    The !IsFinite(outDistanceForSort) is harder as it is happening in my sky Master asset that is larger and harder to send over, i will try this too though
     
    karl_jones likes this.
  36. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    Hi Karl,

    I have sent the error report that states the reproducible error and a test scene that readilly produces it. Also mention the error i get in the same code region in the latest Unity version that is not reproducible in the included test scene (it happens every time i activate the included snow particles in my main project in latest Unity version,gives anything from 3 errors in snow to 120+ in rain particles), but i write some ideas why it may happen (main difference is that in my main project i gradually increase the max particle count)

    I hope this helps, here is the bug report i attached to the bug form and the error log i get when using particles and the reflection script/camera from standard assets (without any modification).

    The report has my artengames@gmail.com email account attached (for reference) and is (Case 764887).

    REPORT:

    1. I get "Screen position out of view frustum" errors in general, when using the Water4 reflection script and camera. To reproduce every time i set the main camera to orthographic. It also happens in perspective but with much less frequency (rare but almost always happen once when playing long).

    I fixed it a bit by checking the euler angles of the reflection camera for !Vector3.zero before the .Render() is called in the reflections script, but still happens sometimes. Also the new v5.3.1p4 of Unity gives me a "!IsFinite(outDistanceForSort)" error pointing in the same code region ("planarReflection.cs, line 200 - reflectCamera.Render(); ), this also happens every time i enable my particles in my project (in this case i increase the max particle count gradually, not show in this bug report scene, the particle is the snow one i have in this scene)

    2. Load the scene "ERRORS REPRODUCE SCENE" and hit play. Alternate between game and scene view to see all errors. Also i would try increasing the max particle count gradually in code to try and see the "!IsFinite(outDistanceForSort)" error.

    The "!IsFinite(outDistanceForSort)" did not happen in previous Unity versions (e.g. 5.3.0x), it happens in the latest ones (e.g. 5.3.1p4)

    ERROR LOG:
    Screen position out of view frustum (screen pos 0.000000, 0.000000, 1000.000000) (Camera rect 0 0 571 268)
    UnityEngine.Camera:Render()
    UnityStandardAssets.Water.PlanarReflection:RenderReflectionFor(Camera, Camera) (at Assets/Standard Assets/Environment/Water/Water/Scripts/PlanarReflection.cs:200)
    UnityStandardAssets.Water.PlanarReflection:RenderHelpCameras(Camera) (at Assets/Standard Assets/Environment/Water/Water/Scripts/PlanarReflection.cs:97)
    UnityStandardAssets.Water.PlanarReflection:WaterTileBeingRendered(Transform, Camera) (at Assets/Standard Assets/Environment/Water/Water/Scripts/PlanarReflection.cs:114)
    UnityStandardAssets.Water.WaterTile:OnWillRenderObject() (at Assets/Standard Assets/Environment/Water/Water/Scripts/WaterTile.cs:59)
     
    Last edited: Jan 26, 2016
    karl_jones likes this.
  37. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    Another note on the below error, the 1000 in the z is the camera view distance, for example in my main project the error reported 10000 in this as this was my camera view distance, so i think this can be another clue as to what happens (a possible check against the camera render distance that does not check out, maybe particles appear in some infinite spot before come in the scene ? ). This would also explain why some of the errors happen when i gradually increase the max particle count and new particles come into play (then the "!IsFinite" error stops when the max count is static again or a bit after and stays ok until the next particle comes in)

    Screen position out of view frustum (screen pos 0.000000, 0.000000, 1000.000000)
     
    Last edited: Jan 26, 2016
  38. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360


    Here is some more insight on this, the error seems to happen more on the editor, always pointing in the same Camera.Render() code.

    In play mode will happen for a very short time ( 0.5 in snow - 3 sec in rain) and stop

    It goes away if i choose specific layers to be reflected on the Reflections script (Water4 reflection script from Standard Assets), so particles are exluded.
     
  39. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    Hi Karl,

    I had an asnwer from the bug report, the case was moved to this one

    https://issuetracker.unity3d.com/issues/screen-position-out-of-view-frustum-error-printed-non-stop

    I voted for the case to be considered more for fixing. Also added a comment about the similar in nature error of this thread (both errors point to the same Camera.Render() code line in my Water4 reflections script)

    EDIT: Also found an older case which is marked as solved, maybe could be reopened as well.

    https://issuetracker.unity3d.com/issues/screen-position-out-of-view-frustum-errors
     
    Last edited: Jan 27, 2016
  40. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    I have tested the new v5.3.2 with Sky Master ULTIMATE and Water 4 reflection and i still get the "!IsFinite(outDistanceForSort)" issue when particles come in the scene.

    This error did not happen in Unity v5.3.0 so i hope will be solved soon.
     
    Karsten likes this.
  41. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    187
    water.cs from the Standard Assets is also causing that error , it denses down to reflection/refraction if setting the water mode in water.cs to "Simple" no errors are thrown, its very easy to recreate and i wonder why this isnt fixed yet
     
  42. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    I get more errors there like "out of frustum", the offending code is the camera.render() that renders the reflection camera to the rendertexture, it is in reflections script of water 4 too.

    I avoid most errors with a "camera.transform.eulerangles != Vector3.zero" check around the render line.

    This is probably due to the camera coordinates giving some infinite result in the render.

    The "!IsFinite" error is happening in the same code, and i think this one is related to some issue with the new particle system, perhaps particles go out of bounds when they just appear in the scene and that is why it did not happen before the particle system changes (e.g. in 5.3.0)

    I work around this by exluding particles from the reflection layers.

    This "out of frustum" is a rather old issue (i think since Unity 5 was introduced and maybe older), hopefully will be taken care of at some point.
     
  43. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    187
    hmm, did you ever try to use Quaternion instead of Euler for the Rotation things, would be an interesting test, i cant do it atm because i am on a travel , mybe you want to try ?

    Edit. i did some test using only Quaternions instead of Euler angles for rotational things , it didnt help anything, i was hopeing it has to do with the inversion of x maybe not always done proper with euler...:rolleyes:
    my next "track" is towards the camera setup, the script "abuses" the current camera somehow, maybe an extra camera wich is like a clone of the current camera would lead towards a solution?
     
    Last edited: Jan 29, 2016
  44. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    I solve the 2D view in editor issue completly with the below check in PlanarReflection script, in line 200

    if (reflectCamera.transform.aulerAngles != Vector3.zero){
    reflectCamera.Render();
    }

    It still happens in 3D rarely though and the particles still have their own issue by hiting the render() internally by going out of bounds probably before they appear in the scene. I may do a test by checking particle positions and stop the render() if they are not inside the scene bounds for example to verify the issue.
     
  45. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
  46. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,360
    I am not 100% sure yet, but when i exported y Sky Master pack and then inserted it in a new project the error did not happen, even without the patch in 5.3.2f1.

    The out of frustum still happens rarely (after i do the camera.eulerangles != Vector3.Zero)

    The error happens every time particles come into play for 1-3 secs in my original installation where i exported the file from.
     
  47. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    I am asking for the specific 5.3.2.p1 version, which should have the fix according to the issue tracker and it is still happening.

    Does any other have seen the issue on that version?.

    P.-S. Before we were using SUIMONO water system, now PlayWay Water, error still occurs.

    In both case, it was always occuring when we are rotating the camera around the center of the screen, while water is active in the scene. Seems like a certain value of rotation triggers the error spamming.
     
  48. hexagonius

    hexagonius

    Joined:
    Mar 26, 2013
    Posts:
    98
    Yes, just updated to it and got the error in our first scene
     
    ForceMagic likes this.
  49. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    187
    Did anyone tried if it still happens in 5.3.2p2 ?
     
  50. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    I still have the issue on 5.3.2p2, with Unistorm plugins, (always seems to happens with Particles base plugins). I can't find time to produce a test-bed yet, but as soon as I can if the problem still persist I'll submit one.