Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
Created January 21, 2023 01:32
Show Gist options
  • Save tylermorganwall/6430e7bf027898a2ef0a2dc4c4a75675 to your computer and use it in GitHub Desktop.
Save tylermorganwall/6430e7bf027898a2ef0a2dc4c4a75675 to your computer and use it in GitHub Desktop.
render_highquality() glass path
moss_landing_coord = c(36.806807, -121.793332)
t = seq(0,2*pi,length.out=1000)
circle_coords_lat = moss_landing_coord[1] + 0.5 * t/8 * sin(t*6)
circle_coords_long = moss_landing_coord[2] + 0.5 * t/8 * cos(t*6)
montereybay %>%
sphere_shade() %>%
plot_3d(montereybay,zscale=50,water=TRUE,
shadowcolor="#40310a", watercolor="#233aa1", background = "tan",
theta=210, phi=22, zoom=0.20, fov=55)
render_path(extent = attr(montereybay,"extent"), heightmap = montereybay, clear_previous = TRUE,
lat = unlist(circle_coords_lat), long = unlist(circle_coords_long),
zscale=50, color="white", offset=200, linewidth=5)
ival = as.integer(seq(2, 1000, length.out=360))
off_vec = 600*(sinpi(seq(1, 360*50, length.out=1000)/180*4))
render_camera(theta=135, phi=40,zoom=0.55,fov=55)
zoomvals = unlist(tweenr::tween(c(0.07,0.55),n=1000,ease = "cubic-in-out"))
phivals = unlist(tweenr::tween(c(40,30),n=1000,ease = "cubic-in-out"))
for(i in 1:360) {
render_camera(zoom=zoomvals[ival[i]],phi=phivals[ival[i]])
render_path(extent = attr(montereybay,"extent"), heightmap = montereybay, clear_previous = TRUE,
lat = unlist(circle_coords_lat)[1:ival[i]], long = unlist(circle_coords_long)[1:ival[i]],
offset = 600+ off_vec[1:ival[i]],
zscale=50, color="white", linewidth=5)
render_highquality(clamp_value=10, line_radius=3, min_variance = 1e-5,
cache_filename = "montbay",
filename=sprintf("dielectricpath%i.png",i),
sample_method = "sobol_blue", samples = 64, verbose=T,
lightsize = 2000, lightintensity = 10,
path_material = rayrender::dielectric, use_extruded_paths = TRUE,
path_material_args = list(refraction = 1.5, attenuation = c(0.05,0.2,0.2)*2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment