change_material {rayvertex} | R Documentation |
Change Material
Description
Change individual material properties, leaving others alone.
Usage
change_material(
mesh,
id = NULL,
sub_id = 1,
diffuse = NULL,
ambient = NULL,
specular = NULL,
transmittance = NULL,
emission = NULL,
shininess = NULL,
ior = NULL,
dissolve = NULL,
illum = NULL,
texture_location = NULL,
normal_texture_location = NULL,
bump_texture_location = NULL,
specular_texture_location = NULL,
ambient_texture_location = NULL,
emissive_texture_location = NULL,
diffuse_intensity = NULL,
bump_intensity = NULL,
specular_intensity = NULL,
emission_intensity = NULL,
ambient_intensity = NULL,
culling = NULL,
type = NULL,
translucent = NULL,
toon_levels = NULL,
toon_outline_width = NULL,
toon_outline_color = NULL,
reflection_intensity = NULL,
reflection_sharpness = NULL,
two_sided = NULL
)
Arguments
mesh |
Mesh to change. |
id |
Default |
sub_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 settings
Examples
if(run_documentation()) {
p_sphere = sphere_mesh(position=c(555/2,555/2,555/2),
radius=40,material=material_list(diffuse="purple"))
generate_cornell_mesh() |>
add_shape(translate_mesh(p_sphere,c(0,-100,0))) |>
add_shape(change_material(translate_mesh(p_sphere,c(200,-100,0)),diffuse="red")) |>
add_shape(change_material(translate_mesh(p_sphere,c(100,-100,0)),dissolve=0.5)) |>
add_shape(change_material(translate_mesh(p_sphere,c(-100,-100,0)),type="phong")) |>
add_shape(change_material(translate_mesh(p_sphere,c(-200,-100,0)),type="phong",shininess=30)) |>
rasterize_scene(light_info=directional_light(direction=c(0.1,0.6,-1)))
}
if(run_documentation()) {
#Change several shapes at once
p_sphere |>
add_shape(change_material(translate_mesh(p_sphere,c(200,0,0)),diffuse="red")) |>
add_shape(change_material(translate_mesh(p_sphere,c(100,0,0)),dissolve=0.5)) |>
add_shape(change_material(translate_mesh(p_sphere,c(-100,0,0)),type="phong")) |>
add_shape(change_material(translate_mesh(p_sphere,c(-200,0,0)),type="phong",shininess=30)) |>
change_material(diffuse = "red") |>
add_shape(generate_cornell_mesh()) |>
rasterize_scene(light_info=directional_light(direction=c(0.1,0.6,-1)))
}