Occlusion Culling still rendering hidden gameobjects.

Hello, I’m trying to learn C# coding and Unity so I’m having fun and recreating some of the mechanics from Minecraft.


1


I’m trying to get some Occlusion Culling working properly so I can boost performance and FPS.
However, even tho I am only viewing a small portion of game objects (blocks) it still renders A LOT of blocks that aren’t even visible. I would prefer it to simply hide any blocks that are not visible at all and only render ones the player can see (if a block is hidden behind 1 block that is visible, I would like that hidden block to not render.)


I’ve tried messing around with the OC Bake parameters but nothing seems to change and I don’t fully understand what they do. I’m a big newb and still learning so any help would be appreciated. Thanks!


EDIT:
I should have probably mentioned I already set all my blocks in the static drop-down to “Occluder” and “Occludee”. And these blocks are generated at runtime not in pre-scene, therefore I baked 1 block beforehand to get occlusion culling working in the first place. Also my blocks are made of 6 quads, not primitive cubes or a custom script-made mesh.

You don’t really provide any information so I’m going to take a stab in the dark.
_

  1. Unity needs to know if an object is an “Occludee Static” or an “Occluder Static”. For example, any blocks that could potentially occlude another block should be marked as an “Occluder” and, subsequently, any blocks that could potentially be occluded by another block need to be marked as “Occludee”.
    _
    Marking all of your blocks as both “Occluder” and “Occludee” should solve your issue.
    _
  2. For performance reasons I would suggest looking into GPU instancing. For example, the material used for each block should be marked as “GPU Instance” (this means the blocks can not be marked as “Batching Static”).
    _
    Unity - Manual: GPU instancing
    _
  3. Unity - Manual: Occlusion culling is the best place to understand what is happening. For example
    _
    Smallest Occluder - The size of the smallest object that will be used to hide other objects when doing occlusion culling.
    _
    So if you’re smallest block is 1 meter x 1 meter, your smallest occluder needs to be set appropriately.
    _
    I don’t know if this will suit your problem 100% depending on what you are trying to do (are you generating and destroying blocks at runtime?).