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(),
|
||||
resolution: ((render_settings.0).0 as usize, (render_settings.0).1 as usize),
|
||||
spp: render_settings.1 as usize,
|
||||
seed: render_settings.2,
|
||||
scene: scene,
|
||||
};
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ pub struct Renderer {
|
|||
pub output_file: String,
|
||||
pub resolution: (usize, usize),
|
||||
pub spp: usize,
|
||||
pub seed: u32,
|
||||
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 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 {
|
||||
// Calculate image plane x and y coordinates
|
||||
let (img_x, img_y) = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user