Search Unity

Camera Issues

Discussion in 'General Graphics' started by MrGluer, Jan 7, 2015.

  1. MrGluer

    MrGluer

    Joined:
    Jan 7, 2015
    Posts:
    1
  2. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Make the Camera Near Plane smaller.
     
  3. maxwelldoggums

    maxwelldoggums

    Joined:
    Sep 8, 2008
    Posts:
    157
    MakeCodeNow is right.

    Cameras in most 3D rendering applications actually have a minimum possible distance, as well as a maximum. This is because the screen is really 2d. When you want to render your scene, you have to somehow flatten it onto a single plane so it can be properly displayed. In order to do this, a transformation is applied, which will map each point in the scene to a point on the "image plane", which can then be displayed.


    Here, you can see the regions of the camera. Your scene would be in the blue portion of the frustum, and would be squished down into the image plane, who's borders are labeled L, and H. The problem is, this plane has to be at least some distance away from the camera's location, because otherwise, all of the geometry in the scene would be mapped to just a single point on the image plane, and you wouldn't see anything!

    The artifacts you're seeing are due to the scene geometry crossing from the blue region into the white region. They're closer than the image plane, and so they aren't being transformed into the camera's view! As a result, you get that weird clipping where only parts of the object are visible!

    In order to remedy this, you can pull the "near clip plane" closer to the camera by adjusting the value in the inspector, but keep in mind, it is impossible to have a near clip plane of zero, and if it gets too close, you may have some other artifacts due to inaccuracies in the math! The usual fix is to somehow prevent the camera from ever getting that close to walls, either by giving it collision, changing the angle, or something else like that, so that you don't have to worry about the clip plane as much :)


    Hope that helps!
    -Andrew

    PS: I'm not sure it's possible to change the near clip plane of the Editor camera, but it usually does a pretty good job at preventing clipping. What is the scale of your world? Sometimes if things are too small, you have to zoom in really close to them to see them properly, and then the near clip plane is very far away by comparison! Try scaling things up a little bigger, and seeing if that helps.
     
    theANMATOR2b and peteorstrike like this.
  4. _MGB_

    _MGB_

    Joined:
    Apr 24, 2010
    Posts:
    74
    Sounds like OP means the Editor Camera.
    The near/far planes on the editor camera are set when you focus on an object in the scene (the 'F' key), but if e.g. you focus on a large terrain/object the near plane can get set to a value that isn't good for close-up editing.
    To work around this focus on a smaller object in the scene, then move the camera manually to where you are working on the larger scale object.