GRK-Projekt/grafika_projekt/shaders/skybox.frag

29 lines
748 B
GLSL
Raw Normal View History

2021-12-26 21:36:32 +01:00
#version 410 core
out vec4 FragColor;
in vec3 TexCoords;
uniform samplerCube skybox;
2022-01-08 15:59:37 +01:00
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))));
}
2021-12-26 21:36:32 +01:00
void main()
{
2022-01-08 15:59:37 +01:00
float depth = logisticDepth(gl_FragCoord.z, 0.1f, 3.0f);
2022-01-17 16:20:48 +01:00
//FragColor = texture(skybox, TexCoords)* (1.0f - depth) + vec4(depth * vec3(0.0f, 0.109f, 0.447f), 1.0f);
//Odkomentowac jak sie nie chce mgly i zakomentowac wyzej (patrz shader_tex.frag tez)
FragColor = texture(skybox, TexCoords);
2021-12-26 21:36:32 +01:00
}