Fog range changed to 0..1
This commit is contained in:
parent
4d9e43bf03
commit
b89ee052c5
@ -248,24 +248,20 @@ uniform float u_fog;
|
||||
#include <commons>
|
||||
|
||||
void main() {
|
||||
|
||||
|
||||
vec3 camera_position = vec3(0.0f, PLANET_RADIUS+1.0f, 0.0f);
|
||||
vec3 camera_vector = normalize(u_xaxis * v_coord.x*1.005 +
|
||||
u_yaxis * -v_coord.y*1.005 -
|
||||
u_zaxis);
|
||||
|
||||
camera_vector = mix(camera_vector, vec3(0, 1, 0), min(1.0, u_fog-1.0));
|
||||
float fog = 1.0f / u_fog;
|
||||
camera_vector = mix(camera_vector, vec3(0, 1, 0), min(1.0, u_fog));
|
||||
|
||||
float fog = 1.0f / (u_fog + 1.0);
|
||||
// hide darkness at horizon
|
||||
camera_vector.y = max(0.01, camera_vector.y)*(1.0-u_mie*0.08) + 0.08*u_mie;
|
||||
camera_vector = normalize(camera_vector);
|
||||
|
||||
// the color of this pixel
|
||||
vec3 col = vec3(0.0);//scene.xyz;
|
||||
|
||||
|
||||
|
||||
// get the atmosphere color
|
||||
col += calculate_scattering(
|
||||
camera_position, // the position of the camera
|
||||
|
||||
@ -86,7 +86,7 @@ void Skybox::refresh(float t, float mie, uint quality) {
|
||||
|
||||
shader->uniform1i("u_quality", quality);
|
||||
shader->uniform1f("u_mie", mie);
|
||||
shader->uniform1f("u_fog", mie);
|
||||
shader->uniform1f("u_fog", mie - 1.0f);
|
||||
shader->uniform3f("u_lightDir", glm::normalize(vec3(sin(t), -cos(t), -0.7f)));
|
||||
for (uint face = 0; face < 6; face++) {
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, cubemap, 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user