płynne przejscie planetoid

This commit is contained in:
mxsgd 2024-02-08 09:24:56 +01:00
parent 41e8ffc696
commit 37aa8e0c99
2 changed files with 9 additions and 6 deletions

View File

@ -1,9 +1,9 @@
#version 430 core #version 430 core
float AMBIENT = 0.6; float AMBIENT = 0.4;
float roughness; float roughness;
float metalic; float metalic;
float MAX_DISTANCE = 12.0;
uniform vec3 color; uniform vec3 color;
uniform sampler2D colorTexture; uniform sampler2D colorTexture;
@ -17,7 +17,7 @@ in vec2 vecTex;
in vec3 viewDirTS; in vec3 viewDirTS;
in vec3 lightDirTS; in vec3 lightDirTS;
in float distanceToCamera;
out vec4 outColor; out vec4 outColor;
void main() void main()
@ -57,7 +57,10 @@ void main()
vec3 BRDF = kD*(textureColor/3.1458493) + specular; vec3 BRDF = kD*(textureColor/3.1458493) + specular;
if (distanceToCamera > MAX_DISTANCE)
{
discard;
}

View File

@ -17,7 +17,7 @@ uniform vec3 cameraPos;
out vec3 viewDirTS; out vec3 viewDirTS;
out vec3 lightDirTS; out vec3 lightDirTS;
out float distanceToCamera;
mat3 TBN; mat3 TBN;
@ -42,6 +42,6 @@ void main()
vecTex = vertexTexCoord; vecTex = vertexTexCoord;
vecTex.y = 1.0 - vecTex.y; vecTex.y = 1.0 - vecTex.y;
distanceToCamera = length(worldPos - cameraPos);
gl_Position = transformation * vec4(vertexPosition, 1.0); gl_Position = transformation * vec4(vertexPosition, 1.0);
} }