opengl,rendering,deferred-rendering,ssao

I figured it out by debugging the code step by step. I calculate everything in world space. It's easier to handle everything there. I looked at a tutorial which uses view space and changed everything I needed to world space. The error is here: float rad = g_sample_rad / p.z;...

opengl,glsl,lighting,normals,deferred-rendering

The way you calculate p, p1 and p2 via viewSpacePositionFromDepth is certainly wrong. That function uses the same texcoordFrag for all three points, just with a different depth, so all three points will lie on a line. The cross product in getNormal should just yield 0 for any pixel -...

opengl,glsl,light,deferred-rendering,deferred-shading

Not using that equation, light goes on forever. plot 1.0 / (1+5*(x*x)) at wolframalpha.com: [EDIT] Since your light colour values can go above one, the following 1/255 will need to be divided by the largest RGB component. You'll need a threshold. Assuming your monitor can't display anything dimmer than 1/255...

opengl,shadow-mapping,deferred-rendering

You are missing the perspective divide and you seem to be completely ignoring depth range. The general idea here is to get ShadowCoord.xyz into the range [0,1] (for texture lookup and depth comparison). Your code operates under the assumption that uViewProjectionMatrix * pos (clip-space coordinates) is in the range [-1,1]...

c#,opengl,glsl,opentk,deferred-rendering

vec3 distance = toLight * (1.0 / LightRadius); float attenuation = clamp(1 - dot(distance, distance), 0, 1); attenuation = attenuation * attenuation; Using this "formula" it looks like it's working as it should....

opengl,shader,fragment-shader,light,deferred-rendering

Is it fair to say that the only difference between directional lights and point lights is that directional lights have no attenuation factor? If you model directional lights as point lights which are indefinitely far away, the attenuation is indeed the only difference. Also, do most games use deferred...

Ok I figured out what I was missing. I needed to disable depth test before doing the point light pass and the re-enable it to combine the final image. My code for the deferred rendering function now looks like this (all the rest is still the same): // Same as...

opengl,glsl,light,deferred-rendering,deferred-shading

In deferred rendering you usually render each light separately and let the GPU blend the result together. This reduces shader complexity. Let's take a closer look at your lighting calculations. partialColor = vec4( mix( partialColor.rgb, tex, 0.5 ), partialColor.a ); Hm... What is this line supposed to do? At that...