Game Engine Occlusion Example

Its a bit easier to visualise that if you think from the side of a programmer. Take a very basic example you wrote a program to draw 2 squares, when you do drawsquare() for first square, computer will take up the x & y coordinates of its four vertices, and change the color of all the pixels in their bounding region without caring what there previous color was. If your draw region of second square intersects the region of first one, the color of pixels would still be changed to color of second square, so you get the ā€˜overlappingā€™ squares, the one drawn at last will always be at the top. I suppose similar thing happens in 3d as well, the object which are farthest away (max. Z-depth) are drawn first while the ones which are closer are drawn at last so that they remain on top.

Now suppose you give x,y cords. Of your square to be something high (say 50k,50k) computer will still draw them, although you cant see them on screen. To prevent that from happening you would put a condition on comp.: If x,y lie between 0 and maximum screen hieght & width then Draw() otherwise it wont. Thats viewfrustum culling (a really simple pre-historic one)

For occulusion culling its like if bigger square is drawn at last covering whole of small square then dont draw small square.

I was thinking of occlusion culling on per face level but when I read about how its done (scissor test, stencil test,ā€¦) I scrapped the idea right away coz it would be useless.

P.S If anyone finds any mistake with info or find my examples irrelevant, please correct me coz im not a GE dev.

  1. Is it better to set up several Occluders or rather one huge one? Or is it the Same in the End, concerning Processing Time? For Example, if I walk through a Street in my Game and there are several Buildings, should I then set up one Occluder Objects for each Building (inside of the Building, of Course), to hide the Rest behind it, or should I rather make one Objects that includes all the Meshes for all the several Buildingsā€™ Occluders? Would one of these both Possibilities be faster/slower than the other one?

  2. So, does the BGE actually render a Table even if it is behind me (def me = behind active camera) ?
    Because that would, indeed be rather questionable! At best! o_o

  1. I think a single occluder might be better, have to test that though.
  2. NO, when object are back of camera they arenā€™t rendered due to view frustum culling, only thing that lies in the frustum is rendered.

http://www.lighthouse3d.com/tutorials/view-frustum-culling/

Thanks, concerning 2. I was just puzzled because of:

(Silly me, could have mentioned it in thefirst Place. x3 )