wahn/rs_pbrt

Progressive render preview

therealprof opened this issue · 6 comments

It would be great to have a rendering preview to show progress and allow to verify the whether the result is going to meet the expectations before the rendering is finished and written to file.

I did something like this at some point in rustracer. I should dig it up and see if I can port it over maybe.

wahn commented

I agree, it would be nice ...

For now some of the executables have options to control/overwrite at least the pixel samples:

> ./target/release/examples/parse_blend_file --help
pbrt 0.6.1
Jan Walter <jan@janwalter.com>
Parse a Blender scene file and render it.

USAGE:
    parse_blend_file [OPTIONS] <path>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -c, --camera_name <camera_name>    camera name
    -i, --integrator <integrator>      ao, directlighting, path, bdpt, mlt
    -l, --light_scale <light_scale>    global light scaling [default: 1.0]
    -s, --samples <samples>            pixel samples [default: 1]

ARGS:
    <path>    The path to the file to read

See also:

https://www.rs-pbrt.org/blog/v0-6-1-release-notes/

Maybe I should allow to control/overwrite the pixel samples as well for rs_pbrt? In parse_blend_file I switched to the structopt crate (as mentioned in cli book), but the two older executables (rs_pbrt and parse_ass_file) still use the getopts crate.

For now I only focused on command line rendering, a proper integration into Blender would be even nicer ;-)

I guess to implement this the structure needs to be changed around a bit so instead of collecting all tiles at the end of the rendering there should be another thread which receives all tiles, optionally rendering them.

I've been researching simple possibilities to render into a canvas in a cross-platform way without adding dozens of crates to the compilation. The most promising approach so far seems to be https://crates.io/crates/minifb .

wahn commented

Hm, looks nice, the latest commits do build, but the cargo run --example noise panics (for me). Moving to the latest release tag, it does not even compile (for me):

> git checkout v0.8.3
> cargo build
   Compiling minifb v0.8.3 (/mill3d/users/jan/git/github/rust_minifb)
error: failed to run custom build command for `minifb v0.8.3 (/mill3d/users/jan/git/github/rust_minifb)`
process didn't exit successfully: `/mill3d/users/jan/git/github/rust_minifb/target/debug/build/minifb-bccbd7ac3176e244/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-o" "/mill3d/users/jan/git/github/rust_minifb/target/debug/build/minifb-d9941c3ad9a8336d/out/src/native/x11/X11MiniFB.o" "-c" "src/native/x11/X11MiniFB.c"
cargo:warning=src/native/x11/X11MiniFB.c:4:33: fatal error: X11/Xcursor/Xcursor.h: No such file or directory
cargo:warning= #include <X11/Xcursor/Xcursor.h>
cargo:warning=                                 ^
cargo:warning=compilation terminated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-o" "/mill3d/users/jan/git/github/rust_minifb/target/debug/build/minifb-d9941c3ad9a8336d/out/src/native/x11/X11MiniFB.o" "-c" "src/native/x11/X11MiniFB.c" with args "cc" did not execute successfully (status code exit code: 1).

', /usr/people/jan/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.55/src/lib.rs:1672:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

I guess I need to install a couple of developer libraries and headers ...

wahn commented

Same on my laptop (running Debian instead of CentOS) ...

wahn commented

See project 3 ...