# Weird rendering issue when applying lightmap through HLSL

I have a weird issue when trying to render the lightmaps in my game.

Note how the scene looks up close with the lightmaps enabled.

Note how that same part of the scene is now completely blacked out (as well as its surroundings) - this happens gradually as you zoom out.

When I completely disable the lightmap, nothing is blacked out, making me believe its related to the way I apply it with HLSL.

Here's how I my Pixel Shader code looks like:

float4 PS1(VSO input) : COLOR
{
float4 albedo = (HasAlbedo) ? tex2D(AlbedoSampler, input.UV) * input.Color : input.Color;
float4 lightmap = (HasLightMap) ? tex2D(LightMapSampler, input.LightMapUV) : float4(1, 1, 1, 1);

float4 finalColor = float4(albedo.xyz * lightmap.xyz, 1.0f);

return (HasFog) ? input.FogFactor * finalColor + (1.0 - input.FogFactor) * FogColor : finalColor;
}


Am I doing something wrong in my HLSL? Or is it most likely something else?

• I use SharpDX in combination with C#.

• The assets in the screenshots come from the game "Medal of Honor Allied Assault", so my sincere apologies for the Swastika signs if it offends anyone. This scene just happened to show the issue perfectly.

LightMaps[i] = new Texture(GameHelper.Device, BSPFile.LIGHTMAP_SIZE, BSPFile.LIGHTMAP_SIZE, 0, Usage.None, Format.A8R8G8B8, Pool.Managed);