Sign in to follow this  
lipsryme

White Outline after applying LightMap

Recommended Posts

I'm currently implementing a Deferred Renderer (Light Pre Pass) and stumbled upon this odd thing which probably has to do with the UV's which I'm reading the LightMap from, where I have a small white outline at the left side of everything I look at. Any ideas what I'm doing wrong ?

The effect can be seen here: [url="http://cl.ly/312L0L0I3x0b0S0y301T"]http://cl.ly/312L0L0I3x0b0S0y301T[/url]


[CODE]

float2 PostProjectionSpaceToScreenSpace(float4 pos)
{
float2 screenPos = pos.xy / pos.w;
return (0.5f * (float2(screenPos.x, -screenPos.y) + 1));
}

float4 Compose_PS(PSI_Compose input) : COLOR0
{
float2 ScreenUV = PostProjectionSpaceToScreenSpace(input.ScreenPos) + (1.0f / GBufferTextureSize.xy);
// Get Albedo Color
float4 Albedo = tex2D(AlbedoSampler, input.UV);
// Get SSAO
float4 SSAO = tex2D(SSAOBuffer, ScreenUV);
// Get Lighting Equations
float Ambient = 0.08f;
if(MaterialID != 1)
{
float4 Light = tex2D(LightBuffer, ScreenUV);
float3 NLATTColor = float3(Light.x, Light.y, Light.z);
float3 Lighting = NLATTColor + Light.w;
return Ambient + (Albedo * float4(Lighting, 1)) * float4(SSAO.xyz, 1);
}
else
{
return Ambient + Albedo;
}
}
[/CODE]

Share this post


Link to post
Share on other sites
Hi, can you run your project on PIX, debug the white pixels and see what UV's are being used for those pixels, and post what you find here...

Also, are those white pixels in the lightmap?

Share this post


Link to post
Share on other sites
Ok, so I've figured out that the problem doesn't seem to be the lightmap but the Albedo Color coming together with the lightmap. (Maybe not the same exact UV ?)
Because the outline has the same color as the Texture Color at that area and when I just output the Lighting in my Shader the outline is gone.

I'm not an expert on PIX, how can I debug UV's in there ?

Share this post


Link to post
Share on other sites
In PIX, select the draw call you want to debug, select the [b]Render[/b] window, put the mouse on a white pixel right click [b]Debug this pixel[/b], then scroll down and click [b]Debug Pixel(x,y)[/b], and you can see what happens in the shader, like variable values, etc.

You should be familiar with PIX because it's really helpful when you want to find errors, etc.

Also in your shader, you can use Light.xyz instead of creating the variable NLATTColor.

Share this post


Link to post
Share on other sites
This part looks wrong:
[code]
float2 ScreenUV = PostProjectionSpaceToScreenSpace(input.ScreenPos) + (1.0f / GBufferTextureSize.xy);
[/code]

Are you attempting to correct for the half-texel offset in D3D9?

Share this post


Link to post
Share on other sites
Well using less than 1.0f make the borders even thicker, and using 2.0f its smaller though I don't really get the context. I copied that line from another project.

To clarify: Compose is the Forward Rendering Pass where I take the input from the LightBuffer and other stuff and combine them to a final output.
And then I guess I need to do some transforming to get the right UV's for sampling my RenderTargets.

@sunray I'm not even using MSAA, actually turning it on makes the outlines look better [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]

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