The “specimen”, an oil painting of Bửu Chỉ, the prestigious Vietnamese painter.
The lighting vector (u, v, z) in the (x, y, z) coordination system as showed in the image above (the “right hand rule”): origin at center of the picture, x points to the right, y points upward and z points toward the camera.
Result: the (medical) infrared light source turned out to be a very bad choice
f you’re into computer graphics, you probably could have learned about normal mapping, bump mapping… Last week, a colleague told me about Polynomial Texture Mapping, then the experiment below was what I was doing as an exercise to learn about this PTM. In essence, PTM could produce extraordinary effects due to the fact that it makes use of many lighting data collected in real – world condition (check out some examples on the HP’s PTM page).
To make a PTM (using tools from HP Lab), you would need to photograph the “specimen” under many light directions, then combine all together in one “texture” (using PTMfitter) in which pixel values are computed from the collected data (polynomial function).
Input to the PTMfitter is a file listing images and their lighting vector (u, v, z). Note that (u, v, z) must be a normalized vector although PTMfitter only uses (u, v) at the moment. (Getting PTMfitter to run under Linux is quite tricky since it’s linked against an very out – dated version of libstdc++).
~/ptm/ptm_11a.jpg -0.894427191 0 0.447213595
~/ptm/ptm_12a.jpg -0.707106781 0 0.707106781
~/ptm/ptm_13a.jpg -0.447213595 0 0.894427191
~/ptm/ptm_14a.jpg 0.447213595 0 0.894427191
Output is the .ptm file that can be viewed with PTMviewer. The effect is really impressive, much more realistic than the normal, bump mapping usually seen. Let verify the difference, here is the .ptm and the .pl files, you would need to download PTMviewer from HP Lab (there’re versions for Wins, Linux and Mac).
We can also use PTM to create the DOF (Depth of Field) effect. The vector (u, v, z) in this case is not lighting direction anymore but the focus point the camera is shooting at. This technique is quite useful since DOF is very expensive to compute in graphics application, and this gonna be my next experiment!