Hello Everybody I am new to shaders and wanted to build SSAO shader for which I found a very nice tutorial on : http://john-chapman-graphics.blogspot.co.uk/2013/01/ssao-tutorial.html I have implemented till generating the noise texture and have the normal and depth information from the cameras point of view , but cannot proceed to the real stuff where he asks to calcualte the origin? : Code (CSharp): vec3 origin = vViewRay * texture(uTexLinearDepth, vTexcoord).r; Here what is vViewRay and is uTexLinearDepth same as depthValue in my code below? Here is my code till the noise generation part : Code (CSharp): // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' Shader "Custom/CameraShader6" { Properties{ _Depthcheck("Depthcheck", Range(0, 100)) = 40 _NormalHigh("_NormalHigh",Range(0,100)) = 1 } SubShader{ //Tags{ "RenderType" = "Opaque" } Pass{ CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" sampler2D _CameraDepthNormalsTexture; sampler2D _CameraDepthTexture; float _Depthcheck; float _NormalHigh; struct v2f { float4 pos : SV_POSITION; float4 uv:TEXCOORD1; //float3 normal:NORMAL; }; //Vertex Shader v2f vert(appdata_full v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); o.uv = ComputeScreenPos(o.pos); //o.normal = v.normal; return o; } float rand(float3 posit) { return frac(sin( dot(posit.xyz ,float3(12.9898,78.233,45.5432) )) * 43758.5453); } float4 frag(v2f i) : COLOR{ float depthValue; float3 normalValues; float4 depth; float3 eyePos; float4 randPos; float randArray[64]; float noise[16]; float scale; //float xx = rand(); DecodeDepthNormal(tex2D(_CameraDepthNormalsTexture, i.uv), depthValue, normalValues); depthValue = (depthValue)*_Depthcheck; normalValues = normalValues*_NormalHigh; eyePos = float3(i.uv.xy,depthValue); //Generating the Sample Kernel for (unsigned int i = 0; i < 64; ++i){ randArray[i] = float3((rand(_SinTime.xyz)*2.0 - 1.0),(rand(_SinTime.xyz)*2.0 - 1.0),rand(_SinTime.xyz)); randArray[i] = normalize(randArray[i]); // scale each of the sample positions to distribute them within the hemisphere. randArray[i] *= rand(_SinTime.xyz); scale = (float)i / 64.0; scale = lerp(0.1, 1.0, scale*scale); randArray[i] *= scale; } //generating the noise texture for (int i = 0; i< 16; ++i){ noise[i] = float3((rand(_SinTime.xyz)*2.0 - 1.0),(rand(_SinTime.xyz)*2.0 - 1.0),0.0); noise[i] = normalize(noise[i]); } return float4(0.5,0.3,0.7,1); //return something random right now till the shader is complete } ENDCG } } FallBack "Diffuse" } Can somebody guide me how to further with this... Thanks in advance !