I have a raster stack with 2 layers which correspond to 2 elevations. Every layer is a raster with Lon and Lat coordinates with value 1 (all missing values are NA), forming polygons. RasterStack example
r1<-raster(xmn = 2.5, xmx = 3.3, ymn = 42, ymx = 42.5, nrows = 28, ncols = 33)
r2<-raster(xmn = 2.5, xmx = 3.3, ymn = 42, ymx = 42.5, nrows = 28, ncols = 33)
a<-c(421, 422, 424, 453, 454, 455, 456, 457, 485, 486, 487, 488, 489, 513, 514, 515, 516, 517, 518, 519, 546, 547, 548, 549, 550, 579, 580, 581, 582, 583, 613, 614, 615, 646, 647, 648, 649, 680, 681, 682)
r1[a]<-1
b<-c(514, 515, 516, 547, 548, 549, 550, 613, 614, 615, 647, 648, 649)
r2[b]<-1
st<-stack(r1,r2)
Is there any way to make a 3D plot showing every polygon in a different elevation depending on the layer? (x=LON, Y=LAT, Z= nlayer)
I have achieve a scatter3D plot for layers 1 and 2 Scatter3D example, but I would like to show them as polygons, to see how areas overlap within the entire vertical.

library(raster);library(plot3D);library(rgl);slogo <- stack(system.file("external/rlogo.grd", package="raster"));f <- function(x, offset=0, add=FALSE) { x<-as.matrix(x);persp3D(z=x+offset, zlim=c(0,3000), add=add, phi=50, theta=30);persp3d(z=x+offset, zlim=c(0,3000), col="lightblue", add=add, alpha = .75)};f(slogo[[1]],0*1000,F);f(slogo[[3]],1*1000,T);f(slogo[[3]],2*1000,T)? - lukeA