Hi there,

I'm currently trying to implement a SSAO in WebGL. My inspiration is this site: Tutorial

But my current problem is to reconstruct the fragments view space position from depth.

If I understood the viewray right it is a vector from the camera to a point on the far plane. I read through all of MJP s articles, but they confused me somehow.

I render a fullscreen quad, so i get the TexCoords and the positions of x and y of the vertex. So my thought was, that only z is needed which I filled with the linearized depth value at the position of the TexCoord.

For visualisation I switched the coordinates from -1,+1 to 0,1; But even with that info I don't really know what the outcome should look like.

vec3 viewRay = vec3(vViewRay.xy * 0.5 + 0.5 , linearDepth);

Here is a fiddle of my 2 shaders I use.

http://jsfiddle.net/Peters_Stuff/8ddkt/

Thanks for your ideas