R语言rayrender包,dielectric场景

2021-08-11  本文已影响0人  youmigo

R语言rayrender包,dielectric场景

1.png 2.png
# Thu Jun 17 23:19:46 2021 -

# 字符编码:UTF-8
# R 版本:R x64 4.1 for window 10
# cgh163email@163.com
# 个人笔记不负责任,拎了个梨🍐🌷
#.rs.restartR()
require(rayrender)
rm(list = ls());gc()

# dielectric场景
generate_cornell() %>%
  add_object(cylinder(x = 555/2, y = 250, z = 555/2,
                      length = 300, radius = 100, material = metal())) %>%
  render_scene(lookfrom = c(278, 278, -800) ,lookat = c(278, 278, 0), fov = 40,
               ambient_light = FALSE, samples = 400, parallel = TRUE, clamp_value = 5)

#Rotate the cylinder

generate_cornell() %>%
  add_object(cylinder(x = 555/2, y = 250, z = 555/2,
                      length = 300, radius = 100, angle = c(0, 0, 45),
                      material = diffuse())) %>%
  render_scene(lookfrom = c(278, 278, -800) ,lookat = c(278, 278, 0), fov = 40,
               ambient_light = FALSE, samples = 400, parallel = TRUE, clamp_value = 5)


# Only render a subtended arc of the cylinder,

generate_cornell(lightintensity=3) %>%
  add_object(cylinder(x = 555/2, y = 250, z = 555/2,
                      length = 300, radius = 100, angle = c(45, 0, 0), phi_min = 0, phi_max = 180,
                      material = diffuse())) %>%
  render_scene(lookfrom = c(278, 278, -800) ,lookat = c(278, 278, 0), fov = 40,
               ambient_light = FALSE, samples = 400, parallel = TRUE, clamp_value = 5)
dev.copy(png, "2.png");dev.off()

上一篇下一篇

猜你喜欢

热点阅读