[ Top page ]
[ Gallery contents ] [ Publication/Presentation ] [ Daily real-time coronal MHD simulation ]
[ Solar Corona & Wind (MHD model / other models) ] [ Test Simulation ] [ Visualization and Animation ]

Visualization/animation : for three-dimensional scalar data — partially for work and mostly for fun

There are two simple and straightforward ways to render three-dimensional scalar data. One is to draw the contour surface. In order that images will look natural to our eyes, a light source will be set, and the reflection and scattering on the surface be considered to calculate color and brightness. The other way is line-of-sight integration of values to make "ghost" or "fog", which allows us to see objects behind objects. Optical depth may be taken into account if necessary. In many cases, it is convenient to use the normalized values of the scalar data ranging from 1 to 0. I used "arctangent" to define a "good" step-wise function to rescale the values; it is written as

where the value varies quickly and smoothly from 0 to 1 around a0 with adequately small positive ε. Thus, the stepwise above determines whether a point (x,y,z) is inside (= 1) or outside (= 0) of contour surface a(x,y,z) = a0. Any other step-wise functions may work for rescaling/normalizing, though, arctangent may be best because it is continuous, symmetric, and calculable for any input (of real number).
   In addition, with the step-wise function above, we can do some kind of logical operation; adding the functions is equivalent to logical operation "OR", multiplying is to "AND", and minus sign (or an operation a'=1-a) works as "NOT". Dividing is of no meanings here.

For example, the white part, bone / hone, dog may like this, of an image, maboroshi no oniku, dog might like this (mpeg movie ; 487kB), is expressed as
equation of bone.

The first line defines an infinite column with radius of 0.18 centered along x-axis. The second gives lower limit to the range of x (x > -0.88), and the third does upper limit (x < +0.88). With these three lines multiplied, one finite column is defined. Line 4 defines a sphere with radius of 0.22 near one end of the column (centered at (1,0.15,0)), and this sphere will be "added" in the plot because line 4 is added in the equation of the scalar function. Three other balls are added to complete the white part drawn above, and the brawn part is defined in a way similar. It is a fun; logical operation here is like playing cray. I like this.
   I chose 0.5 as the threshold value of the scalar to be drawn as the surface (this is safer number ; any number between 0 and 1 may work). We can determine the point on the surface to be drawn (intersection of contour surface and line-of-sight) by calculating the scalar function along the line-of-sight until the function value crosses the threshold. By doing the same things along the line from the intersection point to the light source, you can know whether or not the intersection point is in the shadow of other objects. You may then calculate the normal vector of the contour surface (minus gradient of scalar) and other attributes at the intersecting point that are used to finally calculate the color / brightness at a pixel (through which the LoS crosses the projection plane). Effects in optics such as reflection and scattering will be taken into account for better visual effects. In the z-buffer method, the distance from the point on the object surface to the projection plane is stored so that only the object closest to the projection plane (or point of view) will be drawn. All below in this page and some in my other pages are made in this way.

movies



Last modified: June, 2008
© K. Hayashi