View Single Post
Old 12-30-07, 08:00 PM   #734
Comfortably Numb
omzig's Avatar
Join Date: Sep 2004
Posts: 752
Default Re: Flight Simulator X Full Version Feedback Thread

Sure SlaWter np

Copy this code to a new txt file and then rename it to Rain40.fx

// Copyright (c) Microsoft Corporation.  All Rights Reserved.

#include "Rain40.fxh"

struct VS_INPUT
    float4  vPosition : POSITION;
    float4  cColor    : COLOR0;
    float2  TexCoord  : TEXCOORD;

struct VS_OUTPUT
    float4 vPosition    : SV_POSITION;
    float4 cDiffuse     : COLOR;
    float2 TexCoord0    : TEXCOORD0;
    float2 TexCoord1    : TEXCOORD1;

    VS_OUTPUT Out = (VS_OUTPUT) 0;
    Out.vPosition = mul(In.vPosition, g_mWorldViewProjection);
    Out.cDiffuse = In.cColor;
    Out.TexCoord0 = mul(In.TexCoord, g_mTextureTransforms[0]);
    Out.TexCoord1 = mul(In.TexCoord, g_mTextureTransforms[1]);
    Out.TexCoord0 += g_mTextureTransforms[0][2];
    Out.TexCoord1 += g_mTextureTransforms[1][2];
    return Out;

float4 PS(const VS_OUTPUT In): SV_TARGET
    float4 cColor0 = txTexture0.Sample(samSampler, In.TexCoord0);
    float4 cColor1 = txTexture1.Sample(samSampler, In.TexCoord1);
    return float4(1,1,1,In.cDiffuse.w) * (cColor0 + cColor1);

DepthStencilState EnableDepth
DepthEnable = TRUE;
DepthWriteMask = ALL;
DepthFunc = LESS_EQUAL;

DepthStencilState DisableDepth
DepthEnable = FALSE;
DepthWriteMask = ZERO;

technique10 T0
    pass P0
        SetVertexShader(CompileShader(vs_4_0, VS()));
        SetPixelShader(CompileShader(ps_4_0, PS()));
        SetDepthStencilState( DisableDepth, 0 );
then goto your

\Microsoft Flight Simulator X\ShadersHLSL\misc

and make a copy/backup of Rain40.fx

then replace the original file with the new modded one

now goto your

X:\Users\<Your Name Here>\AppData\Local\Microsoft\FSX\Shaders10\Shader sHLSL\misc

folder and remove/delete the



Once you rerun FSX in dx10 mode it will recompile and replace the shader code with the new fixed code

If you dont like the bight white of the rain streaks(i didnt)

you can alter the rgb values in the line

return float4(1,1,1,In.cDiffuse.w) * (cColor0 + cColor1);


return float4(0,0,0,In.cDiffuse.w) * (cColor0 + cColor1);

and repeat the steps above to force a new recompile

that will give you much darker rain which does'nt obscure your view as much in flight the only downside to this is it also alters the colour of the snow effect as the 2 seem to be interlinked at a shader level

Hope that helps
omzig is offline   Reply With Quote