add_plot¶
The only required entry is the name of mesh field to plot.
{
"action" : "add_plot",
"field_name" : "p"
}
Rendering Options¶
When only selecting the variable, all default rendering options are used. The default camera angle will always place the data set in the center of the image, and the default rendering type is a pseudocolor plot of the surface of the data set. The top-level rendering option allow you to specify the type of renderer, image dimensions. Additional parameters allow you to specific camera and color map options.
file_nameif specified, the image will be saved to the file system. Otherwise, images will be streamed to the web server.widthimage width in pixelsheightimage height in pixelsrendererThe VTK-m and EAVL pipelines include renderer. Valid options areraytracerandvolume. Additionally, EAVL allowsopenglcolor_mapspecifies a the color map to usecameraspecifies the camera parameters to use
Color Map¶
The color map translates normalized scalars to color values.
Minimally, a color map name needs to be specified, but the color_map nodes allows you to specify RGB and Alpha (opacity) control points for complete customization of color maps.
Alpha control points are used when rendering volumes.
Color map names are the same for both EAVL and VTK-m. A full list of names can be found in the EAVL repository.
Colors are three double precision values between 0 and 1.
Alphas and positions are a single double precision values between 0 and 1.
Here is an example of the color map node that define three RGB control points and two alpha control points that defines a custom color map for volume rendering:
{
"color_map":
{
"control_points":
[
{
"type": "rgb",
"position": 0.0,
"color": [1.0, 0.0, 0.0]
},
{
"type": "rgb",
"position": 0.5,
"color": [0.0, 1.0, 0.0]
},
{
"type": "rgb",
"position": 0.5,
"color": [0.0, 0.0, 1.0]
},
{
"type": "alpha",
"position": 0.0,
"alpha": 0.0
},
{
"type": "alpha",
"position": 1.0,
"alpha": 1.0
}
]
}
}
The equivalent c++ code is:
add_plot["action"] = "add_plot";
add_plot["field_name"] = "p";
add_plot["render_options/file_name"] = outFileName;
add_plot["render_options/renderer"] = "volume";
conduit::Node control_points;
conduit::Node &point1 = control_points.append();
point1["type"] = "rgb";
point1["position"] = 0.;
double color[3] = {1., 0., 0.};
point1["color"].set_float64_ptr(color, 3);
conduit::Node &point2 = control_points.append();
point2["type"] = "rgb";
point2["position"] = 0.5;
color[0] = 0;
color[1] = 1.;
point2["color"].set_float64_ptr(color, 3);
conduit::Node &point3 = control_points.append();
point3["type"] = "rgb";
point3["position"] = 1.0;
color[1] = 0;
color[2] = 1.;
point3["color"].set_float64_ptr(color, 3);
conduit::Node &point4 = control_points.append();
point4["type"] = "alpha";
point4["position"] = 0.;
point4["alpha"] = 0.;
conduit::Node &point5 = control_points.append();
point5["type"] = "alpha";
point5["position"] = 1.0;
point5["alpha"] = 1.;
add_plot["render_options/color_map/control_points"] = control_points;
It is also possible to combine existing color maps defined by name and combine it with custom alpha control points. In the example below, we specify a thermal color map and add two alpha control points. The opacity is linearly interpolated from 0 (fully transparent) to 1 (fully opaque) across the the color map.
{
"color_map":
{
"name" : "thermal",
"control_points":
[
{
"type": "alpha",
"position": 0.0,
"alpha": 0.0
},
{
"type": "alpha",
"position": 1.0,
"alpha": 1.0
}
]
}
}
Camera Parameters¶
Camera parameters can also be controlled through a Conduit Node and are all expected to be double precision values. The supported parameters are:
look_atan array of 3 values that specifies the point the camera is looking atpositionan array of 3 values that specifies the camera positionupan array of 3 values that specifies the camera up vectorfov1 value that specifies the field of view in degreesxpan1 value that specifies the distance in the x direction to pan the cameraypan1 value that specifies the distance in the y direction to pan the camerazpan1 value that specifies the distance in the z direction to pan the camerazoom1 value that specifies the amount of camera zoomnearplane1 value that specifies the distance to the near plane of the camerafarplane1 value that specifies the distance to the far plane of the camera
Strawman always creates default parameters camera based on the spatial extents of the data set, and all or a few of the camera parameters can be modified. Like all the other action parameters, each can be specified in the actions json file or can be specified programmatically:
{
"camera":
{
"position": [1.4, 1.4, 1.4],
"look_at": [0.6, 0.6, 0.6],
"fov": 45.0
}
}
// Create the camera node
conduit::Node camera;
// Set the camera position
double position[3] = {1.4, 1.4, 1.4};
camera["position"].set_float64_ptr(position,3);
double look_at[3] = {.6, .6, .6};
// Point the camera to the data set
camera["look_at"].set_float64_ptr(look_at,3);
// Set the field of view to 45 degrees
camera["fov"] = 45.0;
// Add the camera parameters to the plot
add_plot["render_options/camera"] = camera;