[R] Plotting a cloud/fog of variable density in rgl

Mike Marchywka marchywka at hotmail.com
Mon Nov 22 20:05:52 CET 2010







----------------------------------------
> Date: Mon, 22 Nov 2010 13:55:13 -0500
> From: murdoch.duncan at gmail.com
> To: jo.lists at gmail.com
> CC: r-help at stat.math.ethz.ch
> Subject: Re: [R] Plotting a cloud/fog of variable density in rgl
>
> On 22/11/2010 12:51 PM, JiHO wrote:
> > Hi everyone,
> >
> > I want to plot a 3D interpolation of the concentration of aquatic
> > organisms. My goal would be to have the result represented as clouds
> > with a density proportional to the abundance of organisms, so that I
> > could fly (well, swim actually ;) ) through the scene and see the
> > patches here and there. Basically, I want to do something like this:
> > http://www.youtube.com/watch?v=27mo_Y-aU-c
> > but simpler and with only clouds.
>
> rgl doesn't make everything in OpenGL available. I'm not sure exactly
> how those clouds were done, but it wouldn't really be easy to do them in
> rgl.
>
> I think you can come closest to what you want within rgl by using
> sprites rather than rendering transparent spheres. See
> examples(sprites3d).
>
If you only have 2 things with simple properties, namely point emitters 
as your organisms and a uniform concsntration of transparent scatters ( the
fog) you can probably derive geometrical optics expressions for the ray trace
results and just integrate those over your source distribution. This should
be reasonably easy in R. I haven't been to siggraph since 1983 so can't help
much but you can probably find analyitcal solutions for fog on google
and just sum up your source distribution. I guess you could even do some 
wave optics etc as presumably the fog could be done as a function
of wavelength just as easily. In any case, if you only have two basic things
with simple disto should be reasonably easy to do in R with your own code.

  		 	   		  


More information about the R-help mailing list