Trying to use GBuffer RT0 and only get a grey screen.

I’m trying to create a full screen diffuse only image effect so I can test out the gbuffers that Unity gives me access to, and I can’t see to understand what is going on. I’ve been playing with existing shaders and reading other forum posts, and not really getting and better understanding of what I’m doing wrong.

The documentation says this

The g-buffer pass renders each GameObject once. Diffuse and specular colors, surface smoothness, world space normal, and emission+ambient+reflections+lightmaps are rendered into g-buffer textures. The g-buffer textures are setup as global shader properties for later access by shaders (CameraGBufferTexture0 … CameraGBufferTexture3 names).

So that means that the renders of each pass should be stored in CameraGBufferTexture#, right?

If I want to get just the diffuse render and render that to the screen, then I have this code.

Shader "Custom/Custom" {
	SubShader {
        Tags {
		Pass {  
			#pragma vertex vert
			#pragma fragment frag
			#include "UnityCG.cginc"

			struct appdata {
				float2 uv : TEXCOORD0;
				float4 vertex : POSITION;

			struct v2f	{
				float2 uv : TEXCOORD0;
				float4 vertex : SV_POSITION;

			v2f vert (appdata v) {
				v2f o;
				o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
				o.uv = v.uv;
				return o;

			sampler2D _CameraGBufferTexture0;

			half4 frag (v2f i) : SV_TARGET {

				half4 base = tex2D(_CameraGBufferTexture0, i.uv); 
				return base;


But when I apply this shader to a material, and place the material on the camera, I get an entirely gray screen as a result.

What am I overlooking?

If I copy the individual rgb values to the another texture (lets use the _MainTex for example), each value is 0.5. I can do them one by one, one at a time, and see how they change. I can tell R, G, and B are just 0.5.

main.r = base.r;
main.g = base.g;
main.b = base.b;
return main;

Shouldn’t it be the color of the albedo on the render target?

I see my problem.

These last few weeks of looking at shader coder and it turns out it wasn’t my code that was wrong, it was that the camera’s graphic setting was not set to deferred like I had thought. I was desperate and just checked again because I didn’t know where else to look, and thats what it was. I just wanted to let people know that.