This might be an odd question, but for my game I need to show just one area of the setting (imagine a rectangular slice of a terrain) and all objects out of this area need to be culled away. I tried to do this using shaders for clipping, but objects out of the area are rendered anyway, they just are not visible.
My question is whether it's possible to have a culling process in Unity independently of the actual rendering camera, so that the culling camera would determine which objects are out of the visible area (imagine an orthogonal camera pointing downwards with dimensions the size of the visible area), and the rendering camera would cull those that are out of the frustum volume.
Is this somehow possible? If not, how do I cull manually the objects out of my visible area (trees, etc.) and how do I set them invisible to hide them from view - and I don't mean setting them to alpha=0 or some trick to make them invisible, I mean not being rendered at all.
Thanks in advance,
asked Jun 02 '11 at 03:32 PM
To not render an object, disable it's mesh renderer or the object altogether. Also your idea for culling is not possible.
answered Jun 02 '11 at 03:35 PM
You could alter the render distance for the layers in real time (which might be a workaround for you). http://unity3d.com/support/documentation/ScriptReference/Camera-layerCullDistances.html
You could trigger this via a collider and a for-loop for either switching the layer for the particular objects inside or altering the distances for your layers.