deferred-shading

calculate light volume radius from intensity

江枫思渺然 提交于 2019-12-25 09:42:08
问题 i am currently having a problem with calculating the light volume radius for a deferred renderer. On low light intensities the volume size looks correct but when the light intensity (and therefore the radius) increases, the light volume seems to be more and more too small. I am calculating the light volume radius (in world space) like this: const float LIGHT_CUTOFF_DEFAULT = 50; mRadius = sqrt(color.length() * LIGHT_CUTOFF_DEFAULT); I then use this value to scale a box. In my shader i then

Reconstructing world coordinates from depth buffer and arbitrary view-projection matrix

我与影子孤独终老i 提交于 2019-12-21 04:23:14
问题 I'm trying to reconstruct 3D world coordinates from depth values in my deferred renderer, but I'm having a heck of a time. Most of the examples I find online assume a standard perspective transformation, but I don't want to make that assumption. In my geometry pass vertex shader, I calculate gl_Position using: gl_Position = wvpMatrix * vec4(vertexLocation, 1.0f); and in my lighting pass fragment shader, I try to get the world coordinates using: vec3 decodeLocation() { vec4 clipSpaceLocation;

Deferred Shading and attenuation

て烟熏妆下的殇ゞ 提交于 2019-12-14 03:42:31
问题 Recently I added deferred shading support in my engine; however I ran into some attenuation issues: As you can see, when I'm rendering the light volume (sphere), it doesn't blend nicely with the ambient part of the image ! Here is how I declare my point light: PointLight pointlight; pointlight.SetPosition(glm::vec3(0.0, 6.0, 0.0)); pointlight.SetIntensity(glm::vec3(1.0f, 1.0f, 1.0f)); Here is how I compute the light sphere radius: Attenuation attenuation = pointLights[i].GetAttenuation();

Shadow mapping: project world-space pixel to light-space

喜欢而已 提交于 2019-12-11 16:15:29
问题 I'm writing shadow mapping in deferred shading. Here is my depth map for directional light (orthogonal projection): Below is my full-screen quad shader to render pixel's depth in light view space: #version 330 in vec2 texCoord; out vec3 fragColor; uniform mat4 lightViewProjMat; // lightView * lightProj uniform sampler2D sceneTexture; uniform sampler2D shadowMapTexture; uniform sampler2D scenePosTexture; void main() { vec4 fragPos = texture(scenePosTexture, texCoord); vec4 fragPosLightSpace =

Deferred Shading and attenuation

拈花ヽ惹草 提交于 2019-12-09 21:01:57
问题 Recently I added deferred shading support in my engine; however I ran into some attenuation issues: As you can see, when I'm rendering the light volume (sphere), it doesn't blend nicely with the ambient part of the image ! Here is how I declare my point light: PointLight pointlight; pointlight.SetPosition(glm::vec3(0.0, 6.0, 0.0)); pointlight.SetIntensity(glm::vec3(1.0f, 1.0f, 1.0f)); Here is how I compute the light sphere radius: Attenuation attenuation = pointLights[i].GetAttenuation();