rayrender (version 0.4.0)

lambertian: Lambertian (diffuse) Material

Description

Lambertian (diffuse) Material

Usage

lambertian(color = "#ffffff", checkercolor = NA, checkerperiod = 3,
  noise = 0, noisephase = 0, noiseintensity = 10,
  noisecolor = "#000000", image_array = NA, lightintensity = NA,
  fog = FALSE, fogdensity = 0.01, implicit_sample = FALSE)

Arguments

color

Default `white`. The color of the surface. Can be either a hexadecimal code, R color string, or a numeric rgb vector listing three intensities between `0` and `1`.

checkercolor

Default `NA`. If not `NA`, determines the secondary color of the checkered surface. Can be either a hexadecimal code, or a numeric rgb vector listing three intensities between `0` and `1`.

checkerperiod

Default `3`. The period of the checker pattern. Increasing this value makes the checker pattern bigger, and decreasing it makes it smaller

noise

Default `0`. If not `0`, covers the surface in a turbulent marble pattern. This value will determine the amount of turbulence in the texture.

noisephase

Default `0`. The phase of the noise. The noise will repeat at `360`.

noiseintensity

Default `10`. Intensity of the noise.

noisecolor

Default `#000000`. The secondary color of the noise pattern. Can be either a hexadecimal code, or a numeric rgb vector listing three intensities between `0` and `1`.

image_array

A 3-layer RGB array to be used as the texture on the surface of the object.

lightintensity

Default `NA`. If a positive value, this will turn this object into a light emitting the value specified in `color` (ignoring other properties). Higher values will produce a brighter light.

fog

Default `FALSE`. If `TRUE`, the object will be a volumetric scatterer.

fogdensity

Default `0.01`. The density of the fog. Higher values will produce more opaque objects.

implicit_sample

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

Value

Single row of a tibble describing the sphere in the scene.

Examples

Run this code
# NOT RUN {
#Generate the cornell box and add a single white sphere to the center
scene = generate_cornell() %>%
  add_object(sphere(x=555/2,y=555/2,z=555/2,radius=555/8,material=lambertian()))
# }
# NOT RUN {
render_scene(scene, lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
             aperture=0, fov=40, ambient_light=FALSE, parallel=TRUE)
# }
# NOT RUN {
#Add a checkered rectangular cube below             
scene = scene %>%
  add_object(cube(x=555/2,y=555/8,z=555/2,xwidth=555/2,ywidth=555/4,zwidth=555/2,
  material = lambertian(checkercolor="purple",checkerperiod=20)))
# }
# NOT RUN {
render_scene(scene, lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
             aperture=0, fov=40, ambient_light=FALSE, parallel=TRUE)
# }
# NOT RUN {
  
#Add a marbled sphere           
scene = scene %>%
  add_object(sphere(x=555/2+555/4,y=555/2,z=555/2,radius=555/8,
  material = lambertian(noise=1/20)))
# }
# NOT RUN {
render_scene(scene, lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
             aperture=0, fov=40, ambient_light=FALSE, parallel=TRUE)
# }
# NOT RUN {
#Add an orange volumetric (fog) cube           
scene = scene %>%
  add_object(cube(x=555/2-555/4,y=555/2,z=555/2,xwidth=555/4,ywidth=555/4,zwidth=555/4,
  material = lambertian(fog=TRUE, fogdensity=0.05,color="orange")))
# }
# NOT RUN {
render_scene(scene, lookfrom=c(278,278,-800),lookat = c(278,278,0), samples=500,
             aperture=0, fov=40, ambient_light=FALSE, parallel=TRUE)
# }

Run the code above in your browser using DataLab