Fix shadow creation.

This commit is contained in:
Joshua Yanovski 2020-07-12 19:50:26 +02:00
parent 6332cbe006
commit 6c31e6b562
6 changed files with 19 additions and 14 deletions

View File

@ -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);
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;
emitted_light *= ao;

View File

@ -81,6 +81,9 @@ float ShadowCalculationPoint(uint lightIndex, vec3 fragToLight, vec3 fragNorm, /
if (visibility <= 0.25) {
return 0.0;
} */
/* if (visibility < 1.0) {
return 0.0;
} */
return visibility == 1.0 ? 1.0 : 0.0;
}

View File

@ -30,8 +30,8 @@ uniform u_locals {
out vec4 tgt_color;
void main() {
tgt_color = vec4(MU_SCATTER, 1.0);
return;
// tgt_color = vec4(MU_SCATTER, 1.0);
// return;
vec4 _clouds;
vec3 cam_dir = normalize(f_pos - cam_pos.xyz);

View File

@ -246,7 +246,7 @@ void main() {
// Computing light attenuation from water.
vec3 emitted_light, reflected_light;
// 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);
reflected_light = vec3(1.0);

View File

@ -160,13 +160,15 @@ impl Renderer {
let dims = win_color_view.get_dimensions();
let mut shader_reload_indicator = ReloadIndicator::new();
let shadow_views = ShadowMapMode::try_from(mode.shadow).ok().and_then(|mode| {
Self::create_shadow_views(&mut factory, (dims.0, dims.1), &mode)
let shadow_views = Self::create_shadow_views(
&mut factory,
(dims.0, dims.1),
&ShadowMapMode::try_from(mode.shadow).unwrap_or(ShadowMapMode::default()),
)
.map_err(|err| {
warn!("Could not create shadow map views: {:?}", err);
})
.ok()
});
.ok();
let (
skybox_pipeline,

View File

@ -1,9 +1,9 @@
use core::{iter, mem};
use hashbrown::HashMap;
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_c::*, mat::repr_c::column_major::Mat4, ops::*,
// vec::repr_c::*};
// pub use vek::{geom::repr_simd::*, mat::repr_simd::column_major::Mat4, ops::*,
// vec::repr_simd::*};
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] {
[