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 plz halp.