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

Custom Mesh and how does Culling work in Unity

Discussion in 'Editor & General Support' started by violinbg, Apr 12, 2014.

  1. violinbg

    violinbg

    Joined:
    Mar 24, 2014
    Posts:
    79
    I'm learning Unity right now and I'm trying to port a terrain class I've written a while ago in C++ and Irrlicht.

    I get the basics but I have some question on how(if) Unity does any sort of Culling.

    So I tried the Occlusion Culling but it seems I need to bake data in the editor and I don't know how and if I can use this in runtime.
    Irrlicht has occlusion culling and once you create a mesh the engine will calculate whatever it needs for it on-the-fly (usually takes 1 sec or so).

    So one question would be: Do I have to worry about that? Will unity optimize the mesh at runtime and will it take care of this for me.

    Is Unity doing viewing frustum culling or do I need to do that by myself.

    What I did for Irrlicht is to split my mesh in smaller meshes. Since they are arranged like a grid it isn't hard to arrange them in tree that has a boundary box for each node. It take a few checks to see what node of the tree should be visible and what not. This allows me to do giant terrains and keep the same FPS - only limit is memory.

    Here comes my second question: If I arrange objects inside an empty game object and mark that as Invisible, will Unity traverse the child during rendering or not. If it does how do I prevent Unity from doing so.

    Sorry if those are generic questions - I hope someone more experienced with Unity may give me some tips.

    Here's what my terrain looks in Irrlicht (it's pretty basic) :
    $ter1.jpg
    $ter2.jpg
    $ter3.jpg
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    Yes. If you want runtime occlusion culling you'd have to write your own system for that. I didn't quite understand your second question...are you referring to having the renderer disabled? Any objects with disabled renderers don't need to be culled; being a child or not isn't relevant.

    --Eric