Graphics Reference
In-Depth Information
Point Clouds
A 3D texture is just data and needs a geometry to map
itself to. A good start is to map it to a 3D point cloud , a
uniform mesh of 3D points. When you map the temper-
ature distribution dataset above to a point cloud, you
get the image in Figure 15.8.
One of the interesting aspects of this approach is
that the resolution of the point cloud does not have to
exactly match the resolution of the dataset. Because this
example uses texture mapping to access the data, the
OpenGL display process will interpolate the data values
to the cloud's point locations. Making the resolution of
the point cloud less than that of the data is usually a bad
idea, since some of the data values will be completely
skipped over in the display. But you can easily give the
point cloud a higher resolution and get a nicer-looking
display.
Using a higher point cloud resolution assumes, of course, that interpola-
tion makes sense for the particular data you have. It doesn't always. For exam-
ple, suppose the data values represent integer-only data, such as the number
of children per family. Even though a point cloud dot could exist between two
data values, it makes no sense to combine half of one with half of the other
to produce a data point that represents a fraction of a child. In this case, the
resolution of the point cloud should be the same as the resolution of the data.
The GLIB file used to produce the point cloud above is
Figure 15.8. Uniform point cloud.
Texture 5 vis3dtexture.tex
Vertex pointcloud.vert
Fragment pointcloud.frag
Program PointCloud \
uTexUnit 5 \
uMin <0. 0. 100> \
uMax <0. 100. 100.>
PointCloud 50 50 50
The vertex shader is also very short, since it just sets up the interpolation
of the texture coordinates and performs the matrix transformation:
out vec3 vMCposition;
Search WWH ::




Custom Search