Sign in to follow this  

Glowing Model Edges with Deferred Renderer

Recommended Posts

trock3155    155
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:


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.

Share this post

Link to post
Share on other sites
ATEFred    1700
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)

Share this post

Link to post
Share on other sites
trock3155    155
[quote name='Dancin_Fool' timestamp='1342646935' post='4960661']
Agreed with previous poster, my immediate thoughts are also that you aren't handling half texel offsets properly.

I am [i]trying[/i] to handle the offset, but definitely believe when you say that this is where the problem lies [img][/img]. 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 [i]should [/i]I be handling offset ie. initial GBuffer render, light passes, drawing the final quad to the screen etc.[i]?[/i]

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

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

[b]HLSL (Vertex Shader):[/b]
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;
[/CODE] Edited by trock

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this