tylermorganwall / rayrender

A pathtracer for R. Build and render complex scenes and 3D data visualizations directly from R
http://www.rayrender.net
622 stars 42 forks source link

high quality rendering insensitive to sample count #40

Closed austinorr closed 1 year ago

austinorr commented 1 year ago

I've been exploring this tool for the last few days, especially wrt to rayshader and rendering landscapes. Thank you for this great tool!

I've noticed that I am unable to recreate images of the same high quality as some of your examples, including simple ones.

I'm running this on windows

>r --version
R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

with the following package versions

rayimage       "rayimage"       "0.7.3"                 
rayrender      "rayrender"      "0.28.8"     
rayshader      "rayshader"      "0.32.0"     
rayvertex      "rayvertex"      "0.4.15"     

The behavior I'm seeing is that the quality of the rendering is completely insensitive to the samples argument. The script below produces non-identical images, but both contain the same amount of noise.

library("rayrender")

scene <- sphere(
    y = -1001,
    radius = 1000,
    material = diffuse(
        color = "#ccff00",
        checkercolor = "grey50"
    )
) %>%
    add_object(sphere(material = diffuse(color = "#dd4444"))) %>%
    add_object(sphere(z = -2, material = metal())) %>%
    add_object(sphere(z = 2, material = dielectric()))

render_scene(
    scene,
    filename = "256_ray_render.png",
    samples = 256,
    width = 500,
    height = 500,
    fov = 40,
    lookfrom = c(12, 4, 0),
    verbose = T
)

render_scene(
    scene,
    filename = "100000_ray_render.png",
    samples = 100000,
    width = 500,
    height = 500,
    fov = 40,
    lookfrom = c(12, 4, 0),
    verbose = T
)

I've tried running this with the verbose argument and it's apparent that the script is spending significantly more time rendering the high-count version, 22 seconds vs 147 seconds, but the files saved to disk are of equal quality.

here's a portion of the 256 count: image

and a portion of the 100k count: image

Any insight on how to reproduce your high quality rendering on your documentation would be much appreciated! Thanks again for your efforts on this awesome tool.

austinorr commented 1 year ago

Closing this -- I have explored other parameters a bit further and realized that the min_variance is the real 'dial' for the image quality. I'm getting great renders now!

Thanks again.