Jump to content

  • Log In with Google      Sign In   
  • Create Account

Glowing Model Edges with Deferred Renderer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 trock   Members   -  Reputation: 155

Like
0Likes
Like

Posted 18 July 2012 - 02:03 PM

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:

Posted Image

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.

Sponsor:

#2 ATEFred   Members   -  Reputation: 1125

Like
0Likes
Like

Posted 18 July 2012 - 02:56 PM

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)

#3 Dancin_Fool   Members   -  Reputation: 621

Like
0Likes
Like

Posted 18 July 2012 - 03:28 PM

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

#4 trock   Members   -  Reputation: 155

Like
0Likes
Like

Posted 18 July 2012 - 03:56 PM

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 Posted Image. 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, 18 July 2012 - 04:00 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS