FAQ Database Discussion Community


OpenGL deferred rendering: point light implementation

c#,opengl,glsl,opentk,deferred-rendering
I'm trying to write a deferred renderer using C# and OpenGL (with OpenTK). But don't understand how should I implement the normal calculation for a point light. The point light fragment shader: vec2 texCoord = gl_FragCoord.xy / ScreenSize; vec3 pixelPos = texture2D(PositionBuffer,texCoord).xyz; vec3 pixelNormal = normalize(texture2D(NormalBuffer, texCoord).xyz); vec3 diffuseColor =...

OpenGL lights and deferred shading

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? Also, do most games use deferred shading? Should I implement deferred shading in my application if I use say less than 10 lights overall?

Deferred Shading - Multiple Lights (OpenGL/GLSL)

opengl,glsl,light,deferred-rendering,deferred-shading
I'm working on a deferred shading program and now I have to set up 50 different lights in the scene. To do so, I'm randomly generating its attributes (position, diffuse color, specular color) with this piece of code: void FBORender::BuildLights() { std::random_device rd; std::mt19937 gen(rd()); std::uniform_real_distribution<> dis(0.0, 0.1); for (int...

Deferred Rendering strange behaviour

opengl,deferred-rendering
I'm having a little trouble implementing a deferred rendering engine using OpenGL. I can render to texture and all the datas are correct for the first pass (calculating albedo, normals and depth), but when it comes to calculate the textures for the lightning (emissive and specular) I'm having some troubles....

SSAO incorrect at z = 0 and at distance

opengl,rendering,deferred-rendering,ssao
So I tried to implement SSAO, but it is not working as intended. It seems to split at Position z=0 (worldspace), there is a white Line at position z=0. Also the Occlusion there doesn't look right. Plus at greater distance, so when moving the camera, the occlusion becomes even weirder...

Camera-space Normals from depth texture

opengl,glsl,lighting,normals,deferred-rendering
I want to use a stored (non-linear) depth texture from 1st pass to produce screen-space normals. In 2nd pass I can render out depth, diffuse, ID etc., but I can't seem to get normals from depth working. Current understanding of getting normals from depth: texture() / texelFetch() p at the...