Closed define-private-public closed 1 year ago
I would first install R/RStudio (which has the best dev environment for R currently):
https://www.r-project.org https://rstudio.com
You will have to install RTools if you are on windows to install from source:
https://cran.r-project.org/bin/windows/Rtools/
And then follow the instructions on the README to install rayrender from the latest source:
install.packages("remotes")
remotes::install_github("tylermorganwall/rayrender")
library(rayrender)
There are lots of example scenes in the documentation--see the package website (click functions and then look at individual function docs for examples):
When this project builds for release, what flags does it supply to the compiler? And what compiler (and version) does it use?
I tried doing the remotes::install_github("tylermorganwall/rayrender")
, but was met with the following error:
Error: Failed to install 'rayrender' from GitHub:
(converted from warning) package ‘raster’ is not available (for R version 3.4.4)
I'm running on the R/RStudio for Ubuntu 18.04.
Is there some way to use the rendering engine directly from C++ instead of doing it through R?
I would download a newer version of R first (at least 3.6.3)—3.4.4 is fairly old at this point. The raster package should be available for newer versions: type install.packages("raster")
before trying to install rayrender.
The scene construction routine is tightly coupled to the underlying R C API, so it would be difficult to separate them.
Hey, interested in pursuing this again.
On my Windows partition, I was able to get RStudio and rayrender working, along with one of the renders to well, render. Some questions:
Glad you got it working!
verbose = TRUE
in render_scene()
, it will return an overall breakdown of the rendering time. For a more consistent benchmark, install the microbenchmark
package:install.packages("microbenchmark")
library(microbenchmark)
microbenchmark({
...code goes here...
}, times=10
)
Thanks, I'll give that a try next.
The renders that are produced, are they fully deterministic? E.g. If I render one scene at 100x100 pixels, with 10 samples per pixel, then say, render it again. All generated pixels of the second render will match the first one by 100%? Or will there be some differences? What if I do the first render with one core, but then do the second render with 8?
I've never used idfiff
before, but it seems like something you could easy make a test suite with to compare renders vs. a reference.
https://openimageio.readthedocs.io/en/latest/idiff.html
To make it deterministic, you need to set a seed prior to running your code, e.g.
library(rayrender)
set.seed(1)
generate_cornell() %>% render_scene()
# This should result in the same image
set.seed(1)
generate_cornell() %>% render_scene()
Using a different number of cores will also result in a different image, since each thread will be seeded with its own independent seed.
The latest commits include a test directory. Install the testthat
package (via install.packages("testthat")
) and, after implementing your changes, run testthat::test_package("rayrender")
to detect any regressions/changes from your local branch. The tests aren't comprehensive, but they should be able to detect any significant changes in behavior.
Hi,
IIRC, this rendering is based off the code from the Peter Shirley ray tracing mini-books. I've recently finished running through the books myself. My implementation (I'm be publishing it soon) was much more performant and I'd like to contribute some of the changes to this project. I think it's really cool.
Though, I have next to zero experience with R. I have no idea where to get started. What the path of least resistance to be able to get rayrender up and running (from source)? And do you have any readily available scenes that I can render to do performance comparing?