SciVis 2015 Lab 3: Using "rendr" and "iso"
The purpose of this lab is to help students make progress on Project 3, including the use of a new GUI-based tool for setting/testing camera parameters. There is nothing to hand in or grade.
- Follow the instructions in Lab 1 to get your updated checkout of Project 3-related files. Note: Some files were updated on Feb 23:
The remainder of the steps here assumes that you in in the p3rendr directory with the "./rrendr".
- rendr_4mi.c: "rendr 4mi" now has a more complete error message if the given matrix file isn't a 4x4 array.
- rendr_about.c: "rendr about" now correctly lists implementing rndTxfLevoy has something you have to do for this Project.
- rendr_info.c: "rendr info" now prints the range of values in the volume (also provides an example of accessing data values while knowing the data type only at run-time). This is useful for when you are picking isovalues to try to visualize with iso.
- rrendr: Changes from the above, little bug fixes, and multi-threaded rendering finished.
- .integrity.sh: check-sum changes for the above
- In $SCIVIS/util there is a new tool, iso. This uses Marching Cubes to compute a 3D polygonal isosurface, and allows you to interactively move a camera around the surface in order to figure out good camera parameters. This program does not work remotely; it requires sitting in front of a Mac to run it.
- Run:
and then (with the new program in the foreground) type "r". You should see an image like this.$SCIVIS/util/iso -i $SCIVIS/data/3d/teddy.nrrd -v 65- Type "h". In the terminal window from which you started iso, you should get use information about how to rotate the camera around the isosurface. Different parts of the window respond in different ways. Experiment with this to get a sense of what does what.
- When you find a viewpoint of the teddy bear that you like, type "c". This prints to the terminal window a specification of the current camera. In the next step you will copy the full line of this info, starting with "-fr" and ending with the two integers for the screen-size "-sz" option.
- Now start a rrendr command by typing (do not type return):
and then copy (Command-C) and paste (Command-V) the line giving the camera specification, and then hit return to start the rendering. When it is done:./rrendr go -i $SCIVIS/data/3d/teddy.nrrd -k tent -p val -b mean -s 2 -o mean.nrrdshould show a volume rendered (via mean projection) view of the bear that corresponds to what you see in the iso window.unu quantize -b 8 -i mean.nrrd -o mean.png open mean.png- Try a camera specication that has more aggressive clipping planes. Restart iso as above, type "r" and then "h" and locate where the "DepthScale" interaction region is. Right-clicking (or shift-clicking) in that region, and then dragging downward, should bring the clipping planes so close that the bear starts getting visibly clipped. Volume renderings made with the resulting camera settings should do the same clipping.
- Note that you can restart iso from any particular camera by giving it, on its command-line invocation, the camera information it generates with typing "c". Try this.
- For the "debugging process" part of the Project 3 grade the experiments you design to test the correctness of your program will likely depend on new synthetic datasets that you generate via "rendr svs". Here's a concrete example of doing that, which is interesting and possibly useful. Edit your rendr_svs.c to include the following case code:
Then make, then run:case 10: ret = 10 - fabsf(xx-1) - fabsf(yy-2) - fabsf(zz-3); break;type "r" to reset the view, and type "c" to see the camera info. Ponder what is going on:./rendr svs -w 10 -l 20 20 20 -o v10.nrrd $SCIVIS/util/iso -i v10.nrrd -v 5
- Note the look-at point location given by "-at". Why could you have predicted this from the code (above) you added?
- Rotate the shape around. Why does the isosurface have this shape?
- Reset the camera view again, and then zoom in (left-click and drag upwards near the left edge of the window), until the isosurface just barely fits inside the window (the rendered isosurface should just start to impinge on the top and bottom edge of the window), and then print the camera info with "c&qout;. Note the look-from point ("-fr&qout;). Quit iso.
- Now restart iso with "$SCIVIS/util/iso -i v10.nrrd -v 7.5", then "r" to reset view, and zoom in until again the isosurface vertically fills the window, print camera info with "c&qout;, and again note the look-from point. How why does this change (from the previous look-from point) make sense, given the synthetic volume being rendered?
- $SCIVIS/data/3d/vfrhand.nrrd is a portion of at CT scan from the female dataset from the Visible Human Project. You can see the skin and the bone by (two separate commands here):
This dataset is high-resolution enough that you can learn a bit about skeletal anatomy interactively exploring the bone isosurface. See if you can find sesamoid bones, for example.$SCIVIS/util/iso -i $SCIVIS/data/3d/vfrhand.nrrd @$SCIVIS/data/3d/vfrhand-cam.txt -v 290 $SCIVIS/util/iso -i $SCIVIS/data/3d/vfrhand.nrrd @$SCIVIS/data/3d/vfrhand-cam.txt -v 1210- The hand dataset is also large enough that volume rendering it with multiple threads provides real benefit. The CSIL Macs should have at least 4 cores, which informs the "rendr go -nt 4" below, but you can do the following to learn the real number of cores:
Try running (possibly with different rendr go -nt):
- From Apple menu select "About this Mac"
- "More Info..." button
- "System Report..." button
- in the "Hardware Overview:" you should see "Total Number of Cores:"
Note that hand-levoy.txt contains the 1210 isovalue that was interactively viewed. Compare the rendered result with:./rrendr lgen -i x x -n 100 -mm 0 3000 -o tmp-lut.nrrd echo 1210 0.9 1.1 > hand-levoy.txt ./rrendr go -nt 4 -i $SCIVIS/data/3d/vfrhand.nrrd -k bspln3 \ -us 1 -s 0.18 -p rgbalit -b over \ -lut tmp-lut.nrrd -lev hand-levoy.txt -lit $SCIVIS/lit/1.txt -a1 0.98 \ -o hand-rend.nrrd \ -fr -1462.95 1205.83 -492.699 -at -7.03571 -33.6558 14.4367 \ -up -0.528833 -0.295669 0.79556 -nc -46.6414 -fc 45.0107 \ -fov 5.42591 -sz 388 712 overrgb -i hand-rend.nrrd -b 0.1 0.15 0.2 -o hand-rend.png open hand-rend.png$SCIVIS/util/iso -i $SCIVIS/data/3d/vfrhand.nrrd -v 1210 \ -fr -1462.95 1205.83 -492.699 -at -7.03571 -33.6558 14.4367 \ -up -0.528833 -0.295669 0.79556 -nc -46.6414 -fc 45.0107 \ -fov 5.42591 -sz 388 712