SciVis 2015 Project 4: "vectr"
Assigned Fri March 13; Due Wed March 18 at 11:59pm
In this short project you will implement Line Integral Convolution to visualization two-dimensional vector fields. This involves material covered in the class Feb 12-19 and the assigned readings on vector visualization.
Logistics
Your CNETID-scivis-2015 directory should now be populated with a p4vectr directory which contains all the files for this project. All other aspects of logistics are similar to previous projects: make in p4vectr should make vectr executable, which you will compare with reference executable rvectr. Work individually or in pairs.What to do
Run "./rvectr" to review the commands available, and run "./rvectr about" to see what will need to be implemented. This project requires about 200 lines of code (compared to 400 for Project 2 or 900 for Project 3). The convolution code (for vcrConvoEval) will be nearly identical to what was done for Project 2: we again need 2-D convolution, but now in a vector field rather than a scalar image. No derivative measurements are required. Reading through and understanding the header file vcr.h is essential. The vcrMath.h macro collection will be familiar.The handling of these lines
is the same as in previous assignments. There are detailed notes in the comments preceeding these blocks detailing what has to be done./* v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v begin student code */ /* ^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^'^ end student code */For this project, there is no additional work for 33710 students to do relative to 23710 students.
Example vectr/rvectr commands to try
The commands here use "./rrendr"; you should make sure that you get the exactly same results by running "./rendr".
- Always make sure your code builds cleanly with "make"
- Make some little vector datasets, and learn about their domain geometry (all the same)
The given code for rvectr svs allows you to create datasets according to the first two terms of a Taylor expansion around the origin, with info given to the "-p" flag: first a constant term (the first two values to -p), and then the Jacobian, in order dVx/dx dVx/dy dVy/dx dVy/dy. So right.nrrd is just the constant vector (2,0), and in out.nrrd the Jacobian is the identity, so vector value is the same as the world-space position. twist.nrrd is pure rotation../rvectr svs -w 0 -p 2 0 0 0 0 0 -o right.nrrd ./rvectr svs -w 0 -p 0 0 1 0 0 1 -o out.nrrd ./rvectr svs -w 0 -p 0 0 0 1 -1 0 -o twist.nrrd ./rvectr info twist.nrrd- Test your vector field convolution (try different kernels as well):
You should be able to make sense of these outputs given the how the fields were defined../rvectr ceval -i right.nrrd -k tent -w 0 0 ./rvectr ceval -i right.nrrd -k tent -w 0.1 0.3 ./rvectr ceval -i out.nrrd -k tent -w 0 0 ./rvectr ceval -i out.nrrd -k tent -w 0.1 0.3 ./rvectr ceval -i twist.nrrd -k tent -w 0 0 ./rvectr ceval -i twist.nrrd -k tent -w 0.1 0.3- Next, you need to be able to trace streamlines by either Euler or RK2 integration.
In the last example, note how the streamline is tracing a circle. You can also save the coordinates out to a file if you want to inspect them by some other means:./rvectr sline -i right.nrrd -k tent -s -0.4 0 -h 0.1 ./rvectr sline -i right.nrrd -k tent -s -0.4 0 -h 0.1 -n ./rvectr sline -i out.nrrd -k tent -s 0.2 0.3 -h 0.1 ./rvectr sline -i out.nrrd -k tent -s 0.2 0.3 -h 0.1 -n ./rvectr sline -i twist.nrrd -k tent -l 15 -s 0.5 0 -h 0.11 ./rvectr sline -i twist.nrrd -k tent -l 15 -s 0.5 0 -h 0.11 -rk2The "unu project -m l2" finds the length of each of the coordinate 2-vectors, and "unu minmax" looks at the range of those lengths. RK2 integration is clearly much better at creating a circular streamline (as it should be)../rvectr sline -i twist.nrrd -k tent -l 15 -s 0.5 0 -h 0.2 -o circ-eul.txt ./rvectr sline -i twist.nrrd -k tent -l 15 -s 0.5 0 -h 0.2 -rk2 -o circ-rk2.txt unu project -i circ-eul.txt -a 0 -m l2 | unu minmax - unu project -i circ-rk2.txt -a 0 -m l2 | unu minmax -- With streamlines working, you can do LIC. First you need a noise texture:
You can play with the "-s" options to "unu resample" to upsample to a higher resolution noise texture. To test LIC when the vector field is a constant vector:unu slice -i right.nrrd -a 0 -p 0 \ | unu crop -min 3 3 -max M-3 M-3 \ | unu resample -s x4 x4 \ | unu 1op nrand -o noise.nrrd ./vectr info noise.nrrdThe "bad" one is bad because the integration stepsize is too large. For something more interesting:./rvectr lic -i right.nrrd -r noise.nrrd -k tent -h 0.02 -n -l 20 -o - | unu quantize -b 8 -o right-lic-bad.png ./rvectr lic -i right.nrrd -r noise.nrrd -k tent -h 0.001 -n -l 80 -o - | unu quantize -b 8 -o right-lic-good.png./rvectr lic -i twist.nrrd -r noise.nrrd -k tent -h 0.001 -n -l 80 -o tlic0.nrrd ./rvectr lic -i twist.nrrd -r noise.nrrd -k tent -h 0.001 -mbl -n -l 80 -o tlic1.nrrd unu join -i tlic{0,1}.nrrd -a 0 | unu quantize -b 8 -o tlic.pngGrading
The grade will be based on correctness (100%), as evaluated by running the examples above, as well as testing on other datasets to be provided shortly.