dmurdoch / rgl

rgl is a 3D visualization system based on OpenGL. It provides a medium to high level interface for use in R, currently modelled on classic R graphics, with extensions to allow for interaction.
https://dmurdoch.github.io/rgl/
GNU General Public License v2.0
85 stars 20 forks source link

planes3d not showing for alpha < 1 #300

Closed relund closed 1 year ago

relund commented 1 year ago

Hi

I have problems with displaying planes with alpha < 1:

library(rgl)
options(rgl.printRglwidget = TRUE)
open3d()
x <- c(1, 2)
plot3d(x, x, x, xlim = c(0,6), ylim = c(0,6), zlim = c(0,6))
# rgl::planes3d(a = c(1,1,1), d = -3, alpha = 1)  # work
rgl::planes3d(a = c(1,1,1), d = -3, alpha = 0.5) # don't work
sessionInfo()

R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgl_1.0.4

loaded via a namespace (and not attached):
 [1] digest_0.6.31     R6_2.5.1          jsonlite_1.8.4    magrittr_2.0.3    evaluate_0.20     rlang_1.0.6       cli_3.6.0        
 [8] rstudioapi_0.14   ellipsis_0.3.2    rmarkdown_2.20    tools_4.2.2       htmlwidgets_1.6.1 xfun_0.36         yaml_2.3.7       
[15] fastmap_1.1.0     compiler_4.2.2    base64enc_0.1-3   htmltools_0.5.4   knitr_1.41   

Any hints on what is wrong?

dmurdoch commented 1 year ago

Looks like a bug to me. I see the plane in the R display, but not in the WebGL display.

relund commented 1 year ago

However, the example under planes3d work in WebGL.

dmurdoch commented 1 year ago

Thanks for the nice example. I'm pretty sure I've got it fixed; will merge into the main branch soon.