Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
Created November 22, 2019 12:35
Show Gist options
  • Save tylermorganwall/c642bd226fc93b236686e0bc21f8bc40 to your computer and use it in GitHub Desktop.
Save tylermorganwall/c642bd226fc93b236686e0bc21f8bc40 to your computer and use it in GitHub Desktop.
Pathtraced ripple effect in R with rayshader/rayrender
library(rayshader)
wave = matrix(0,200,200)
for(t in seq(1,360,1)) {
for(i in 1:200) {
for(j in 1:200) {
wave[i,j] = 50*sinpi(sqrt((i-100)^2 + (j-100)^2)/30-t/180) * exp(-(sqrt((i-100)^2 + (j-100)^2))/100)
}
}
wave %>% height_shade() %>% plot_3d(wave, soliddepth = -50, shadowdepth = -70, theta=315,zoom=1.1)
render_highquality(filename = glue::glue("ripple{t}"),clamp_value=10, clear = TRUE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment