culling masks!

Dear all

I want to know smothing
now in unity if there is an object behind the camera or not shown in the run time, does this object drawed?

thank you
Khaled

Objects behind another object are not automatically culled, no.

If I recall right, you can check with a dot operation on (target.position - camera.position) if the object is behind or in front of the camera. A positive dot result will be in front of the cam, negative behind. Correct me if I’m wrong. :slight_smile:

Unity automatically does frustrum view culling, which means that if an object is COMPLETELY off-camera, it is not rendered. But the moment any part of it is in view, it will ALL be rendered.

Unity does NOT automatically do occlusion or portal culling, or not rendering objects that are in the camera view but completely covered up by another object. If you want to do that, you have to do your own collision testing or raycasting.

The camera DOES have a maximum render distance, which at least can cut out rendering of quite distant objects if they are too small, etc. Terrains also have a separate maximum draw distance.

So there are several things that you can do out of the box. But obviously if a character goes inside a building or something like that, you can know when to turn that game object off.