Difference between revisions of "Focal Stacks"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(OBJ Files)
(OBJ Files)
Line 18: Line 18:
 
#!/bin/bash
 
#!/bin/bash
 
chmod 660 *
 
chmod 660 *
sed s/usemap/usemtl/ FS_020.obj -i
+
sed s/usemap/usemtl/ '$1' -i
sed s/map.jpg/coral-material/ FS_020.obj -i
+
sed s/map.jpg/coral-material/ '$1' -i
sed '/map_Kd/ i\newmtl coral-material' FS_020.obj.mtl -i
+
sed '/map_Kd/ i\newmtl coral-material' '$1'.mtl -i
convert FS_020.obj.jpg -flip FS_020.obj.jpg
+
convert '$1'.jpg -flip '$1'.jpg
 
</pre>
 
</pre>

Revision as of 18:49, 22 May 2013

OBJ Files

Requirements for OBJ files for CalVR to display:

  • Material library file needs to be specified with extension, e.g.: mtllib coral-mtl.mtl.
  • To use a texture image (image map) use the command usemtl, not usemap. Example: usemtl coral-material. This is for material file coral-mtl.mtl, which has the following content:
  newmtl coral-material
  map_Kd coral-map.jpg
  • The image referenced by the material file in this example is coral-map.jpg.
  • If the image is upside down, flip it with the following ImageMagick command:
  convert sourceimage.jpg -flip destimage.jpg
  • Here's a script that converts data from Helicon Focus' obj format to CalVR's obj format:
#!/bin/bash
chmod 660 *
sed s/usemap/usemtl/ '$1' -i
sed s/map.jpg/coral-material/ '$1' -i
sed '/map_Kd/ i\newmtl coral-material' '$1'.mtl -i
convert '$1'.jpg -flip '$1'.jpg