Files
2026-08-09 04:23:10 -07:00

54 lines
1.6 KiB
Plaintext

{
inherit skyDrawAndScroll
parms {
stageSort sortEmitOnly
exposure exposure * skyGlarePreScale
}
state {
blend GL_ONE GL_ONE
depthmask
twosided
}
hlsl_fp {
float4 YCoCg = tex2D( $spare1Map, fragment.texcoord0.xy );
// convert the diffuse from YCoCg to RGB
half4 skyCol;
YCoCg.z = ( YCoCg.z * 31.875 ) + 1.0; //z = z * 255.0/8.0 + 1.0
YCoCg.z = 1.0 / YCoCg.z;
YCoCg.xy *= YCoCg.z;
skyCol.x = dot4( YCoCg, matrixCoCg1YtoRGB1X );
skyCol.y = dot4( YCoCg, matrixCoCg1YtoRGB1Y );
skyCol.z = dot4( YCoCg, matrixCoCg1YtoRGB1Z );
skyCol.w = 1.0;
skyCol *= $exposure;
// fog distance is fog altitude / normalized Z component
float dist = ( $skyFogCutoffHeight.x / normalize( fragment.texcoord3.xyz ).z ) * $fogScale.x; // combine fogScale with fogCutoffHeight?
dist = saturate( exp2( -dist ));
half3 final = skyCol.xyz;
// add the scrolling second cloud layer
half4 cloudCol = tex2D( $transMap, fragment.texcoord1.xy ) * $cloudScale;
final += cloudCol.xyz * dist;
// Apply additional additive pass
half4 mask = tex2D( $fadeMap, fragment.texcoord2.xy );
half4 cloudCol1 = tex2D( $transMap1, fragment.texcoord2.xy ) * $cloudScale1;
#if 1 // cloud test for Justin
final = lerp( final, cloudCol1.xyz, mask.x * dist );
#else
final += cloudCol1.xyz * mask.xyz * dist;
#endif
result.color0.xyz = final;
// store fog factor in alpha so additive passes can be blended on
//result.color0.w = dist;
// make sure alpha is always 1.0 so the radiosity programs
// don't think they are seeing back sides of surfaces
result.color0.w = 1.0;
}
}