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. Dismiss Notice

What's better a large face or two small for culling?

Discussion in 'General Graphics' started by Shayan, Sep 14, 2016.

  1. Shayan

    Shayan

    Joined:
    Jul 8, 2013
    Posts:
    53
    At first, Imma noobie in 3D graphics...
    I create the 2D terrain tools (polygon sprite) for the inner using in game. And when my algorithm generates terrain's mesh it has large faces sometimes (face has size that larger then camera size). Of course, these faces will be never culling by a camera.
    And I don't know what is better for performance: divide these face in smaller faces or large as it has now?
    Please, explain me a bit of details by this theme.
    P. S. I know that OpenGL docs contain this information (I think) but my English level isn't enough to understand it. I even couldn't find it.
     
  2. Lost-in-the-Garden

    Lost-in-the-Garden

    Joined:
    Nov 18, 2015
    Posts:
    176
    One of the simplest culling mechanisms is view frustum culling. It checks weather an object is inside the camera's viewing frustum to see what needs to be rendered and what not. One simple and fairly standard implementation of that uses a bounding volume for each object. If you have a mesh with many vertices, you want to have a quick test and not test of any of the vertices are visible.

    The simplest bounding volume is a sphere that approximates the object. The culling test is very quick, but it is only a good approximation for objects that are roughly sphere shaped or at least square cubes. A bit more elaborate is the use of an axis alligend bounding box (AABB for short, see Unity Bounds), that approximates an object by a bounding box.

    Important for culling is the level on which culling operates. For real time and games it is usually the mesh level. A mesh is either rendered or not. That means the size of the individual triangles inside the mesh does not matter. If you want your terrain to be culled you could look into splitting your terrain mesh into several smaller meshes. This is a tradeoff between total number of vertices rendered vs. number of individual meshes submitted to the GPU (aka. number of draw calls)

    For performance, there is also no one standard rule, it always depends on your game and target platform among other things. If the terrain has 10k vertices that's something different than if it has 100,000k vertices.
     
    theANMATOR2b and Shayan like this.
  3. Shayan

    Shayan

    Joined:
    Jul 8, 2013
    Posts:
    53
    Thank you for the detail answer! You're very helped me!