FSX DX10 Transparency Issues Part 1

Whilst testing my Shader fix for taxiways I noticed that at a couple of airports there were some minor issues with chain fences.

An example of this is Friday Harbor. Here are two views at fractionally different angles

The fence is opaque and curiously it changes from opaque to transparent very sharply as you change the viewing angle.

The Intel GPA is a superb tool by the way and has some excellent features. If you select the Entire Frame it show you all the textures used. If you then select a texture and right click you can then drill down to the draws that used that texture. This makes it a breeze to find the drawcall that drew the chain fence.

Bad                                    Good

Whats immediately obvious is that when its opaque it sets the depth stencil state to NULL three times and does exactly the same thing with the blend state. When its transparent it sets them to NULL once and to an actual Blend State and Depth Stencil the other two times.

So this seems a very similar issue. Whether its fixable depends on whether the shader is used for anything else.

I have to say that this seems a very puzzling bug! It seems like it is testing the angle and doing it deliberately. It may be that the idea was for small transparent objects seen almost sideways on to be opaque – but if so they didn’t consider very long objects like fences – such a test should be done in the shader per pixel not in the C++ code.

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 DX10. Bookmark the permalink.

5 Responses to FSX DX10 Transparency Issues Part 1

  1. stevefsx says:

    The shader isn’t used anywhere else at the airport scene which is a good sign.
    Its signature is either General10.fx0a40000001000001_0x0f or General10.fx0a40000009000001_0x0f

    I am currently trying to work out how the names of the generated shaders relate to the shader options.

  2. stevefsx says:

    I have a fix for the chain fence, but I am not 100% convinced on the detection of the shader signature – I worry that it may match too many shaders and so cause side effects. The logic is like this at the moment

    #if defined(VT_VERTEX) && defined(SHD_DOUBLE_SIDED) && defined(SHD_BASE) && !defined(SHD_PRELIT) && !defined(SHADOWMAP) && !defined(SHD_ADDITIVE_EMISSIVEMAP)
    #define FENCE_SHADER 1

    #if defined(FENCE_SHADER)
    BlendState Enable
    BlendEnable[0] = TRUE;
    SrcBlend = 5;
    DestBlend = 6;

    Then inside technique10
    #if defined(FENCE_SHADER)
    SetBlendState(Enable,float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF);

  3. Lee says:

    Perhaps the fence shading is deliberate. When viewed at a shallow angle, chain link fences do appear to be somewhat opaque. They become more and more transparent as you approach a right angle in relation to the fence line. This is especially true when in a vehicle moving along the fence line.

    When I was a kid chain link fences were more common than they are today.


    • stevefsx says:

      Yes I thought that. However the angle the fences become opaque can be 90 degrees. I also wondered if the angle was based on the centre of the fence and not where you were looking.

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