White Outline after applying LightMap

Started by
6 comments, last by lipsryme 12 years, 1 month ago
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: http://cl.ly/312L0L0I3x0b0S0y301T




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;
}
}
Advertisement
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?
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 ?
In PIX, select the draw call you want to debug, select the Render window, put the mouse on a white pixel right click Debug this pixel, then scroll down and click Debug Pixel(x,y), 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.
Not sure after which call to debug the pixel but is this right ?
Looks like a broken MSAA resolve. Try turning off MSAA.
[size="1"]Perl - Made by Idiots, Java - Made for Idiots, C++ - Envied by Idiots | http://sunray.cplusplus.se
This part looks wrong:

float2 ScreenUV = PostProjectionSpaceToScreenSpace(input.ScreenPos) + (1.0f / GBufferTextureSize.xy);


Are you attempting to correct for the half-texel offset in D3D9?
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 tongue.png

This topic is closed to new replies.

Advertisement