#version 330 core out vec4 FragColor; in vec3 texCoords; uniform samplerCube skybox; float near = 00.01f; float far = 10.f; float linearizeDepth(float depth) { return (2.0 * near * far) / (far + near - (depth * 2.0 - 1.0) * (far - near)); } float logisticDepth(float depth, float steepness, float offset) { float zVal = linearizeDepth(depth); return (1 / (1 + exp(-steepness * (zVal - offset)))); } void main() { float depth = logisticDepth(gl_FragCoord.z, 0.5f, 4.0f); FragColor = texture(skybox, texCoords) * (1.0f - depth) + vec4(depth * vec3(5.0f/255.0f, 35.0f/255.0f, 95.0f/255.0f), 1.0f); }