linking the camera and a shader

enter code herei wish to create a nightvision effect with a shader for my camera. I have written the shader for a normal material, in which i mass a noise mask and a texture (in my camera example, the texture should be the image i get from the camera itself).

I have some questions: first, i see that i can pass a shader to the camera using Camera.renderWithShader. The thing is that i don’t know how to link the image from what i see through my camera and my shader. I would also like to put the noise mask to my shader and don’t know how to pass it. This is different then having a material to which you could link the textures.

I found some code on the net how to link the shader and the camera… the thing is that i don’t know if it’s good due to the fact that i can’t see the final nightvision effect because i don’t know how to pass textures to the camera. I can see the view altering but don’t know if it’s right.

void Start () {
	 nightVisionShader = Shader.Find("Custom/nightvisionShader");
		Camera.mainCamera.RenderWithShader(nightVisionShader,"");
	}
    
void OnRenderImage (RenderTexture source, RenderTexture destination) 
    
    {
       RenderTexture sceneNormals = RenderTexture.GetTemporary (source.width, source.height, 24, RenderTextureFormat.ARGB32);
	   transform.camera.targetTexture = sceneNormals;
	   transform.camera.RenderWithShader(nightVisionShader, "");

	 transform.camera.targetTexture = null;
         Graphics.Blit (sceneNormals, destination);
    	 RenderTexture.ReleaseTemporary (sceneNormals);              

    }

Here is how i do it!

void OnRenderImage (RenderTexture source,  RenderTexture destination) {		
		
		
		overlayMaterial.SetTexture ("_MainTex", Resources.Load("nightvision/") as Texture2D);
		overlayMaterial.SetTexture ("_noiseTex", Resources.Load("nightvision/noise_tex6") as Texture2D);
		overlayMaterial.SetTexture ("_maskTex", Resources.Load("nightvision/binoculars_mask") as Texture2D);	
		overlayMaterial.SetFloat ("_elapsedTime", Time.time);	
		Graphics.Blit (source, destination, overlayMaterial, 0);
	}