Antialiasing is something your computer’s Graphics Processing Unit (GPU) can do to make jagged edges appear smooth in 3 dimensional images it produces.
In the above (click to expand) composite of two images (each produced with the ‘demo(hist3d)’ command in the R package ‘rgl’) the image on the right is an antialiased version of the image on the left.
Under Windows this isn’t that much of an issue (just visit your GPU vendor’s site and download and install the current Windows driver for your GPU) then when you open a new 3D device in ‘rgl’ do so with:
> open3d(antialias=4) # requesting to use an antialiasing level of 4 in the device to be opened
> par3d(‘antialias’) # checking if you’re request was granted i.e. if the level returned is the same as that you requested, ask for values equal to the powers of 2 i.e. 2, 4, 8, 16… (16 is pretty high currently)
Under Linux installing the vendor’s current driver for your graphics card can be a little tricky, especially if your computer is a laptop with an Nvidia GPU and Optimus power management whereby the system switches between the low powered GPU on the same chip as your CPU and the high powered GPU on your graphics card depending on the level of graphics processing required.
The good news is that there is now a mature and functional piece of software to manage Optimus graphics switching by Nvidia graphics cards in Linux – see the Bumblebee project and install instructions for Ubuntu.
Once you’ve got all that working you must tell your computer that you wish to run R and have its graphics ‘jobs’ processed by the GPU on your graphics card.
You do this by running R from the terminal with the Bumblebee command ‘optirun’ which tells Bumblebee to pass the graphics requests from R to the GPU on your graphics card rather than the weaker GPU on the same die as your CPU:
> optirun R
Now once this command has opened R go ahead and load ‘rgl’
# and you’ll notice that if you ask ‘rgl’ for the level of antialiasing it is using:
# it tells you ‘-1’
# DON’T try to change this level as above with ‘open3d(antialias = … )’
# your graphics card will antialias your ‘rgl’ images to the best of its ability with the settings as they are e.g.
demo(hist3d) # the antialiased plot
# you can compare this to what your computer would produce by default by running R without the GPU on your graphics card
# e.g. open another terminal/terminal tab (Ctrl-Shift-T)
# run R again and execute demo(hist3d) again