Initial commit

This commit is contained in:
Stillkill committed 2026-03-08 15:30:46 -05:00
commit c630089742
4782 files changed
+178521

No files matched your search

@@ -0,0 +1,82 @@
#include "ShaderConstants.fxh"
#include "Util.fxh"
struct PS_Input
{
float4 position : SV_Position;
lpfloat4 color : COLOR;
snorm float2 uv0 : TEXCOORD_0_FB_MSAA;
snorm float2 uv1 : TEXCOORD_1_FB_MSAA;
#ifdef NEAR_WATER
float cameraDist : TEXCOORD_2;
#endif
#ifdef FOG
float4 fogColor : FOG_COLOR;
#endif
};
struct PS_Output
{
float4 color : SV_Target;
};
void main( in PS_Input PSInput, out PS_Output PSOutput )
{
#if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE) || (VERSION < 0xa000 /*D3D_FEATURE_LEVEL_10_0*/)
float4 diffuse = TEXTURE_0.Sample(TextureSampler0, PSInput.uv0);
#else
float4 diffuse = texture2D_AA(TEXTURE_0, TextureSampler0, PSInput.uv0 );
#endif
#ifdef SEASONS_FAR
diffuse.a = 1.0f;
PSInput.color.b = 1.0f;
#endif
#ifdef ALPHA_TEST
//If we know that all the verts in a triangle will have the same alpha, we should cull there first.
#ifdef ALPHA_TO_COVERAGE
float alphaThreshold = .05f;
#else
float alphaThreshold = .5f;
#endif
if(diffuse.a < alphaThreshold)
discard;
#endif
diffuse = diffuse * TEXTURE_1.Sample(TextureSampler1, PSInput.uv1);
#ifndef SEASONS
#if !defined(ALPHA_TEST) && !defined(BLEND)
diffuse.a = PSInput.color.a;
#elif defined(BLEND)
diffuse.a *= PSInput.color.a;
#ifdef NEAR_WATER
float alphaFadeOut = saturate(PSInput.cameraDist.x);
diffuse.a = lerp(diffuse.a, 1.0f, alphaFadeOut);
#endif
#endif
diffuse.rgb *= PSInput.color.rgb;
#else
float2 uv = PSInput.color.xy;
diffuse.rgb *= lerp(1.0f, TEXTURE_2.Sample(TextureSampler2, uv).rgb*2.0f, PSInput.color.b);
diffuse.rgb *= PSInput.color.aaa;
diffuse.a = 1.0f;
#endif
#ifdef FOG
diffuse.rgb = lerp( diffuse.rgb, PSInput.fogColor.rgb, PSInput.fogColor.a );
#endif
PSOutput.color = diffuse;
#ifdef VR_FEATURE
// On Rift, the transition from 0 brightness to the lowest 8 bit value is abrupt, so clamp to
// the lowest 8 bit value.
PSOutput.color = max(PSOutput.color, 1 / 255.0f);
#endif
}