Hi Phil,
> A couple of us here are trying to see if we can use texture mapping
> with 3D isosurfaces. Ideally, we'd like to be able to read a texture
> out of a gif or jpeg file and map it onto the surface, which we
> already have. Does anyone on the list have experience with this sort
> of thing? Does VisAD provide an API that does this?
The default DataRenderers don't do this, because it doesn't
quite fit their logic for how data are transformed into
graphics. The closest they come would be with a Field with
MathType:
((x, y, z) -> (contour_value, color_value))
and the ScalarMaps:
x -> XAxis
y -> YAxis
z -> ZAxis
contour_value -> IsoContour
color_value -> RGB
But contour_value and color_value have the same sampling
since they are both range types of the same Field, so rather
than texture mapping the color_value will simply color the
vertices of the iso-surface.
If you separate contour_value and color_value into different
Fields with different samples, then the default DataRenderers
won't integrate them in the display. That is, won't use one
to color the iso-surface of the other.
How, someone (name escapes me) in 1998 (right after we first
released VisAD) created a custom DataRenderer that took two
different Fields (this is supported by the DataRenderer
abstraction and the DisplayImpl.addReferences() signatures,
but not used by the default DataRenderers) and applied one
as a texture map on a surface generated by the other. His
trick (to make it not so difficult) was to use MathTypes:
((x, y, z) -> (contour_value, texture_x, texture_y))
((texture_x, texture_y) -> (color_value))
with the ScalarMaps:
x -> XAxis
y -> YAxis
z -> ZAxis
contour_value -> IsoContour
texture_x -> Red
texture_y -> Green
Then insdie his DataRenderer he used the colors as texture
coordinates. Neat trick. However, that was when we were
passing color components around in floats. We have sinced
changed the code to pass colors around as bytes, to save
memory, so they won't make very good texture coordinates.
To do it now, you'd need to define some new DisplayRealType
instances for texture coordiantes. It would be tricky, but
possible.
Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706
hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html