Give Java packs' full-screen passes Iris's sky, eye light and custom uniforms

Complementary Unbound drew clouds and light shafts inside terrain and a
second sun because the full-screen passes got wrong inputs:

- eyeBrightness was a constant (0, 240), so packs saw open sky
  underground. It is now the block and sky light of the camera entity's
  eye block (CommonUniforms.getEyeBrightness), and eyeBrightnessSmooth
  follows it with the pack's eyeBrightnessHalflife (SmoothedFloat).
- Custom uniforms (uniform.* / variable.* in shaders.properties) were all
  0: Complementary's eyeBrightnessM, isEyeInCave, starter, framemod8 and
  the rest. horizon-shaderpack's uniforms.rs parses and evaluates them
  each frame like Iris (stareval priorities, IrisFunctions, SmoothFloat).
- sunPosition, moonPosition, shadowLightPosition, sunAngle and
  shadowAngle now follow CelestialUniforms: the sky's sun and moon angles
  turned by Y -90, the pack's sunPathRotation about Z, then the angle. The
  old sun vector pointed north-south instead of east-west.
- While a Java pack runs, sunPathRotation tilts Horizon's sun, moon and
  stars as Iris tilts vanilla's, and clouds = off | fast | fancy, sun and
  moon = false apply. Complementary and Sildur's set clouds = off; the
  vanilla clouds Horizon drew anyway wrote depth the packs' light shafts
  and fog took for terrain.

Fixes #944

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-19 12:56:50 +02:00
parent 572addb2ff
commit 0431f12a6f
12 changed files with 1239 additions and 40 deletions
+19 -2
View File
@@ -6,8 +6,10 @@
//! `shadow`) don't run yet: the world is drawn by Horizon.
use horizon_shaderpack::{
JavaPack,
pipeline::{Program, TargetSettings},
pipeline::{Directives, Program, TargetSettings},
preprocess::Environment,
properties::SkyDirectives,
uniforms::CustomUniforms,
};
use std::{
collections::{BTreeMap, BTreeSet},
@@ -28,11 +30,17 @@ pub struct JavaFolder {
pub final_pass: Option<Program>,
/// The targets whose alternate side holds the frame's last write.
pub flipped_at_end: BTreeSet<u32>,
/// `sunPathRotation` and `eyeBrightnessHalflife`.
pub directives: Directives,
}
/// A loaded Java pack.
pub struct JavaPasses {
pub folders: Vec<JavaFolder>,
/// `uniform.*` / `variable.*` from `shaders.properties`.
pub uniforms: CustomUniforms,
/// What the pack keeps of the vanilla sky (`clouds`, `sun`, `moon`).
pub sky: SkyDirectives,
}
impl JavaPasses {
@@ -122,12 +130,21 @@ pub fn load(
flipped_after_prepare: plan.flipped_after_prepare,
final_pass,
flipped_at_end: plan.flipped_at_end,
directives: plan.directives,
});
}
if folders.is_empty() {
return Err("no deferred, composite or final programs".into());
}
Ok(JavaPasses { folders })
let uniforms = properties.custom_uniforms();
for problem in &uniforms.problems {
log::warn!("Horizon: shader pack custom uniform {problem}");
}
Ok(JavaPasses {
folders,
uniforms,
sky: properties.sky(),
})
}
#[cfg(test)]