Jump to content
  • Advertisement
Sign in to follow this  
trock3155

Glowing Model Edges with Deferred Renderer

This topic is 2344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


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

Share this post


Link to post
Share on other sites

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;
}
Edited by trock

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!