|
The HOOPS/3dGS provides extensive
texture mapping capabilities, and takes advantage of underlying
3D hardware acceleration whenever possible. The texture
functionality is flexible and easy to use, and is documented
in Section 5.2 of the HOOPS/3dGS Programming Guide. This
article reviews some key texture topics.
How to Enable Texture
Mapping
Use of textures requires the
following steps:
-
Insert a named image into the scene-graph
using HC_Insert_Image.
-
Use HC_Define_Texture to create a texture
using the image.
-
Assign texture-coordinate parameters
to the shell or mesh. These control the mapping between
points in the object and points in the texture.
-
Specify a parameterization source. Refer
to HC_Define_Texture to see a list of valid sources.
(The default is 'uvw')
-
Use the texture as the color of the
object; for example, HC_Set_Color("faces = (diffuse
= my_new_texture)");
-
Make sure that the "texture interpolation"
Rendering_Option is enabled (it is enabled by default).
Applying Multiple Textures
Per Color Channel
Different texture maps can be
used for different components of an object’s color.
For example, you could use one texture for the diffuse color,
and another texture for the specular color. See the HC_Set_Color
command for more information.
Local and Global Textures
The usage of HC_Define_Texture
described aboves makes the texture a 'global' texture. (Think
of HC_Define_Texture as a regular #define) You can't have
'global' textures with the same name in different parts
of the scene-graph. However, you can use HC_Define_Local_Texture
to make the texture 'local'. This setting makes the texture
scoped to a segment and thus allows you to have textures
with the same name in different parts of the scene graph.
Image Downsampling and
Textures
When a user is inserting an image
to be used as a texture, it is not uncommon for it to be
of a non-uniform size, or larger than necessary to adequately
depict the material of interest. Therefore, when an image
is used create a texture, HOOPS will automatically ‘down-sample’
the image to a power of 2 and usually to a size of 512x512.
An image with these properties helps ensure optimum performance,
particular when the display driver is set to OpenGL. In
most cases, down-sampling the image is acceptable if the
texture is being used to depict some material property of
an object.
Draping Imagery over
Terrain Data
More and more HOOPS customers
are interested in draping satellite imagery over terrain
data. This is achieved by converting the imaging information
to a HOOPS/3dGS image, defining a texture, and applying
that texture to a HOOPS/3dGS mesh primitive that represents
the terrain data. If the terrain data is non-uniform, then
a HOOPS/3dGS shell must be used.
The starting images can sometimes
be quite large, since a significant amount of resolution
is desirable in the final rendering. Therefore, HOOPS/3dGS’
automatic down-sampling (discussed in the previous section)
can result in significant loss of critical image resolution.
The "no downsample"
Define_Texture option is designed to address the requirement
of preserving the full image data when texture mapping it
to a shell/mesh. When this option is set, HOOPS/3dGS will
use the largest power of 2 size that both fits the image
data and the limits of OpenGL. Hardware and software OpenGL
both have limits, and HOOPS/3dGS will stay within the limit.
The fact that HOOPS/3dGS stays
within image-size limits means that image resolution could
still be lost of the limit has been reached. To help ensure
that image resolution is never lost, the application could
chop up the image into tiles and remap them to subsections
of the shell/mesh. This functionality may be added to a
future release of HOOPS/3dGS. Additionally, a HOOPS/3dGS
option may be added in future releases which instructs HOOPS/3dGS
to always use the full-sized image, and fallback to software
rendering of the 3D hardware can’t handle the large
image (however, this would result in a significant performance
drop since no 3D HW acceleration would be used).
Currently, texture parameters
must be explicitly set when you wish to drape an image to
a HOOPS/3dGS mesh. Future releases of HOOPS/3dGS may include
an implicit ‘drape’ parameterization source
option. This would instruct HOOPS/3dGS to drape a texture
across an entire mesh by automatically setting the texture
parameters.
|