#version 410 core out vec4 FragColor; in vec3 TexCoords; uniform samplerCube skybox; float near = 0.02f; float far = 100.0f; 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.1f, 3.0f); FragColor = texture(skybox, TexCoords)* (1.0f - depth) + vec4(depth * vec3(0.0f, 0.109f, 0.447f), 1.0f); }