Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[SOLVED] Screen position out of view frustum

Discussion in 'Scripting' started by grimmy, Sep 20, 2010.

Thread Status:
Not open for further replies.
  1. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Code (csharp):
    1. Screen position out of view frustum (screen pos 506.000000, 331.000000) (Camera rect 0 0 600 450)
    The error appears every frame while my mouse cursor is within the game window.

    Anyone know what this means or how to fix it...?
    cheers
     
    rf007 likes this.
  2. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Solution:
    One of my cameras near clip planes was set to 0.
     
  3. NickJVaccaro

    NickJVaccaro

    Joined:
    Apr 29, 2013
    Posts:
    7
    I'm having this problem 5 years later, so I wanted to leave my issue/solution here as well:

    My clip plane was fine, but my main camera's size was set to 0.
     
  4. lalit677

    lalit677

    Joined:
    May 6, 2015
    Posts:
    1
    Me too having the same problem, but my camera's near clip plane is 0.3 and far clip plane is 1000 and I am using perspective camera projection so there is no camera size, Now anyone knows how to fix it?
    Thanks in advance......
     
  5. Aranda

    Aranda

    Joined:
    Jan 23, 2015
    Posts:
    16
    I just had this problem in a project with Oculus support. Somehow, the Field-of-view had been set to zero for the camera on OVRCameraRig->TrackingSpace->RightEyeAnchor. Setting it to 60 to match the other eye resolve the issue.
     
  6. clearrose

    clearrose

    Joined:
    Oct 24, 2012
    Posts:
    349
    Having the same problem, but I can't find anything wrong with my camera settings:

     
    GregoryFenn likes this.
  7. Tekksin

    Tekksin

    Joined:
    Oct 20, 2013
    Posts:
    32
    If you set the projection parameter to perspective, this error goes away at startup.
    Cameras set in orthographic seem to show this error for me, at startup. It's a benign warning and doesn't cause errors outside of the editor, nor outside of the start of the editor. It's just a bug unity has to fix.
     
    AlexwellZ likes this.
  8. Sir-Spunky

    Sir-Spunky

    Joined:
    Apr 7, 2013
    Posts:
    132
    I had about 10 such error messages (duplicates) appear each time I opened a Unity 2d project (not when running the game).

    Changing camera projection to "Perspective" and then back to "Orthographic", saving and restarting Unity fixed it for me. Thanks for the tip @Tekksin
     
    GregoryFenn likes this.
  9. AlexwellZ

    AlexwellZ

    Joined:
    Aug 23, 2015
    Posts:
    2
    did the same thing - didnt work... at least, those 8 error messages don't affect anything (seems)
     
  10. Mareck

    Mareck

    Joined:
    Aug 13, 2014
    Posts:
    77
    I have the same problem. Switching to perspective and back doesn't work. Also closing the scene tab and reopening doesn't work (a possible solution from another thread about the same problem).

    Clipplanes are at 0.3 for near and 1000 for far.
     
  11. pavlito

    pavlito

    Joined:
    Nov 27, 2007
    Posts:
    136
    This happens to me on scenes that have the Main Camera object automatically created.
    New scene with default items. Save, close, re-open unity. Errors.
    Delete auto-created camera object, create one manually, save. Close, re-open unity. Good.
     
  12. Notter

    Notter

    Joined:
    Mar 8, 2015
    Posts:
    65
    I've followed pavlito suggestion, and it fixed the annoying errors
     
  13. Taius

    Taius

    Joined:
    Dec 16, 2013
    Posts:
    4
    I also followed pavlito's suggestion and it worked great for me.

    Thanks ;)
     
  14. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,384
    Thank you Pavlito. That worked fine.
     
  15. RivenWork

    RivenWork

    Joined:
    Nov 11, 2015
    Posts:
    10
    It also works with MainCamera's Tag set Untagged
     
    jelenaUprise and atomicjoe like this.
  16. Jinja

    Jinja

    Joined:
    Nov 28, 2012
    Posts:
    10
    Thanks Pavlito, that fixed it for me.
     
  17. mjtaqizade

    mjtaqizade

    Joined:
    May 25, 2015
    Posts:
    1
    Same problem here. just close the scene tab and open it again, solved like a charm
     
  18. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    158
    Same Problems, with MainCamera's Tag set Untagged helped
     
    jelenaUprise, iampolya8 and atomicjoe like this.
  19. Arcana96

    Arcana96

    Joined:
    Jun 28, 2015
    Posts:
    28
    I fix it by setting my cameras near clipping planes to 1 instead of the 0. something value it normally is. Restart and it usually fixes the problem.
     
    Tzanislav and shekalo like this.
  20. BlackPanda

    BlackPanda

    Joined:
    Jan 24, 2014
    Posts:
    78
    @litebox's method is the only one that worked for me. I untagged the camera and the error is not showing up anymore. But I think this is not an optimal solution. The main camera tag is needed for my code.
    Happy New Year btw :)
     
    atomicjoe, litebox and saurabh.saket like this.
  21. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    772
    I get this intermittently in the editor, sometimes in scene view when using a horizontal axis, and sometimes in game view if I move my camera some way it doesn't like. The thing is these are all normal activities in Unity, and the error doesn't stop you from doing them, or indicate a problem that needs to be corrected. In my view it's completely useless. It doesn't give me any information I need, or can possibly use. It just adds extra clutter to the console, and should be removed from Unity's code so it stops annoying people. :mad:
     
  22. bpolaro

    bpolaro

    Joined:
    Mar 24, 2014
    Posts:
    17
    works! thanks!
     
  23. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    187
    i get this very similiar error in sceneview when using the 2D view mode , it happens ONLY in 2D view mode if i switch back to 3d view(perspective view)the error spamming is gone.

    This is the complete error message.look that mad Z values.
    If that water.cs script is set to not execute in editor the errors go away too , but thats a poor and cumbersome solution
    my tip is that this water.cs has mad bugs (im already reading the code and try to understand it, a tiedeous and hard work), how come such a mad value in Z and that only in 2D view?

    Screen position out of view frustum (screen pos 256.000000, 0.000000, 1270682.750000) (Camera rect 0 0 256 256)
    UnityEngine.Camera:Render()
    UnityStandardAssets.Water.Water:OnWillRenderObject() (at Assets/Standard Assets/Environment/Water/Water/Scripts/Water.cs:129)
    UnityEditor.DockArea:OnGUI()
     
    Last edited: Mar 3, 2016
    mrae likes this.
  24. MihailS

    MihailS

    Joined:
    Dec 30, 2012
    Posts:
    5
    Did what #pavlito# and #RivenWork# suggested.Both solutions worked but I think #pavlito's solution is the best since you need the camera to be tagged at some point.Thanks.
     
  25. liaowuxing

    liaowuxing

    Joined:
    May 25, 2016
    Posts:
    1
    upload_2016-5-25_8-58-3.png




    I don't check this to solve the problem.
     
  26. Joxerbrown

    Joxerbrown

    Joined:
    Mar 30, 2014
    Posts:
    1
    Hi all, I had the same error messages on my own Character Controller Script, my error was occurring when when I held the sprint button and then released it, the error was caused by the fact that I had FOV Kick checked and the actual FOV Kick Script was not set up properly, so the Field Of View setting in the inspector on the camera was being set to 0 when I released the sprint button.

    I hope that this can help someone else who is having a similar problem.
     
    AthosK likes this.
  27. Exverxes

    Exverxes

    Joined:
    Dec 10, 2014
    Posts:
    1
    Just for future reference: There is a floating point error issue. When you are setting close clip plane to small value like 0.1 or 0.2 and use large numbers for position (over 100k, not sure exactly) like in Karstens post , Unity in its calculations may round this number to 0 and you will get that error. In general, don't use such big numbers for positions. Moving clipping plane to 1 will help for a while (till 1M or so), but there may be other problems.
     
  28. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    297
    ...and how exactly, all of that, in every detail, please ?
     
  29. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I was having this annoying issue when rendering with multiple cameras at the same time.
    The problem was I was copying all the main camera properties using CAMERA.COPYFROM()
    Using this method the MAIN CAMERA tag gets copied to the other cameras and it raised this error intermitently.
    The solution was to set the tags of all the other cameras to Camera.tag="Untagged" just after doing CopyFrom.
    Thanks to RivenWork and LiteBox, this was driving me insane! :)
     
  30. Alexander-Seeck

    Alexander-Seeck

    Joined:
    Apr 29, 2015
    Posts:
    7
    I've been using two orthographic cameras in place of the usual single camera altering the Viewport Rect for the split. It seems that values too small are a problem for the camera. The thresholds I found out are Y = 0.998 and H = .0009. Every smaller fraction caused that, but using 0 is not a problem.
     
  31. Nazowa

    Nazowa

    Joined:
    Oct 30, 2017
    Posts:
    15
    I get this error when I switch to 2D mode to work on my UI and I get it non-stop by the thousands. Project runs fine but any serious error is lost among the thousands of useless red error messages. How many decades need to pass for a fix ?
     
  32. Light_

    Light_

    Joined:
    Jun 27, 2016
    Posts:
    10
    I only get this error on a scene that uses the standard asset WaterProDayTime. If I take that asset out of the scene i stop getting the error. Just thought I'd chime in with that.
     
  33. Nazowa

    Nazowa

    Joined:
    Oct 30, 2017
    Posts:
    15
    Why is this thread marked [SOLVED] ?
     
    d1favero, Efril, Reahreic and 7 others like this.
  34. blenderbug

    blenderbug

    Joined:
    Nov 16, 2014
    Posts:
    3
    "Screen position out of view frustum" error only shows up when at least 2 of the 3 rotation vectors are 0 on the mainCamera. Here's the fix inside of Water.OnWillRenderObject()
    Code (CSharp):
    1.             Camera reflectionCamera, refractionCamera;
    2.             CreateWaterObjects(cam, out reflectionCamera, out refractionCamera);
    3.  
    4.             // find out the reflection plane: position and normal in world space
    5.             Vector3 pos = transform.position;
    6.             Vector3 normal = transform.up;
    7.      
    8.             //avoid frustum error ugh
    9.             bool FrustumError = false;
    10.             int zeroVectors = 0;
    11.             if (cam.transform.rotation.x == 0)
    12.                 zeroVectors++;
    13.             if (cam.transform.rotation.y == 0)
    14.                 zeroVectors++;
    15.             if (cam.transform.rotation.z == 0)
    16.                 zeroVectors++;
    17.             if(zeroVectors >1){
    18.                 FrustumError = true;
    19.             }
    20.  
    21.             // Optionally disable pixel lights for reflection/refraction
    22.             int oldPixelLightCount = QualitySettings.pixelLightCount;
    23.             if (disablePixelLights)
    24.             {
    25.                 QualitySettings.pixelLightCount = 0;
    26.             }
    27.  
    28.             UpdateCameraModes(cam, reflectionCamera);
    29.             UpdateCameraModes(cam, refractionCamera);
    30.  
    31.             // Render reflection if needed
    32.             if (mode >= WaterMode.Reflective && !FrustumError)
    33.             {
    34.                 //end of avoid frustum error ugh
    35.  
    36.                 // Reflect camera around reflection plane
    37.                 float d = -Vector3.Dot(normal, pos) - clipPlaneOffset;
    38.                 Vector4 reflectionPlane = new Vector4(normal.x, normal.y, normal.z, d);
    39.  
     
  35. brownbird77

    brownbird77

    Joined:
    Nov 7, 2017
    Posts:
    2
    For anyone who's still having trouble with this:

    I got this error coming up AFTER I came OUT of the game (i.e. when I started editing again, no errors in-game). Turned out to be something to do with having the scene view in 2D mode. When I returned it to 3D mode, the errors stopped. Not sure why out-of-game activity should affect the errors flagging from the camera, but there you go!
     
    dongrout likes this.
  36. Lostlogic

    Lostlogic

    Joined:
    Sep 6, 2009
    Posts:
    693
    I get it all the time when out of a game.
     
  37. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    815
    Here's what solved it for us:
    The error was: Screen position out of view frustum (screen pos 340282346638528859811704183484516925440.000000, 340282346638528859811704183484516925440.000000) (Camera rect 0 0 1920 1080)UnityEngine.Camera:ScreenPointToRay(Vector3)

    This suggests that somehow Input.mousePosition returned aberrant values.
    From my logs, I see that this happened on iOS, after pausing the app and returning (app switch, notifications bar etc.).
    We were calling Camera.main.ScreenPointToRay in FixedUpdate. Maybe after resuming the game, the first FixedUpdate call is made before Unity re-initializes mouse's position (unity bug).

    Our fix was to make sure the raycast is only done if the mouse position is within the screen bounds:
    Code (CSharp):
    1.         void FixedUpdate()
    2.         {
    3.             var mousePos = Input.mousePosition;
    4.             if (mousePos.x < 0 || mousePos.x >= Screen.width || mousePos.y < 0 || mousePos.y >= Screen.height)
    5.                 return;
    6.  
    7.             var ray = Camera.main.ScreenPointToRay(mousePos);
    8.             RaycastHit hit;
    9. ...
    10. }
     
  38. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,243
    I have just now seen this in a standalone build - it is crazy it is not handled by Unity - should be fixed as a bug - fix minor in-precision to make a good result.

    You can not throw an error in a function like this due to floating point precision, that is just not robust!

    For me it says in error - screen position at 1024.00000 (i.e. >= camera rect of 1024)
     
    wisniowy88 and trad_emark like this.
  39. unity_infGD3bPPEhAQw

    unity_infGD3bPPEhAQw

    Joined:
    Apr 3, 2018
    Posts:
    1
    thank you Sir-Spunky this issued got solved as soon as I change my camera projection to "Perspective" :)
     
  40. eistx

    eistx

    Joined:
    May 10, 2018
    Posts:
    2
    thanks to pavlito
    the problem got solved;)
     
  41. nirendao1980

    nirendao1980

    Joined:
    Nov 9, 2015
    Posts:
    13
    same problem in editor, and change to tab scene,and 2d and 3d have it
     
  42. nirendao1980

    nirendao1980

    Joined:
    Nov 9, 2015
    Posts:
    13
    Pavlito's method not fine.
     
  43. nirendao1980

    nirendao1980

    Joined:
    Nov 9, 2015
    Posts:
    13
    happened on
    ide 2018.1.4f1
    os mac 10.12.6
    and
    win7 64 2017.3.0f3 have not this problem.
     
  44. JonneSir

    JonneSir

    Joined:
    Jun 27, 2018
    Posts:
    4
    I was having this problem too my scene view was flashing and i got spammed with errors. So I closed the scene tab and re-opened it. Fixed the problem!
     
    igrir likes this.
  45. Lynxed

    Lynxed

    Joined:
    Dec 9, 2012
    Posts:
    121
    I have this problem during runtime randomly appearing when i rotate my camera gameobject in game. Game view is flashing. Did not have that prior to 2018.7f1. Is there a opened issue in bug tracker i can vote for?

    Update Edit: Okay, this problem can manifest itself if your camera gameobject is way too far from origin.
     
    Last edited: Jul 14, 2018
  46. shermenz

    shermenz

    Joined:
    Jan 19, 2015
    Posts:
    3
    I just got this error when ever I switch to 2d mode in my 3d gameת, and it happens when I use the water in the Standard assets.
    The simple workaround is to rotate the water object in more than 2 axis (for example: x=0.01, y = 0.01, z=0)
    Not sure what the actual problem is, I'm pretty much a beginner.
     
  47. Snuffle3

    Snuffle3

    Joined:
    Jan 13, 2018
    Posts:
    1
    Yes, I think the error appears when the camera (scene view or other) looks on the water plane directly (Camera Rotation 0, y, 0; Plane Rotation 0, y, 0) and you switch to orthogonal/perspective view. Just make sure the camera can not look on the water plane directly (like shermenz said, rotating the water is one option). But why this is like it is, I don't know.
     
  48. salarnazar

    salarnazar

    Joined:
    Oct 4, 2018
    Posts:
    1
    Window >> Layouts >> Revert Factory Settings ==>> Ta Ta !!
     
  49. Deleted User

    Deleted User

    Guest

    Not working!!
     
  50. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    Not sure if this will help anyone but it occurs for me when I am in the 2D view as an orthographic camera and the standard assets water. Seems to be no error when the water is visible in 3d. Maybe just an issue with the water being perpendicular to the camera and the script getting confused..
     
    pitchblende and jacksmithopinion like this.
Thread Status:
Not open for further replies.