Hi,
I want to use “Graphics.DrawMeshNow” to draw some object in my postprocess:
public class PP_Light_Point : MonoBehaviour
{
......
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
{
Camera curCamera = GetComponent<Camera> ();
UnityEngine.Object[] _Lights = FindObjectsOfType (typeof(Light));
foreach (UnityEngine.Object obj in _Lights)
{
Light lit = obj as Light;
// There need to cull the light is need to DrawMeshNow.
_LightPointMatrial.SetPass(0);
Matrix4x4 kWorldMat = lit.transform.localToWorldMatrix;
Graphics.DrawMeshNow(lp.mesh, kWorldMat);
}
}
......
}
Some lights are out of camera, they need not to draw. So I want to cull the light.
How to do it? Thank you.