Skip to main content
ctrl-k indents code
Source Link

I'm assuming you're talking about the gbuffers of the deferred rendering path

According to this link : https://catlikecoding.com/unity/tutorials/rendering/part-15/this tutorial.

You need to declare the samplers in your shaders:

sampler2D _CameraGBufferTexture0; sampler2D _CameraGBufferTexture1; sampler2D _CameraGBufferTexture2;

sampler2D _CameraGBufferTexture0;
sampler2D _CameraGBufferTexture1;
sampler2D _CameraGBufferTexture2;

Then you can read from them like so

float3 albedo = tex2D(_CameraGBufferTexture0, uv).rgb; float3 specularTint = tex2D(_CameraGBufferTexture1, uv).rgb; float3 smoothness = tex2D(_CameraGBufferTexture1, uv).a; float3 normal = tex2D(_CameraGBufferTexture2, uv).rgb * 2 - 1;

float3 albedo = tex2D(_CameraGBufferTexture0, uv).rgb;
float3 specularTint = tex2D(_CameraGBufferTexture1, uv).rgb;
float3 smoothness = tex2D(_CameraGBufferTexture1, uv).a;
float3 normal = tex2D(_CameraGBufferTexture2, uv).rgb * 2 - 1;

You're interested in _CameraGBufferTexture2

I'm assuming you're talking about the gbuffers of the deferred rendering path

According to this link : https://catlikecoding.com/unity/tutorials/rendering/part-15/

You need to declare the samplers in your shaders:

sampler2D _CameraGBufferTexture0; sampler2D _CameraGBufferTexture1; sampler2D _CameraGBufferTexture2;

Then you can read from them like so

float3 albedo = tex2D(_CameraGBufferTexture0, uv).rgb; float3 specularTint = tex2D(_CameraGBufferTexture1, uv).rgb; float3 smoothness = tex2D(_CameraGBufferTexture1, uv).a; float3 normal = tex2D(_CameraGBufferTexture2, uv).rgb * 2 - 1;

You're interested in _CameraGBufferTexture2

I'm assuming you're talking about the gbuffers of the deferred rendering path

According to this tutorial.

You need to declare the samplers in your shaders:

sampler2D _CameraGBufferTexture0;
sampler2D _CameraGBufferTexture1;
sampler2D _CameraGBufferTexture2;

Then you can read from them like so

float3 albedo = tex2D(_CameraGBufferTexture0, uv).rgb;
float3 specularTint = tex2D(_CameraGBufferTexture1, uv).rgb;
float3 smoothness = tex2D(_CameraGBufferTexture1, uv).a;
float3 normal = tex2D(_CameraGBufferTexture2, uv).rgb * 2 - 1;

You're interested in _CameraGBufferTexture2

Source Link
Sidar
  • 3.6k
  • 2
  • 17
  • 28

I'm assuming you're talking about the gbuffers of the deferred rendering path

According to this link : https://catlikecoding.com/unity/tutorials/rendering/part-15/

You need to declare the samplers in your shaders:

sampler2D _CameraGBufferTexture0; sampler2D _CameraGBufferTexture1; sampler2D _CameraGBufferTexture2;

Then you can read from them like so

float3 albedo = tex2D(_CameraGBufferTexture0, uv).rgb; float3 specularTint = tex2D(_CameraGBufferTexture1, uv).rgb; float3 smoothness = tex2D(_CameraGBufferTexture1, uv).a; float3 normal = tex2D(_CameraGBufferTexture2, uv).rgb * 2 - 1;

You're interested in _CameraGBufferTexture2