Scientific Visualizations with POV-Ray
Listing 2. The HDF_TOKEN case requires extra parsing to allow for the specification of which variable to raytrace. This code snippet is found in the Parse_PatternFunction routine in parstxtr.cpp.
EXPECT
CASE (DF3_TOKEN)
New->Vals.Density_File->Data->Name =
Parse_C_String(true);
Read_Density_File(New->Vals.Density_File);
EXIT
END_CASE
CASE (HDF_TOKEN)
New->Vals.Density_File->Data->Name =
Parse_C_String(true);
Parse_Comma();
New->Vals.Density_File->Data->Var =
Parse_C_String(true);
Read_Hdf_File(New->Vals.Density_File);
EXIT
END_CASE
All of the pieces are now in place to construct a scene description file to be interpreted by POV-Ray. I used the example found on Suzuki's density file extension Web page as a template and modified it to fit my needs. Listing 3 contains the full scene description file used to render an isosurface of cloud concentration with a sky-blue background and a tiled surface, shown in Figure 1. Starting at the top, the #version statement is required in order for this unofficial version of POV-Ray to function. The following nine #declare statements specify the Cartesian coordinates that bound the box containing the isosurface, as well as scaling factors.
Listing 3. cloud.pov
#version unofficial dfe 3.5;
#include "colors.inc"
#declare x0 = 0.0;
#declare x1 = 700.0;
#declare y0 = 0.0;
#declare y1 = 600.0;
#declare z0 = 0.0;
#declare z1 = 80;
#declare scalex = (x1-x0+1);
#declare scaley = (y1-y0+1);
#declare scalez = (z1-z0+1);
#declare R = 0.7;
#declare G = 0.7;
#declare B = 0.7;
#declare AMBIENT = 0.5;
#declare DIFFUSE = 1.1;
#declare SPECULAR = 0.3;
#declare ROUGHNESS = 0.01;
#declare BRILLIANCE = 1.0;
camera {
up <0,0,1>
sky <0,0,1>
right <3.0,0,0>
direction <1.0,0,0>
location <420,70,70>
look_at <370,300,90>
}
light_source {<100,100,100> color Gray25 shadowless}
light_source {<400,200,30> color Gray20 }
light_source {<1000,-500,150> color Gray25 }
light_source {<-400,-500,150> color Gray25 }
#declare QCFUNC = function { pattern{
density_file hdf "supercell.ck10990.hdf","QC"
interpolate 2 //tricubic spline
frequency 0
scale <scalex,scaley,scalez> } }
#macro QCISOSFC(iso,trans)
isosurface{ function{ -QCFUNC(x,y,z) }
threshold -iso
max_gradient 0.0002
contained_by{box{<x0,y0,z0>,<x1,y1,z1>}}
texture{ pigment{color rgbt<R,G,B,trans>}
finish{ambient AMBIENT diffuse DIFFUSE
specular SPECULAR roughness ROUGHNESS
brilliance BRILLIANCE} }
no_shadow
}
#end
QCISOSFC(0.0002,0.0) // render cloud
box { <x0,y0,z0> <x1,y1,z0> // tiles 5km square
pigment {checker color NewTan,
color .90*NewTan scale 50}
finish {ambient 0.5 diffuse 0.5} }
background {SkyBlue} // what else?
Continuing through the scene description file, the color and finish parameters are declared, and the camera and lighting parameters are set. The lines that follow contain the important bits for creating the isosurface. QCFUNC is declared as a function that uses the HDF file supercell.ck10990.hdf as a source of data; it chooses the variable QC (representing cloud concentration) within the file to render. Tricubic spline interpolation is chosen, and the entire domain is scaled so that all spatial indices, such as camera location and light location, coincide with array index values of the data. By default, POV-Ray's domain ranges from 0.0 to 1.0 in all three directions.
I created a macro called QCISOSFC, which takes as arguments the value of the isosurface I wanted to render and the level of transparency of the isosurface. Transparency is a useful isosurface property when rendering two isosurfaces where one exists inside another. For example, it is useful to render a transparent cloud that contains an isosurface of hail concentration, because hail often is contained within a thunderstorm cloud. QCFUNC, defined above, is selected as the isosurface function to render. The chosen isosurface binds a volume of cloud concentration greater than the chosen isosurface value of 0.0002.
The max_gradient parameter basically tells POV-Ray how much work it needs to do to find the isosurface. Technically, it tells POV-Ray what maximum gradient (largest change over distance) the function representing the isosurface data contains in the vicinity of the chosen isosurface. It is a number that must be chosen carefully. Too low a value produces an isosurface with holes or one that does not render at all; too large a value causes POV-Ray to run for a much longer time than is necessary. Some experimentation is required to find an appropriate value for max_gradient. I chose a value of 0.0002, which may seem small; however, cloud concentration ranges from 0.0 to about 0.01. POV-Ray warns you after rendering an isosurface with too large or small a value of max_gradient and suggests a value it deems appropriate after rendering.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)






1 hour 31 min ago
8 hours 25 min ago
8 hours 41 min ago
10 hours 32 min ago
16 hours 24 min ago
20 hours 56 min ago
20 hours 56 min ago
22 hours 56 min ago
1 day 7 hours ago
1 day 8 hours ago