DX10 Missing Bridges at Night

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)

{

discard;

}

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

488000011 480000011

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

About stevefsx

I don't use FSX that much. But I am very annoyed when it doesn't work properly!
This entry was posted in Bridges, DX10. Bookmark the permalink.

One Response to DX10 Missing Bridges at Night

  1. stevefsx says:

    Actually that’s the rail bridge in the foreground!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s