diff options
author | aap <aap@papnet.eu> | 2021-01-10 11:59:51 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2021-01-10 11:59:57 +0100 |
commit | 0ee87d7b46c4e340554f25d38d01bc1accb8c826 (patch) | |
tree | 6021adcb61abe61cdceb691a867117b0e116eff3 /src/extras/shaders/leedsVehicle_blend_PS.hlsl | |
parent | Merge pull request #942 from majesticCoding/lcs (diff) | |
download | re3-0ee87d7b46c4e340554f25d38d01bc1accb8c826.tar re3-0ee87d7b46c4e340554f25d38d01bc1accb8c826.tar.gz re3-0ee87d7b46c4e340554f25d38d01bc1accb8c826.tar.bz2 re3-0ee87d7b46c4e340554f25d38d01bc1accb8c826.tar.lz re3-0ee87d7b46c4e340554f25d38d01bc1accb8c826.tar.xz re3-0ee87d7b46c4e340554f25d38d01bc1accb8c826.tar.zst re3-0ee87d7b46c4e340554f25d38d01bc1accb8c826.zip |
Diffstat (limited to 'src/extras/shaders/leedsVehicle_blend_PS.hlsl')
-rw-r--r-- | src/extras/shaders/leedsVehicle_blend_PS.hlsl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/extras/shaders/leedsVehicle_blend_PS.hlsl b/src/extras/shaders/leedsVehicle_blend_PS.hlsl new file mode 100644 index 00000000..e32970b2 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_blend_PS.hlsl @@ -0,0 +1,33 @@ +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; + float2 TexCoord1 : TEXCOORD1; + float4 Color : COLOR0; +}; + +sampler2D diffTex : register(s0); +sampler2D envTex : register(s1); + +float4 fogColor : register(c0); + +float4 fxparams : register(c1); + +#define shininess (fxparams.x) + +float4 main(VS_out input) : COLOR +{ + float4 pass1 = input.Color*tex2D(diffTex, input.TexCoord0.xy); + float4 pass2 = tex2D(envTex, input.TexCoord1.xy); + pass2.a *= shininess; + + pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z); + pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z); + + // We simulate drawing this in two passes. + // We premultiply alpha so render state should be one. + float4 color; + color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a; + color.a = pass1.a*(1.0-pass2.a) + pass2.a; + + return color; +} |