Merge branch 'bafon/voxel-transparency' into 'master'

Fix voxel transparency

See merge request veloren/veloren!2885
This commit is contained in:
Imbris 2021-09-28 04:44:29 +00:00
commit 44e526fbcc

View File

@ -1,6 +1,6 @@
use common::{
figure::Segment,
util::{linear_to_srgba, srgba_to_linear},
util::{linear_to_srgba, srgb_to_linear},
vol::{IntoFullVolIterator, ReadVol, SizedVol, Vox},
};
use euc::{buffer::Buffer2d, rasterizer, Pipeline};
@ -97,12 +97,10 @@ impl<'a> Pipeline for Voxel {
let ambiance = 0.25;
let diffuse = norm.dot(-self.light_dir).max(0.0);
let brightness = 2.5;
let light = Rgba::from_opaque(Rgb::from(*ao_level as f32 / 4.0))
* (diffuse + ambiance)
* brightness;
let color = light * srgba_to_linear(Rgba::from_opaque(*col));
let light = Rgb::from(*ao_level as f32 / 4.0) * (diffuse + ambiance) * brightness;
let color = light * srgb_to_linear(*col);
let position = (self.mvp * Vec4::from_point(*pos)).into_array();
(position, VsOut(color))
(position, VsOut(Rgba::from_opaque(color)))
}
#[inline(always)]