I have a map camera for my minimap, it should renderer the terrain unlit or with light from a straight-down light without any shadows (which wouldn’t in turn be used by the normal player camera). The normal scene lights shouldn’t affect this camera’s rendering.
What I tried so far:
-
Setting the lights to a specific layer and removeing this layer from the camera’s culling mask (Doesn’t work at all)
-
Using OnPreCull & OnPostRender to enable/disable lights (Works, but performance takes a big hit)
-
Using Camera.RenderWithShader to make the camera render objects with a spcific shader (Unlit/Texture, for example). Doesn’t work either, or I don’t know how to use it correctly:
using UnityEngine;
using System.Collections;
public class MapCamera : MonoBehaviour {
public Shader unlitShader; void Start() { unlitShader = Shader.Find("Unlit/Texture"); GetComponent<Camera>().RenderWithShader(unlitShader, ""); }
}
The camera is inactive when Start() is called, and the replacementTag is left empty, both as described in Rendering with Replaced Shaders.