Added the delta-tooling
This commit is contained in:
1 parent
cc70cea7f6
commit
a3f62301f4
5 files changed
+470
-10
No files matched your search
@@ -75,6 +75,10 @@ struct RenderArgs {
|
||||
/// give the same image.
|
||||
#[arg(long, default_value_t = 0)]
|
||||
frame: u64,
|
||||
/// From camera C1: leave out the detector's noise, dark current and fixed pattern
|
||||
/// (saturation and blooming stay), so renders differ only where their light does.
|
||||
#[arg(long)]
|
||||
noiseless: bool,
|
||||
/// From camera C2: how far in pixels the PSF must reach from a point (default 16).
|
||||
/// The FFT grid grows to hold it, and the PSF then reaches as far as the grid
|
||||
/// allows: 64 px at 1920 x 1080 and 2 x 2 supersampling, up to 1088 px at 1 x 1.
|
||||
@@ -169,7 +173,10 @@ fn render(args: &RenderArgs) -> Result<(), String> {
|
||||
let path = args.scene.as_path();
|
||||
let file = SceneFile::read(path)?;
|
||||
let dir = path.parent().unwrap_or(Path::new("."));
|
||||
let camera = file.camera(dir)?;
|
||||
let mut camera = file.camera(dir)?;
|
||||
if args.noiseless {
|
||||
camera.detector = camera.detector.noiseless();
|
||||
}
|
||||
|
||||
// What the tiers need, gathered before the renderer exists so it can check them.
|
||||
let start = Instant::now();
|
||||
|
||||
@@ -120,6 +120,41 @@ fn example_scene_on_gpu_and_cpu() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn noiseless_renders_do_not_depend_on_the_seed() {
|
||||
let render = |seed: &str, noiseless: bool| {
|
||||
let out = out_dir().join(format!("noiseless-{seed}-{noiseless}.png"));
|
||||
let mut args = vec![
|
||||
"render",
|
||||
"--scene",
|
||||
"examples/scenes/boxwing.toml",
|
||||
"--adapter",
|
||||
"gpu",
|
||||
"--camera",
|
||||
"C1",
|
||||
"--seed",
|
||||
seed,
|
||||
"--out",
|
||||
out.to_str().unwrap(),
|
||||
];
|
||||
if noiseless {
|
||||
args.push("--noiseless");
|
||||
}
|
||||
let result = resolved(&args);
|
||||
assert!(
|
||||
result.status.success(),
|
||||
"{}",
|
||||
String::from_utf8_lossy(&result.stderr)
|
||||
);
|
||||
image::open(&out).unwrap().into_rgb16()
|
||||
};
|
||||
assert_ne!(render("1", false), render("2", false));
|
||||
let quiet = render("1", true);
|
||||
assert_eq!(quiet, render("2", true));
|
||||
// Empty space reads exactly the bias, with no dark current or read noise.
|
||||
assert_eq!(quiet.get_pixel(0, 0).0, [64 << 4; 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pretty_previews_lift_the_darks_and_leave_space_black() {
|
||||
let preview = |pretty: bool| {
|
||||
|
||||
Reference in new issue
Block a user