Made samples per bucket configurable.
This commit is contained in:
parent
bb4e57795f
commit
0e8d708ff0
|
@ -40,6 +40,11 @@ class RenderPsychopathSettingsScene(PropertyGroup):
|
||||||
min=1, max=65536, default=16
|
min=1, max=65536, default=16
|
||||||
)
|
)
|
||||||
|
|
||||||
|
max_samples_per_bucket = IntProperty(
|
||||||
|
name="Max Samples Per Bucket", description="How many samples to simultaneously calculate per thread; indirectly determines bucket size",
|
||||||
|
min=1, max=2**28, soft_max=2**16, default=4096
|
||||||
|
)
|
||||||
|
|
||||||
dicing_rate = FloatProperty(
|
dicing_rate = FloatProperty(
|
||||||
name="Dicing Rate", description="The target microgeometry width in pixels",
|
name="Dicing Rate", description="The target microgeometry width in pixels",
|
||||||
min=0.0001, max=100.0, soft_min=0.125, soft_max=1.0, default=0.25
|
min=0.0001, max=100.0, soft_min=0.125, soft_max=1.0, default=0.25
|
||||||
|
|
|
@ -49,7 +49,7 @@ class PsychopathRender(bpy.types.RenderEngine):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# TODO: figure out command line options
|
# TODO: figure out command line options
|
||||||
args = ["-i", psy_filepath]
|
args = ["--spb", str(scene.psychopath.max_samples_per_bucket), "-i", psy_filepath]
|
||||||
|
|
||||||
# Start Rendering!
|
# Start Rendering!
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -46,6 +46,9 @@ class RENDER_PT_psychopath_render_settings(PsychopathPanel, bpy.types.Panel):
|
||||||
col.prop(scene.psychopath, "shutter_start")
|
col.prop(scene.psychopath, "shutter_start")
|
||||||
col.prop(scene.psychopath, "shutter_end")
|
col.prop(scene.psychopath, "shutter_end")
|
||||||
|
|
||||||
|
col.label(text="Performance")
|
||||||
|
col.prop(scene.psychopath, "max_samples_per_bucket")
|
||||||
|
|
||||||
|
|
||||||
class RENDER_PT_psychopath_export_settings(PsychopathPanel, bpy.types.Panel):
|
class RENDER_PT_psychopath_export_settings(PsychopathPanel, bpy.types.Panel):
|
||||||
bl_label = "Export Settings"
|
bl_label = "Export Settings"
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -72,6 +72,7 @@ Usage:
|
||||||
Options:
|
Options:
|
||||||
-i <file>, --input <file> Input .psy file.
|
-i <file>, --input <file> Input .psy file.
|
||||||
-s <n>, --spp <n> Number of samples per pixel.
|
-s <n>, --spp <n> Number of samples per pixel.
|
||||||
|
-b <n>, --spb <n> Maxmimum number of samples per bucket (determines bucket size).
|
||||||
-t <n>, --threads <n> Number of threads to render with. Defaults
|
-t <n>, --threads <n> Number of threads to render with. Defaults
|
||||||
to the number of logical cores on the system.
|
to the number of logical cores on the system.
|
||||||
--dev Show useful dev/debug info.
|
--dev Show useful dev/debug info.
|
||||||
|
@ -83,6 +84,7 @@ Options:
|
||||||
struct Args {
|
struct Args {
|
||||||
flag_input: Option<String>,
|
flag_input: Option<String>,
|
||||||
flag_spp: Option<usize>,
|
flag_spp: Option<usize>,
|
||||||
|
flag_spb: Option<usize>,
|
||||||
flag_threads: Option<usize>,
|
flag_threads: Option<usize>,
|
||||||
flag_dev: bool,
|
flag_dev: bool,
|
||||||
flag_version: bool,
|
flag_version: bool,
|
||||||
|
@ -141,6 +143,12 @@ fn main() {
|
||||||
r.spp = spp;
|
r.spp = spp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let max_samples_per_bucket = if let Some(max_samples_per_bucket) = args.flag_spb {
|
||||||
|
max_samples_per_bucket as u32
|
||||||
|
} else {
|
||||||
|
4096
|
||||||
|
};
|
||||||
|
|
||||||
let thread_count = if let Some(threads) = args.flag_threads {
|
let thread_count = if let Some(threads) = args.flag_threads {
|
||||||
threads as u32
|
threads as u32
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,7 +158,7 @@ fn main() {
|
||||||
println!("\tBuilt scene in {:.3}s", t.tick());
|
println!("\tBuilt scene in {:.3}s", t.tick());
|
||||||
|
|
||||||
println!("Rendering scene with {} threads...", thread_count);
|
println!("Rendering scene with {} threads...", thread_count);
|
||||||
let mut image = r.render(thread_count);
|
let mut image = r.render(max_samples_per_bucket, thread_count);
|
||||||
println!("\tRendered scene in {:.3}s", t.tick());
|
println!("\tRendered scene in {:.3}s", t.tick());
|
||||||
|
|
||||||
println!("Writing image to disk...");
|
println!("Writing image to disk...");
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub struct Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Renderer {
|
impl Renderer {
|
||||||
pub fn render(&self, thread_count: u32) -> Image {
|
pub fn render(&self, max_samples_per_bucket: u32, thread_count: u32) -> Image {
|
||||||
let mut tpool = Pool::new(thread_count);
|
let mut tpool = Pool::new(thread_count);
|
||||||
|
|
||||||
let image = Image::new(self.resolution.0, self.resolution.1);
|
let image = Image::new(self.resolution.0, self.resolution.1);
|
||||||
|
@ -174,12 +174,10 @@ impl Renderer {
|
||||||
print!("0.00%");
|
print!("0.00%");
|
||||||
let _ = io::stdout().flush();
|
let _ = io::stdout().flush();
|
||||||
|
|
||||||
// Determine bucket size based on a target number of samples
|
// Determine bucket size based on the per-thread maximum number of samples to
|
||||||
// per bucket.
|
// calculate at a time.
|
||||||
// TODO: make target samples per bucket configurable
|
|
||||||
let target_samples_per_bucket = 1usize << 12;
|
|
||||||
let (bucket_w, bucket_h) = {
|
let (bucket_w, bucket_h) = {
|
||||||
let target_pixels_per_bucket = target_samples_per_bucket as f64 / self.spp as f64;
|
let target_pixels_per_bucket = max_samples_per_bucket as f64 / self.spp as f64;
|
||||||
let target_bucket_dim = if target_pixels_per_bucket.sqrt() < 1.0 {
|
let target_bucket_dim = if target_pixels_per_bucket.sqrt() < 1.0 {
|
||||||
1usize
|
1usize
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user