second camera renderWithShader

Hey all, trying my darndest to use google and the unity manual to figure this out but i just can’t do it. I feel like I’m missing a huge step that no one points out cos its obvious? anyway;

I have 2 camera’s in scene, cam1 is viewport.

cam2 renders out to a RenderTexture to display a top down minimap on the canvas, this camera has its culling mask set up correctly so it only draws ‘Tiles’ (walls, floors).
this all works flawlessly.

what i need is for cam2 to render with fullbright lighting, ignore all light sources and such, google directed me to the shader lab and Camera.RenderWithShader ();
try as i might im not getting the results im looking for, either the camera stops rendering all together or it renders with lighting.

I stole a few shader scripts off the googles and tried to study them, people say they work but they don’t for me. I still have near-to-no understanding of shader syntax except for the basics i could figure out.

So i guess what im asking here is for some one to briefly go over the steps they would use to achieve the same thing, im TRYING to understand it all because frankly i’d rather learn than get a free ride, you know?

What I’ve got

private Camera cam;
	public Shader shad;

	void Start () 
	{
		cam = GetComponent<Camera>();

		cam.RenderWithShader (shad, "Opaque");  
            //I have no idea what string goes here so i tried listing different tags and things depending on 
            //the shader scripts i got

		cam.enabled = true;
	}

Shader "Unlit/VertexLightless"
{
	Properties 
	{
    	 _Color ("Main Color", Color) = (1,1,1,1)
    	 _MainTex ("Base (RGB)", 2D) = "white" {}
 	}

 	SubShader 
 	{
     	Tags { "RenderType"="Opaque" }
  	 	LOD 200
 
 		CGPROGRAM
		#pragma surface surf Lambert
 
 		sampler2D _MainTex;
		fixed4 _Color;
 
 	struct Input 
 	{
     	float2 uv_MainTex;
    	float4 color : COLOR;
 	};
 
 	void surf (Input IN, inout SurfaceOutput o) 
 	{
     	fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
     	o.Albedo = c.rgb;
     	o.Albedo *= IN.color.rgb;
     	o.Alpha = c.a;
 	}
 		ENDCG
 	}
 	Fallback "VertexLit"
}

P.S. : The shader isn’t my writing, I’m trying to learn from it and get it working.
This is my first adventure into shader lab and its proving difficult :frowning: plz halp.

It would help reading the documentation as well as the linked pages like this one.

The method “RenderWithShader” renders the camera manually. Of course rendering it in Start makes no sense at all. Even Update wouldn’t work as Update runs way before any rendering starts.

If you’re not familiar to manually rendering things you might just want to use “SetReplacementShader” instead and leave the camera enabled. That way it renders automatically but uses the replacement shader.

Also the documentation is pretty clear about how it works:

  • If replacementTag is empty, then all objects in the scene are rendered with the given replacement shader.
  • If replacementTag is not empty, then for each object that would be rendered:
  • The real object’s shader is queried for the tag value.
  • If it does not have that tag, object is not rendered.
  • A subshader is found in the replacement shader that has a given tag with the found value. If no such subshader is found, object is not rendered.
  • Now that subshader is used to render the object.

This is pretty clear what is actually rendered.