fix: skybox is not visible behind translucent blocks
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
#ifndef COMMONS_GLSL_
|
||||
#define COMMONS_GLSL_
|
||||
#include <constants>
|
||||
|
||||
vec3 pick_sky_color(samplerCube cubemap) {
|
||||
vec3 skyLightColor = texture(cubemap, vec3(0.4f, 0.0f, 0.4f)).rgb;
|
||||
skyLightColor *= SKY_LIGHT_TINT;
|
||||
skyLightColor = min(vec3(1.0f), skyLightColor * SKY_LIGHT_MUL);
|
||||
skyLightColor = max(MIN_SKY_LIGHT, skyLightColor);
|
||||
return skyLightColor;
|
||||
}
|
||||
#include <constants>
|
||||
|
||||
vec3 apply_planet_curvature(vec3 modelPos, vec3 pos3d) {
|
||||
modelPos.y -= pow(length(pos3d.xz) * CURVATURE_FACTOR, 3.0f);
|
||||
|
||||
@@ -6,6 +6,11 @@ float calc_torch_light(vec3 normal, vec3 modelpos) {
|
||||
* max(0.0, -dot(normal, normalize(modelpos - u_cameraPos)));
|
||||
}
|
||||
|
||||
vec3 calc_torch_light(vec3 light, vec3 normal, vec3 modelpos, vec3 torchLightColor, float gamma) {
|
||||
float torchlight = calc_torch_light(normal, modelpos);
|
||||
return pow(light + torchlight * torchLightColor, vec3(gamma));
|
||||
}
|
||||
|
||||
vec3 calc_screen_normal(vec3 normal) {
|
||||
return transpose(inverse(mat3(u_view * u_model))) * normal;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef COMMONS_SKY_
|
||||
#define COMMONS_SKY_
|
||||
|
||||
#include <constants>
|
||||
|
||||
vec3 pick_sky_color(samplerCube cubemap) {
|
||||
vec3 skyLightColor = texture(cubemap, vec3(0.4f, 0.0f, 0.4f)).rgb;
|
||||
skyLightColor *= SKY_LIGHT_TINT;
|
||||
skyLightColor = min(vec3(1.0f), skyLightColor * SKY_LIGHT_MUL);
|
||||
skyLightColor = max(MIN_SKY_LIGHT, skyLightColor);
|
||||
return skyLightColor;
|
||||
}
|
||||
|
||||
#endif // COMMONS_SKY_
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef GLSL_WORLD_FRAGMENT_HEADER_
|
||||
#define GLSL_WORLD_FRAGMENT_HEADER_
|
||||
|
||||
in float a_distance;
|
||||
in float a_fog;
|
||||
in vec2 a_texCoord;
|
||||
in vec3 a_dir;
|
||||
in vec3 a_normal;
|
||||
in vec3 a_position;
|
||||
in vec3 a_realnormal;
|
||||
in vec3 a_skyLight;
|
||||
in vec4 a_modelpos;
|
||||
in float a_emission;
|
||||
|
||||
#include <world_uniforms>
|
||||
|
||||
#endif // GLSL_WORLD_FRAGMENT_HEADER_
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef GLSL_WORLD_UNIFORMS_
|
||||
#define GLSL_WORLD_UNIFORMS_
|
||||
|
||||
uniform mat4 u_model;
|
||||
uniform mat4 u_proj;
|
||||
uniform mat4 u_view;
|
||||
uniform vec3 u_cameraPos;
|
||||
uniform float u_gamma;
|
||||
uniform float u_opacity;
|
||||
uniform float u_timer;
|
||||
uniform samplerCube u_skybox;
|
||||
uniform vec3 u_torchlightColor;
|
||||
uniform float u_torchlightDistance;
|
||||
|
||||
#endif // GLSL_WORLD_UNIFORMS_
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef GLSL_WORLD_VERTEX_HEADER_
|
||||
#define GLSL_WORLD_VERTEX_HEADER_
|
||||
|
||||
out float a_distance;
|
||||
out float a_fog;
|
||||
out vec2 a_texCoord;
|
||||
out vec3 a_dir;
|
||||
out vec3 a_normal;
|
||||
out vec3 a_position;
|
||||
out vec3 a_realnormal;
|
||||
out vec3 a_skyLight;
|
||||
out vec4 a_modelpos;
|
||||
out float a_emission;
|
||||
|
||||
#include <world_uniforms>
|
||||
|
||||
#endif // GLSL_WORLD_VERTEX_HEADER_
|
||||
Reference in New Issue
Block a user