diff --git a/all-is-cubes-desktop/tests/end-to-end/output-path-with-graphics.stdout b/all-is-cubes-desktop/tests/end-to-end/output-path-with-graphics.stdout index 937297eef..4cab6fea6 100644 --- a/all-is-cubes-desktop/tests/end-to-end/output-path-with-graphics.stdout +++ b/all-is-cubes-desktop/tests/end-to-end/output-path-with-graphics.stdout @@ -1,5 +1,5 @@ -[?25l â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„ - â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„ +[?25l â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„ + â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„       diff --git a/all-is-cubes/src/block/evaluated.rs b/all-is-cubes/src/block/evaluated.rs index 814cf19c6..6acad7cc2 100644 --- a/all-is-cubes/src/block/evaluated.rs +++ b/all-is-cubes/src/block/evaluated.rs @@ -7,7 +7,7 @@ use euclid::Vector3D; use ordered_float::NotNan; use crate::content::palette; -use crate::math::{Cube, Face6, FaceMap, GridAab, OpacityCategory, Rgb, Rgba, Vol}; +use crate::math::{Cube, Face6, Face7, FaceMap, GridAab, OpacityCategory, Rgb, Rgba, Vol}; use crate::raytracer; use crate::universe::RefError; use crate::{ @@ -314,6 +314,13 @@ impl EvaluatedBlock { self.voxels.bounds() } + pub(crate) fn face7_color(&self, face: Face7) -> Rgba { + match Face6::try_from(face) { + Ok(face) => self.face_colors[face], + Err(_) => self.color, + } + } + /// Expresses the opacity of the block as an [`OpacityCategory`]. /// /// If the return value is [`OpacityCategory::Partial`], this does not necessarily mean diff --git a/all-is-cubes/src/space/light/updater.rs b/all-is-cubes/src/space/light/updater.rs index 82cec267a..f00a6c50f 100644 --- a/all-is-cubes/src/space/light/updater.rs +++ b/all-is-cubes/src/space/light/updater.rs @@ -688,7 +688,8 @@ impl LightBuffer { } let stored_light = current_light.get(light_cube); - let surface_color = ev_hit.color.clamp().to_rgb() * SURFACE_ABSORPTION + let surface_color = ev_hit.face7_color(hit.face()).clamp().to_rgb() + * SURFACE_ABSORPTION + Rgb::ONE * (1. - SURFACE_ABSORPTION); let light_from_struck_face = ev_hit.light_emission + stored_light.value() * surface_color; @@ -728,7 +729,11 @@ impl LightBuffer { // as opposed to passing through it. // The block evaluation algorithm incidentally computes a suitable // approximation as an alpha value. - let coverage = ev_hit.color.alpha().into_inner().clamp(0.0, 1.0); + let coverage = ev_hit + .face7_color(hit.face()) + .alpha() + .into_inner() + .clamp(0.0, 1.0); self.incoming_light += (ev_hit.light_emission + stored_light) * coverage * ray_state.alpha diff --git a/test-renderers/expected/icons-all.png b/test-renderers/expected/icons-all.png index 49858a629..fec36c954 100644 Binary files a/test-renderers/expected/icons-all.png and b/test-renderers/expected/icons-all.png differ