mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix shadow creation.
This commit is contained in:
parent
6332cbe006
commit
6c31e6b562
@ -179,7 +179,7 @@ void main() {
|
|||||||
|
|
||||||
max_light += lights_at(f_pos, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light);
|
max_light += lights_at(f_pos, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light);
|
||||||
|
|
||||||
float ao = f_ao;//0.25 + f_ao * 0.75; ///*pow(f_ao, 0.5)*/f_ao * 0.85 + 0.15;
|
float ao = f_ao * sqrt(f_ao);//0.25 + f_ao * 0.75; ///*pow(f_ao, 0.5)*/f_ao * 0.85 + 0.15;
|
||||||
|
|
||||||
reflected_light *= ao;
|
reflected_light *= ao;
|
||||||
emitted_light *= ao;
|
emitted_light *= ao;
|
||||||
|
@ -81,6 +81,9 @@ float ShadowCalculationPoint(uint lightIndex, vec3 fragToLight, vec3 fragNorm, /
|
|||||||
if (visibility <= 0.25) {
|
if (visibility <= 0.25) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
} */
|
} */
|
||||||
|
/* if (visibility < 1.0) {
|
||||||
|
return 0.0;
|
||||||
|
} */
|
||||||
return visibility == 1.0 ? 1.0 : 0.0;
|
return visibility == 1.0 ? 1.0 : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ uniform u_locals {
|
|||||||
out vec4 tgt_color;
|
out vec4 tgt_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
tgt_color = vec4(MU_SCATTER, 1.0);
|
// tgt_color = vec4(MU_SCATTER, 1.0);
|
||||||
return;
|
// return;
|
||||||
vec4 _clouds;
|
vec4 _clouds;
|
||||||
|
|
||||||
vec3 cam_dir = normalize(f_pos - cam_pos.xyz);
|
vec3 cam_dir = normalize(f_pos - cam_pos.xyz);
|
||||||
|
@ -246,7 +246,7 @@ void main() {
|
|||||||
// Computing light attenuation from water.
|
// Computing light attenuation from water.
|
||||||
vec3 emitted_light, reflected_light;
|
vec3 emitted_light, reflected_light;
|
||||||
// To account for prior saturation
|
// To account for prior saturation
|
||||||
/*float */f_light = faces_fluid ? 1.0 : pow(f_light, 1.5);
|
/*float */f_light = faces_fluid ? 1.0 : f_light * sqrt(f_light);
|
||||||
|
|
||||||
emitted_light = vec3(1.0);
|
emitted_light = vec3(1.0);
|
||||||
reflected_light = vec3(1.0);
|
reflected_light = vec3(1.0);
|
||||||
|
@ -160,13 +160,15 @@ impl Renderer {
|
|||||||
let dims = win_color_view.get_dimensions();
|
let dims = win_color_view.get_dimensions();
|
||||||
|
|
||||||
let mut shader_reload_indicator = ReloadIndicator::new();
|
let mut shader_reload_indicator = ReloadIndicator::new();
|
||||||
let shadow_views = ShadowMapMode::try_from(mode.shadow).ok().and_then(|mode| {
|
let shadow_views = Self::create_shadow_views(
|
||||||
Self::create_shadow_views(&mut factory, (dims.0, dims.1), &mode)
|
&mut factory,
|
||||||
|
(dims.0, dims.1),
|
||||||
|
&ShadowMapMode::try_from(mode.shadow).unwrap_or(ShadowMapMode::default()),
|
||||||
|
)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("Could not create shadow map views: {:?}", err);
|
warn!("Could not create shadow map views: {:?}", err);
|
||||||
})
|
})
|
||||||
.ok()
|
.ok();
|
||||||
});
|
|
||||||
|
|
||||||
let (
|
let (
|
||||||
skybox_pipeline,
|
skybox_pipeline,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use core::{iter, mem};
|
use core::{iter, mem};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use num::traits::Float;
|
use num::traits::Float;
|
||||||
pub use vek::{geom::repr_simd::*, mat::repr_simd::column_major::Mat4, ops::*, vec::repr_simd::*};
|
// pub use vek::{geom::repr_simd::*, mat::repr_simd::column_major::Mat4, ops::*,
|
||||||
// pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*,
|
// vec::repr_simd::*};
|
||||||
// vec::repr_c::*};
|
pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*, vec::repr_c::*};
|
||||||
|
|
||||||
pub fn aabb_to_points<T: Float>(bounds: Aabb<T>) -> [Vec3<T>; 8] {
|
pub fn aabb_to_points<T: Float>(bounds: Aabb<T>) -> [Vec3<T>; 8] {
|
||||||
[
|
[
|
||||||
|
Loading…
Reference in New Issue
Block a user