Actually use seed in renders.
This is important for animations, where you don't want the same noise pattern every frame.
This commit is contained in:
parent
e4f9a54e48
commit
c2eb421fd8
|
@ -87,6 +87,7 @@ pub fn parse_scene(tree: &DataTree) -> Result<Renderer, PsyParseError> {
|
||||||
output_file: output_info.clone(),
|
output_file: output_info.clone(),
|
||||||
resolution: ((render_settings.0).0 as usize, (render_settings.0).1 as usize),
|
resolution: ((render_settings.0).0 as usize, (render_settings.0).1 as usize),
|
||||||
spp: render_settings.1 as usize,
|
spp: render_settings.1 as usize,
|
||||||
|
seed: render_settings.2,
|
||||||
scene: scene,
|
scene: scene,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ pub struct Renderer {
|
||||||
pub output_file: String,
|
pub output_file: String,
|
||||||
pub resolution: (usize, usize),
|
pub resolution: (usize, usize),
|
||||||
pub spp: usize,
|
pub spp: usize,
|
||||||
|
pub seed: u32,
|
||||||
pub scene: Scene,
|
pub scene: Scene,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,10 +83,10 @@ impl Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate rays
|
// Generate light paths and initial rays
|
||||||
for y in bucket.y..(bucket.y + bucket.h) {
|
for y in bucket.y..(bucket.y + bucket.h) {
|
||||||
for x in bucket.x..(bucket.x + bucket.w) {
|
for x in bucket.x..(bucket.x + bucket.w) {
|
||||||
let offset = hash_u32(((x as u32) << 16) ^ (y as u32), 0);
|
let offset = hash_u32(((x as u32) << 16) ^ (y as u32), self.seed);
|
||||||
for si in 0..self.spp {
|
for si in 0..self.spp {
|
||||||
// Calculate image plane x and y coordinates
|
// Calculate image plane x and y coordinates
|
||||||
let (img_x, img_y) = {
|
let (img_x, img_y) = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user