I am tired of lights – but I will come back to them!
Lots of bridges don’t appear at night in DX10. However if we have a close look FSX does draw them, they just come out invisible.
The problem seems to be one of transparency.
The pixel shader has a test thus
if (cColor.a < g_fAlphaTestThreshold)
If the opaqueness is less than some threshold it discards the pixel. If I comment this out I can see a very faint ghost like bridge
The texture definitely has a proper alpha channel so whats up? It seems as if the alpha channel is reduced as the light fades – I have noticed an Ariane rocket at le Bourget airport that becomes see through at dusk and disappears at night!
The shader involved is one of two
Which means SHD_BASE, SHD_SPECULAR,SHD_APPLY_Y_BIAS, SHD_ALPHA_TEST and possibly SHD_DOUBLE_SIDED
After an hour or so of testing the problem seems to be here, this is blending between the day and night textures for the bridge
#elif defined( SHD_BLENDED_EMISSIVEMAP )
cColor = lerp( float4(fEmissiveScale * cEmissive.rgb,0) , cColor, g_fBlendedEmissiveFactor);
Because its night the blend is almost all towards the left (the night texture) but its set it as 100% transparent! I am testing changing it to be the CEmissive alpha value which is what the DX9 shader seems to use to see what effects it has – clearly the behaviour can be changed – it’s a question of whether it throws up any oddities.
Anyway for now here is the Forth Road bridge at night in DX10