Graphics FAQ

From CSWiki
Jump to: navigation, search

This document is meant to organize answers to common task oriented problems, replacing (or at least augmenting) the usual approach of "just asking Szymon." Please add your own questions and solutions.


Categories

Making Movies

  • How do I export a good quality, small size movie from Premiere?

Making Models

  • I need a very simple shape. How do I make it?
  • Do we (Princeton Graphics Group) have good models lying around?
  • Where can I find good models on the internet?
  • How can I get models from Sketchup to a format I can use?

Mesh Processing

  • How do I subdivide a mesh?
  • How do I smooth a mesh?
  • How do I remesh (retriangulate, reparameterize) a mesh?
  • How do I decimate a mesh?
  • How do I remove redundant vertices from a mesh?
  • How can I convert a mesh from format X to format Y?
  • My mesh has holes. How can I fix it?

Qt Related

  • What magic environment variables do I need to make Qt work?
  • How can I set up the Qt Windows Open Source version to work with Visual Studio?

Making Movies

  • How do I export a good quality, small size movie from Premiere?

Method 1:

  • Export a 95-100% quality "Motion JPEG A" video from Premiere.
  • Compress this large (often ~1GB) file using mencoder and Szymon's toavi script, which is also reproduced below:
#!/bin/sh -
rate=1200
#codec=msmpeg4
codec=mpeg4
case $# in
 [01]) echo "$0 in.avi out.avi [bitrate]" ; exit 1 ;;
 3) rate=$3 ;;
esac

mencoder $1 -vf eq2=1.2:1.0:-0.1:1.0:1.0:1.0:1.0:1.0 -ovc lavc -oac mp3lame \ 
 -lavcopts vcodec=$codec:mbd=2:mv0:trell:cbp:vqmin=3:last_pred=2:turbo:vbitrate=$rate \
 -ffourcc MP43 -ofps 29.97 -o $2
  • If you want it to play in Windows Media Player, you may need the "msmpeg4" codec.
  • I'm sure there is something I'm forgetting about this whole thing...

Making Models

  • I need a very simple shape. How do I make it?


Method 1:

Use mesh_make. It is part of trimesh2 and available at http://www.cs.princeton.edu/gfx/proj/trimesh2. It can make at last count:

	plane m [n]	m x n tesselated square (default n = m)
	bump n sigma	n x n tesselated Gaussian bump of width sigma
	wave n omega	n x n tesselated sine wave of frequency omega
	frac n		n x n fractal landscape
	cube n		n x n tesselated cube
	disc n m	Circular disc, tesselated with m rings of n points
	cyl n m [r]	Cylinder of radius r (default 1)
	ccyl n m [r]	Capped cylinder
	cone n m [r]	Cone
	ccone n m [r]	Capped cone
	torus n m [r]	Torus of minor radius r (default 0.25)
	knot n m [r]	Trefoil knot of minor radius r (default 0.2)
	klein n m	Klein bottle
	helix n m t [r]	Helix of minor radius r, with t turns
	sphere n m	Sphere, tesselated in polar coordinates
	platonic n	Platonic solid with n sides
	ssphere n m	Sphere, subdivided m times from a Platonic of n sides
	rd		Rhombic dodecahedron
	rt		Rhombic triacontahedron


Method 2:

Use Sketchup. Sketchup can do simple CSG operations. See answer below for how to convert sketchup files to something useful.


  • Do we (Princeton Graphics Group) have good models lying around?

There are some models in various peoples directories on graphicslab. Check /n/fs/graphicslab/smr/models and /n/fs/graphicslab/fcole/models for a start.


  • Where can I find good models on the internet?

Some good places to look include:

  • Aim @ Shape: a nice collection with a variety of models including some commonly used models (rockerarm, fandisk, camel, dinopet, etc.).
  • The Stanford 3D Scanning Repository: they have the bunny, armadillo, dragon, buddha, and others.
  • Suggestive Contour Gallery: has links to models used for suggestive contours work.
  • Google 3D Warehouse: the warehouse is accessed through Sketchup. It has a bewildering array of models of varying quality.
  • Princeton Shape Benchmark: Contains a bunch of models suitable for shape analysis work.


  • How can I get models from Sketchup to a format I can use?

Method 1:

Use a Sketchup plugin. Sketchup uses Ruby (God knows why) for its scripting language. There is an OFF exporter script available at
/n/fs/graphicslab/fcole/sketchup_exporter/off_exporter.rb
On windows, place it in
C:\Program Files\Google\Google SketchUp 6\Plugins

Method 2:

Use the Sketchup export feature to export to a KMZ (Google Earth 4) file. This is a COLLADA file. COLLADA is the all-singing, all-dancing graphics file format of the future. You can use FCollada or the COLLADA DOM to read it (not recommended, since both are absurdly heavyweight) or libcda, which is a simple but limited COLLADA library based on Qt (ask fcole).

Mesh Processing

  • How do I subdivide or smooth a mesh?

Use mesh_filter. It is a part of trimesh2. It can do planar, Loop, and butterfly subdivision, and gaussian, bilateral, umbrella, and lambda-mu smoothing.


  • How do I remesh (retriangulate, reparameterize) a mesh?

I hope to find this out soon.


  • How can I decimate a mesh?

Michael Garland's qslim is a good place to start, if you don't already have an implementation from when you took COS526.


  • How do I remove redundant vertices from a mesh?

There is a program called plyshared that is rumored to be able to collapse multiple vertices at the same geometric location into one vertex. It is in ~smr/proj/ply/bin/plyshared.


  • How can I convert a mesh from format X to format Y?

Use mesh_filter. It will convert to and from anything trimesh2 can read, which includes at least OFF, PLY, and OBJ. For conversion, use it with no arguments like so

mesh_filter frommesh.off tomesh.ply


  • My mesh has holes. How can I fix it?

Try smr's hf program. It is available at ~smr/proj/hf.

Qt Related

  • What magic environment variables do I need to make Qt work?

See Configuring Qt.


  • How can I set up the Qt Windows Open Source version to work with Visual Studio?

See Configuring Qt.