tylermorganwall / rayrender

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

Documentation and/or handling of implicit_sample #9

Closed brodieG closed 4 years ago

brodieG commented 5 years ago

implicit_sample is documented as:

Default 'FALSE', unless the object is a light. If 'TRUE', the object will be sampled as part of the scattering probability density function.

I have no idea what this means, other than if implicit_sample is FALSE on a light it doesn't seem to light things very well. The following reprex suggests that the default is FALSE irrespective of whether the object is a light or not (where I interpret "being a light" meaning "lightintensity > 0"). If I don't explicitly set the parameter to TRUE I just get blackness.

I think the documented behavior is more desirable, FWIW. I hope I'm not being too annoying with all these issues. No need to fix on my account.

library(rayrender)
render_scene(width = 100, height = 100, samples=100,
  add_object(
    xy_rect(),
    sphere(y=5, z=5, material=diffuse(lightintensity=50))
) )

render_scene(width = 100, height = 100, samples=100,
  add_object(
    xy_rect(),
    sphere(y=5, z=5, material=diffuse(lightintensity=50, implicit_sample=TRUE))
) )

Created on 2019-11-11 by the reprex package (v0.3.0)

tylermorganwall commented 4 years ago

Updated the documentation for what's now called importance_sample (see 7a1e5df4d4f1711e97de4a121ab718d76828f490). Light materials have been moved to their own function with their importance_sample = TRUE as a default, so most people won't encounter this argument unless they explicitly turn it on.