#include "RootConstants.hlsl"

float4 main(float3 ViewDir : TEXCOORD0) : SV_Target0
{
    float3 dir = normalize(ViewDir);
    
    // Simple Procedural Gradient Skybox Colors
    float3 skyZenithColor = float3(0.05f, 0.15f, 0.45f); // Deep blue top
    float3 skyHorizonColor = float3(0.4f, 0.6f, 0.9f); // Light blue horizon
    float3 groundColor = float3(0.1f, 0.1f, 0.15f); // Dark ground
    
    float t = dir.z; // -1 to 1 based on vertical alignment
    
    float3 finalColor = groundColor;
    
    if (t > 0.0f) {
        // Blend from horizon to zenith
        finalColor = lerp(skyHorizonColor, skyZenithColor, t);
    } else {
        // Ground - quick blend from horizon to ground
        finalColor = lerp(skyHorizonColor, groundColor, saturate(-t * 2.0f));
    }
    
    // Combine with overall ambient lighting scale
    return float4(finalColor, 1.0f);
}
