r-spatial / mapview

Interactive viewing of spatial data in R
https://r-spatial.github.io/mapview/
GNU General Public License v3.0
519 stars 90 forks source link

possible to control cubeView alpha? #82

Closed mdsumner closed 7 years ago

mdsumner commented 7 years ago

I see the fourth channel in .js is set to full at 255:

https://github.com/r-spatial/mapview/blob/master/inst/htmlwidgets/cubeView.js#L253

Is it possible to let that be controlled by the user? I'd like to be able to map NA values to 0, though I'm not sure it's going to look any different(?).

tim-salabim commented 7 years ago

@swoellauer? I gave this a little try, but didn't have too much luck.

swoellauer commented 7 years ago

cubeView is rendered by flat textures for each face. Transparent pixels would just show the other side of the cube. A parameter to control the color of NA values may provide better results?

mdsumner commented 7 years ago

Thanks! Can that colour be invisible?

tim-salabim commented 7 years ago

@mdsumner with 58bd0820a943de67949a810ac5a4e1a69254c9cb we now have na.color argument for cubeview (and plainview). This won't repsect "transparent" (for cubeview - it does for plainview) but you can just set to "black" which is the background color of the viewer in case of cubeview so should be equivalent.

Testing welcome :-)

mdsumner commented 7 years ago

This will be great for chlorophyll plots, the white was a bit too blinding. Thanks!

I realize in my haste I was thinking about this completely wrong, obviously it's an "external margin"-only mesh, not a minecraft voxel world. I wonder if there could be a similar tool, to plot individual cells in their xyz position, sparsely? It could be just points-only, if you have any pointers or clues I'd explore it.

Also there's a more general opportunity I think, using textures within arbitrary surfaces in the view - cubeView seems to show window into more general tools like this? Probably I just have to dig into the .js, I generally understand the geometry/topology code but I'm not js-proficient at all.

tim-salabim commented 7 years ago

well, for point(clouds) http://www.potree.org/ comes to mind... This would be soooo handy to have access to from within R!

mdsumner commented 7 years ago

lasr is worth a look, but yes to potree. I really need to get into js

fdetsch commented 7 years ago

Haha @mdsumner, I am totally with you as regards js ;-)

tim-salabim commented 7 years ago

closing this, feel free to reopen