2022-01-27 23:56:43 +01:00
|
|
|
#version 410 core
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 vertexPosition;
|
|
|
|
layout(location = 1) in vec2 vertexTexCoord;
|
|
|
|
layout(location = 2) in vec3 vertexNormal;
|
|
|
|
|
|
|
|
uniform mat4 modelViewProjectionMatrix;
|
|
|
|
uniform mat4 modelMatrix;
|
|
|
|
|
2022-02-02 00:25:38 +01:00
|
|
|
uniform vec3 cameraPos;
|
|
|
|
|
2022-01-27 23:56:43 +01:00
|
|
|
out vec3 interpNormal;
|
|
|
|
out vec2 interpTexCoord;
|
|
|
|
|
2022-02-13 01:51:44 +01:00
|
|
|
|
2022-02-02 00:25:38 +01:00
|
|
|
out float visibility;
|
2022-02-13 01:51:44 +01:00
|
|
|
const float density = 0.0050;
|
2022-02-02 00:25:38 +01:00
|
|
|
const float gradient = 2.0;
|
|
|
|
|
2022-01-27 23:56:43 +01:00
|
|
|
void main()
|
|
|
|
{
|
|
|
|
gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0);
|
|
|
|
interpNormal = (modelMatrix * vec4(vertexNormal, 0.0)).xyz;
|
|
|
|
interpTexCoord = vertexTexCoord;
|
2022-02-02 00:25:38 +01:00
|
|
|
|
|
|
|
float distance = length(gl_Position);
|
|
|
|
visibility = exp(-pow((distance*density),gradient));
|
|
|
|
visibility = clamp(visibility,0.0,1.0);
|
|
|
|
|
2022-01-27 23:56:43 +01:00
|
|
|
}
|