Forum: help
Monitor Forum | | RE: rgl.snapshot() rendering only part of 3D model [ Reply ] By: Duncan Murdoch on 2020-02-07 19:15 | [forum:47373] |
| I can't think of what might be causing your problem, other than perhaps a buggy video driver. I'm using the same Ubuntu version in VirtualBox on a Mac, and it works fine with the new code. | |
| RE: rgl.snapshot() rendering only part of 3D model [ Reply ] By: R van velzen on 2020-02-07 18:42 | [forum:47372] |
|
Thanks for getting back to me and making changes to the code. I ran the following and unfortunately the issue remains (see attached output png): devtools::install_version("rgl", version="0.100.47", repos="http://r-forge.r-project.org") library(rgl) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x, y) plot3d(x, y, z, col = rainbow(1000)) par3d(windowRect = c(0,0,600,600)) Sys.sleep(1) rgl.snapshot("test.png") For what it's worth: this is not an issue on Mac OSX Catalina so I am able to generate rendered images on my macbook but it would be ideal if it worked also on my Linux workstation that is much faster. Thanks again |
|
| RE: rgl.snapshot() rendering only part of 3D model [ Reply ] By: Duncan Murdoch on 2020-02-07 15:31 | [forum:47370] |
| I've committed some changes that should make the snapshot method more reliable. Could you try version 0.100.47, and see if this helps with your issue? | |
| RE: rgl.snapshot() rendering only part of 3D model [ Reply ] By: R van velzen on 2020-02-06 06:47 | [forum:47369] |
|
Thanks for the fast support. However, adding a wait does not resolve my issue (also, I normally called the commands one by one in Rstudio so that there was already a 'manual' wait between the calls. Installing from R-forge also does not resolve the issue. install.packages("rgl",repos="http://r-forge.r-project.org") library(rgl) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x, y) plot3d(x, y, z, col = rainbow(1000)) par3d(windowRect = c(0,0,600,600)) Sys.sleep(1) rgl.snapshot("test.png") Could there be some other issue? Thanks again |
|
| RE: rgl.snapshot() rendering only part of 3D model [ Reply ] By: Duncan Murdoch on 2020-02-06 00:25 | [forum:47368] |
|
This looks like a bug that has been fixed in the unreleased version. I think the problem is that the change to the size of the windowRect happens slowly, and rgl proceeds to the snapshot before it is complete. I get the right output if I insert Sys.sleep(1) there: library(rgl) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x, y) plot3d(x, y, z, col = rainbow(1000)) par3d(windowRect = c(0,0,600,600)) Sys.sleep(1) rgl.snapshot("test.png") The unreleased version has the wait built in; if you install from R-forge you should see things working properly. |
|
| rgl.snapshot() rendering only part of 3D model [ Reply ] By: R van velzen on 2020-02-05 22:36 | [forum:47367] |
|
I am on Ubuntu 18.04.3 LTS using R version 3.6.2. When I call plot.3d() an R-X11 window opens to show the RGL device and renders the 3D model. Then, when I call rgl.snapshot() an image is rendered in the R plot window. However, this only shows a small part of the entire model. This is true with my usual setup running R from Rstudio Version 1.1.463. It is also true when running R directly from the terminal. Below is a minimal example showing this issue on my system: library(rgl) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x, y) plot3d(x, y, z, col = rainbow(1000)) par3d(windowRect = c(0,0,600,600)) rgl.snapshot("test.png") the resulting output is attached. Any advice on how to resolve this issue? Thanks, Robin |
|

