Matthew Whitaker (mattw++at++syd.csa.com.au)
Thu, 19 Nov 1998 16:11:33 +1100
I am investigating the use of clip textures in a multipipe helicopter
filght sim. application and have been looking at the Hunter-Liggett and
Moffett clipTexture examples delivered with Performer.
In /usr/share/Performer/data/clipdata/README I read:
" (Note that clip textures only work in single-pipe applications,
so if you are on a multipipe system you must tell perfly
to run single-pipe by giving it the "-M0" command-line flag.)"
Is this really correct?? I have not encountered any other reference to
this limitation in my research and would like to assume that it is
either an error or a misunderstanding on my part. However I don't like
assumptions and would appreciate a more definative answer..!
I have attached the README for reference.
-- Regards,Matthew Whitaker
Computer Sciences Corporation ph: +61 2 9901 1633 460 Pacific Highway fax: +61 2 9901 1555 St Leonards, NSW 2065, Australia. email: mwhitak2++at++csc.com.au
Clip Texture Data Info:
This directory contains clip texture data and associated clip texture and image cache configuration files. There are two subdirectories:
hunter - contains color data of the Hunter-Liggett Army base in California, near Monterey. If you do not have this, install performer_data.clipdata.hunter from your IRIS Performer CD.
moffett - contains grayscale data of the Moffett Field Federal Air Station in California, near San Jose. if you do not have this, install performer_data.clipdata.moffett from your IRIS Performer CD.
Data:
The hunter data is in SGI's rgb format, divided up into separate image tile files, one tile per file. Only level 0 of the data has been provided.
The Makefile can be used to create the rest of the clip texture data levels. You can choose to build one of two rgb formats: 888 or 5551. The one you choose is a tradeoff between color resolution and performance. The default (typing "make") will create 888 format data.
The moffett data is completely provided. It is stored in fit-format files, with a single file for each clipmap level, and multiple image tiles stored in each file. The tile size varies at each level. This data is stored in 8 bit grayscale format.
Both directories have cliptexture and image cache configuration files. The hunter configuration files expect 888 format, but it is fairly simple to convert them to 5551 format.
The hunter configuration files will expand a environment variable named PFCLIPDATA. This variable should be the directory path to the parent directory of the hunter datafiles, including a final slash. This allows the hunter configuration files to find the data, even if the program calling them isn't run in the data directory. This variable doesn't need to be set if you run the viewing program in the data directory.
The clip texture configuration files have a .ct suffix. The image cache configuration files end with an .ic suffix. The .im loader data files end with an .im suffix.
Viewing the Data:
Scripts to run perfly on the hunter and moffett data are provided in /usr/share/Performer/data/clipdata/hunter/run_hl and /usr/share/Performer/data/clipdata/moffett/run_mof.
Sample programs for viewing clipmap data:
Note: Life will be a lot easier if you include src/pguide/libpr/C and src/sample/C/perfly in your path. If you do, you can skip the long pathnames described below when running icache, cliptex or perfly.
Once you have created the clipmap data, you'll want to look at it. There are a number of options. In the sample/pguide/libpr/C directory are two programs; cliptex and icache.
The cliptex program can be used to gain a birds-eye view of the data. It is a simple libpr-style test/sample program. To use, do the following:
cd <appropriate clip data directory; hunter or moffett> ../../../src/pguide/libpr/C/cliptex <clip texture configuration file name>
If you want to view each image cache individually, especially if you are debugging your own image cache configuration files, you can use the icache program in sample/pguide/libpr/C. It expects a image cache configuration file (one of the *.ic files) as an argument. To use it, try the following:
cd <appropriate clip data directory; hunter or moffett> ../../../src/pguide/libpr/C/icache <an image cache configuration file>
Note: if you set the PFCLIPDATA environment variable properly, you don't have to be in the data directory to view the hunter data. You will still have to provide a path to the hl.ct or hl.*.ic files as an argument to the cliptex or icache programs, however.
One easy way to set PFCLIPDATA properly:
cd <parent of directory where data is> setenv PFCLIPDATA `pwd`/
The trailing slash is needed to get a well-formed filepath.
Viewing general clipmap data with Perfly:
Perfly should be run with the FLY or DRIVE motion models (-d or -f) when clipmapping because the eye position is used for determining what part of the texture is visible.
To view a clip texture with perfly, you can take advantage of clip texture support in the .im loader. An example .im file is in each directory. They are named with a .im suffix. To run perfly, do the following (this assumes you've built perfly already):
cd <appropriate clip data directory; moffett or hunter> ../../../src/sample/C/perfly/perfly <.im file in this directory>
(Note that clip textures only work in single-pipe applications, so if you are on a multipipe system you must tell perfly to run single-pipe by giving it the "-M0" command-line flag.)
To look at individual image data files, you can run ipaste on rgb files, imgview for .fit files, or viewtile to look at 888 or 5551 format files. The viewtile program is in src/tools.
Note: the path to the clip texture configuration file is hardwired into the .im file. The .im file expects to be in the same directory with the clip texture configuration file. You'll have to edit the .im file if you want to use it elsewhere.
Seeing what's going on behind the scenes:
In perfly, if the scene contains a clip texture, hitting the 'g' key will overlay it with a color-coded grid for visual identification and verification of texel size, tile size, and which mipmap levels of detail are being displayed. For a complete description of the meanings of the grid colors and spacings, see the pfuGridify man page.
The scene in hl.im contains a callback function that continually updates the clipmap center to be the point in the scene closest to the eye. You can use the ".closest" pseudo-loader to highlight this closest point with a little red transparent ball; just add the suffix ".closest" to the actual name of the scene file: perfly hl.im.closest See the source code for the .closest pseudo-loader (in /usr/share/Performer/src/lib/libpfdb/libpfclosest) for more details and options.
Plugging clip data into existing scene files:
Many scene file formats support texturing but not clip texturing (the .im format being the only exception currently). However, if you have (or can make) a scene file in a format that supports texturing, you can easily substitute a clip texture by using the ".substclip" pseudo-loader.
For example, to replace the hubcaps on the familiar esprit.flt model with the hunter clip texture: cd hunter setenv PFSUBSTCLIP_TEXTURE hl.ct perfly esprit.flt.substclip You can replace the license plate instead of the hubcaps; see the source code for the .substclip pseudo-loader (in /usr/share/Performer/src/lib/libpfdb/libpfsubstclip) for more details and options. The .substclip can be used in conjunction with the .closest pseudo-loader (described above): perfly esprit.flt.substclip.closest
Note that when using the .substclip pseudo-loader, if there are many triangles in the scene, the app process will take a long time calculating the clipmap center on each frame, so in a real application, you would want to run the clipmap centering callback over a simplified representation of the scene rather than the scene itself. The function pfuNewClipCenterNode() provides an easy way of doing this from within an application.
For More Information:
For more information on configuration files, look at the pfdLoadImageCache(3) and pfdLoadClipTexture(3) man pages, the comments in icache and cliptex, and the comments in the Makefile.
For instructions and examples of setting up and applying clip textures to scenes in Performer using the pfuNewClipCenterNode() function, see the man pages and source code for these functions, and the source code for the .im loader and the .substclip pseudo-loader which use them.
This archive was generated by hypermail 2.0b2 on Wed Nov 18 1998 - 21:51:05 PST