mirror of
https://github.com/celisej567/cool-source-archive.git
synced 2026-09-21 20:10:15 +03:00
52 lines
1.4 KiB
Plaintext
52 lines
1.4 KiB
Plaintext
// DYNAMIC: "WRITE_DEPTH_TO_DESTALPHA" "0..1"
|
|
#include "common_ps_fxc.h"
|
|
|
|
Texture2D RGBSTexture : register( t0 );
|
|
sampler RGBSTextureSampler : register( s0 );
|
|
|
|
#include "common_sky_fxc.h"
|
|
#include "common_cbuffers_fxc.h"
|
|
CBUFFER_PERFRAME(register(b0))
|
|
|
|
cbuffer Sky_CBuffer : register(b1)
|
|
{
|
|
Sky_t cSky;
|
|
};
|
|
|
|
struct PS_INPUT
|
|
{
|
|
float4 projPos : SV_POSITION;
|
|
float2 baseTexCoord00 : TEXCOORD0;
|
|
float2 baseTexCoord01 : TEXCOORD1;
|
|
float2 baseTexCoord10 : TEXCOORD2;
|
|
float2 baseTexCoord11 : TEXCOORD3;
|
|
float2 baseTexCoord_In_Pixels: TEXCOORD4;
|
|
};
|
|
|
|
float4 main( PS_INPUT i ) : SV_TARGET
|
|
{
|
|
float3 result;
|
|
|
|
float4 s00 = RGBSTexture.Sample(RGBSTextureSampler, i.baseTexCoord00);
|
|
float4 s10 = RGBSTexture.Sample(RGBSTextureSampler, i.baseTexCoord10);
|
|
float4 s01 = RGBSTexture.Sample(RGBSTextureSampler, i.baseTexCoord01);
|
|
float4 s11 = RGBSTexture.Sample(RGBSTextureSampler, i.baseTexCoord11);
|
|
|
|
float2 fracCoord = frac(i.baseTexCoord_In_Pixels);
|
|
|
|
s00.rgb*=s00.a;
|
|
s10.rgb*=s10.a;
|
|
|
|
s00.xyz = lerp(s00, s10, fracCoord.x);
|
|
|
|
s01.rgb*=s01.a;
|
|
s11.rgb*=s11.a;
|
|
s01.xyz = lerp(s01, s11, fracCoord.x);
|
|
|
|
result = lerp(s00, s01, fracCoord.y);
|
|
|
|
// This is never fogged.
|
|
return FinalOutput( float4( cSky.InputScale*result, 1.0f ), 0, PIXEL_FOG_TYPE_NONE, float4(0, 0, 0, 1),
|
|
TONEMAP_SCALE_LINEAR, cToneMappingScale, WRITE_DEPTH_TO_DESTALPHA, 1e20 ); //when writing depth to dest alpha, write a value guaranteed to saturate
|
|
}
|