Glowing Model Edges with Deferred Renderer

Started by
2 comments, last by trock3155 11 years, 9 months ago
HI,
I am trying to get rid of an issue I have with "glowing" edges that has plagued my deferred renderer for a while. I have spent some time looking thru my lighting code and G Buffer Rendering Code, but can not find anything that stands out. This is what I am seeing:

glowingedges.png

Anyone have any idea where I should start looking? It definitely negatively affects the final image quality. I do use normal map and specular map sampling in my Gbuffer Shader, if that makes a difference. I can post code as well, just don't want to explode this thread with unnecessary code for my various .fx / c# code.

Note: This is using a single directional light that does not cast shadows, but does read normals/spec.
Advertisement
This looks like you are not correcting for the half texel offset in dx9. Have a look in the dx documentation at this page:
"Directly Mapping Texels to Pixels (Direct3D 9)", it explains the problem and how to solve it (super simple, just adjust uvs by half a texel in shaders)
Agreed with previous poster, my immediate thoughts are also that you aren't handling half texel offsets properly.

Agreed with previous poster, my immediate thoughts are also that you aren't handling half texel offsets properly.


I am trying to handle the offset, but definitely believe when you say that this is where the problem lies smile.png. As I understand it, this is only necessary when rendering fullscreen Quads within a deferred renderer. Is this a false assumption? If this is incorrect, during which render calls should I be handling offset ie. initial GBuffer render, light passes, drawing the final quad to the screen etc.?

I will do a full audit tonight, but this is what I am doing when rendering quads:

C#:
Vector2 halfPixel = new Vector2(.5f/GBufferSize.X, .5f/GBufferSize.Y); //this is passed into the effect file

HLSL (Vertex Shader):

struct VertexShaderOutput
{
float4 Position : POSITION0;
float2 TexCoord : TEXCOORD0;
};
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
output.Position = float4(input.Position, 1);

//align texture coordinates
output.TexCoord = input.TexCoord - halfPixel;
return output;
}

This topic is closed to new replies.

Advertisement