mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed wall leaking with dynamic light ambiance
This commit is contained in:
parent
a037b48115
commit
6600b534c8
@ -1,5 +1,7 @@
|
|||||||
#version 330 core
|
#version 330 core
|
||||||
|
|
||||||
|
#define FIGURE_SHADER
|
||||||
|
|
||||||
#include <constants.glsl>
|
#include <constants.glsl>
|
||||||
|
|
||||||
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <constants.glsl>
|
#include <constants.glsl>
|
||||||
|
|
||||||
|
#define FIGURE_SHADER
|
||||||
|
|
||||||
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
||||||
|
|
||||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||||
|
@ -183,7 +183,11 @@ float lights_at(vec3 wpos, vec3 wnorm, vec3 /*cam_to_frag*/view_dir, vec3 mu, ve
|
|||||||
vec3 direct_light = PI * color * strength * square_factor * light_reflection_factor(/*direct_norm_dir*/wnorm, /*cam_to_frag*/view_dir, direct_light_dir, k_d, k_s, alpha, voxel_norm, voxel_lighting);
|
vec3 direct_light = PI * color * strength * square_factor * light_reflection_factor(/*direct_norm_dir*/wnorm, /*cam_to_frag*/view_dir, direct_light_dir, k_d, k_s, alpha, voxel_norm, voxel_lighting);
|
||||||
float computed_shadow = ShadowCalculationPoint(i, -difference, wnorm, wpos/*, light_distance*/);
|
float computed_shadow = ShadowCalculationPoint(i, -difference, wnorm, wpos/*, light_distance*/);
|
||||||
// directed_light += is_direct ? max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor : vec3(0.0);
|
// directed_light += is_direct ? max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor : vec3(0.0);
|
||||||
vec3 ambiance = color * 1.0 / distance_2; // Non-physical hack, but it's pretty subtle and *damn* does it make character shadows look better
|
#ifdef FIGURE_SHADER
|
||||||
|
vec3 ambiance = color * 0.5 / distance_2; // Non-physical hack, but it's pretty subtle and *damn* does it make shadows on characters look better
|
||||||
|
#else
|
||||||
|
vec3 ambiance = vec3(0.0);
|
||||||
|
#endif
|
||||||
directed_light += (is_direct ? mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor : vec3(0.0)) + ambiance;
|
directed_light += (is_direct ? mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor : vec3(0.0)) + ambiance;
|
||||||
// directed_light += (is_direct ? 1.0 : LIGHT_AMBIANCE) * max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor;// : vec3(0.0);
|
// directed_light += (is_direct ? 1.0 : LIGHT_AMBIANCE) * max(computed_shadow, /*LIGHT_AMBIANCE*/0.0) * direct_light * square_factor;// : vec3(0.0);
|
||||||
// directed_light += mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor;
|
// directed_light += mix(LIGHT_AMBIANCE, 1.0, computed_shadow) * direct_light * square_factor;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#version 330 core
|
#version 330 core
|
||||||
// #extension ARB_texture_storage : enable
|
// #extension ARB_texture_storage : enable
|
||||||
|
|
||||||
|
#define FIGURE_SHADER
|
||||||
|
|
||||||
#include <constants.glsl>
|
#include <constants.glsl>
|
||||||
|
|
||||||
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#version 330 core
|
#version 330 core
|
||||||
|
|
||||||
|
#define FIGURE_SHADER
|
||||||
|
|
||||||
#include <constants.glsl>
|
#include <constants.glsl>
|
||||||
|
|
||||||
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
||||||
|
@ -513,7 +513,7 @@ impl<V: RectRasterableVol> Terrain<V> {
|
|||||||
(e as i32).div_euclid(sz as i32)
|
(e as i32).div_euclid(sz as i32)
|
||||||
});
|
});
|
||||||
|
|
||||||
const AMBIANCE: f32 = 0.3; // 0-1, the proportion of light that should illuminate the rear of an object
|
const AMBIANCE: f32 = 0.15; // 0-1, the proportion of light that should illuminate the rear of an object
|
||||||
|
|
||||||
let (bias, total, max) = Spiral2d::new()
|
let (bias, total, max) = Spiral2d::new()
|
||||||
.take(9)
|
.take(9)
|
||||||
|
Loading…
Reference in New Issue
Block a user