set_material {rayvertex} | R Documentation |
Set Material
Description
Set the material(s) of the mesh.
Usage
set_material(
mesh,
material = NULL,
id = NULL,
diffuse = c(0.5, 0.5, 0.5),
ambient = c(0, 0, 0),
specular = c(1, 1, 1),
transmittance = c(0, 0, 0),
emission = c(0, 0, 0),
shininess = 50,
ior = 1,
dissolve = 1,
illum = 1,
texture_location = "",
normal_texture_location = "",
bump_texture_location = "",
specular_texture_location = "",
ambient_texture_location = "",
emissive_texture_location = "",
diffuse_intensity = 1,
bump_intensity = 1,
specular_intensity = 1,
emission_intensity = 1,
ambient_intensity = 1,
culling = "back",
type = "diffuse",
translucent = TRUE,
toon_levels = 5,
toon_outline_width = 0.05,
toon_outline_color = "black",
reflection_intensity = 0,
reflection_sharpness = 0,
two_sided = FALSE
)
Arguments
mesh |
The target mesh. |
material |
Default |
id |
Default |
diffuse |
Default |
ambient |
Default |
specular |
Default |
transmittance |
Default |
emission |
Default |
shininess |
Default |
ior |
Default |
dissolve |
Default |
illum |
Default |
texture_location |
Default |
normal_texture_location |
Default |
bump_texture_location |
Default |
specular_texture_location |
Default |
ambient_texture_location |
Default |
emissive_texture_location |
Default |
diffuse_intensity |
Default |
bump_intensity |
Default |
specular_intensity |
Default |
emission_intensity |
Default |
ambient_intensity |
Default |
culling |
Default |
type |
Default |
translucent |
Default |
toon_levels |
Default |
toon_outline_width |
Default |
toon_outline_color |
Default |
reflection_intensity |
Default |
reflection_sharpness |
Default |
two_sided |
Default |
Value
Shape with new material
Examples
if(run_documentation()) {
#Set the material of an object
generate_cornell_mesh() |>
add_shape(set_material(sphere_mesh(position=c(400,555/2,555/2),radius=40),
diffuse="purple", type="phong")) |>
add_shape(set_material(sphere_mesh(position=c(555/2,220,555/2),radius=40),
dissolve=0.2,culling="none",diffuse="red")) |>
add_shape(set_material(sphere_mesh(position=c(155,300,555/2),radius=60),
material = material_list(diffuse="gold", type="phong",
ambient="gold", ambient_intensity=0.4))) |>
rasterize_scene(light_info=directional_light(direction=c(0.1,0.6,-1)))
}