Determine if a camera is rendering a shadow map

Hi,

I want to do some pre-processing for visible objects.

Therefore I override OnWillRenderObject. Inside, using Camera.current, I get the current camera that is going to render the object. Now I wonder if there is a 100% safe way to find out if that camera is a “real” camera or just one for rendering a shadow map. This is important for me because my pre-processing only applies to really visually visible objects and not those that only cast a shadow into the scene but can’t actually be seen.

So, is there a way to find out if a camera is rendering a shadow map?

I answer the question myself and hope that it’s useful to others with the same problem:

One way to do it is to keep track of all “normal” cameras in a list or set. Then simply check if the current camera is in this list or not. If it’s not, it is a camera not created by yourself and depending on the concrete scenario most likely one for shadow map rendering.