Home Technology Writing Download About Misc Contact

Computer Graphics

Selected software applications that showcase Computer Graphics related work.
To see more of my work in this field, please drop me a line.

OpenGL Viewer


Most of my earlier applications had a native C++ synthetic camera based viewer. To add photo-realistic surface rendering, I coded this simple OpenGL based 3D Viewer.
Internally it maintains all data structures used by synthetic camera model. For rendering it uses OpenGL engine. Using mouse wheel, user can zoom in/out. And drag mouse to change view point.

This viewer can render 3 types of objects as of now.
  • Voxels in *.3dv format.
  • Wireframes in *.3dm format.
  • Molecules in *.mcl format.
Download 3D OpenGL based Viewer (binary 12 KB).

Below are some sample objects that can be viewed in this viewer. You may find this viewer useful to quickly visualize your experimental data without having to code a separate viewer for it.

Sample Data Files

Click images to see respective file format.

Voxels

Molecules

[NaCl-salt, S8-sulfur]

Wireframes

Helix Cut Algorithm


One interesting project I worked on was similar to stereo lithography. My role was to develop an algorithm to determine trajectory of cutting tool head across surface of a polygonal object. The tool would move to-and-fro and the object platform would rotate at the same time elevate at a constant speed. So the tip of cutting tool would trace a helix across object surface.

Algorithm:

  1. Load 3D object from file - in the form of {V,P}.
    where:
    1. V is a set of all vertices.
    2. P is a set of all polygons.
  2. Calculate center of mass (CM) for the object.
  3. Calculate radius of bounding sphere R.
  4. From (CM.z-R) to (CM.z+R) traverse a helix with varying parameter t.
  5. For each iteration of t, build a ray from rayStart to rayEnd.

  6. where a point pt on a helix is:
    1. rayEnd = (cm.x + Rcos(t), cm.y + Rsin(t), cm.z + t)
    2. rayStart.x = (cm.x, cm.y, rayEnd.z)
  7. For each polygon of object, calculate intersection point (if one exists) with this ray.
  8. Insert this intersection point in helix storage vector.
This algorithm works beautifully well. Once entire system is built, I might upload some manufacturing results as well. Let me know if you want more information. Meanwhile you can download binaries here.

Cutting with Plane

Another interesting case if that of planar cutting. I was working on development of algorithm for shaping objects, the way they do it for diamond polishing. As part of that project, I developed a program to cut objects with a plane. Have lost the original program long time back, but its screen shot was found in some obscure place. Have a look at it below.

Planar Object Cutting. (a) GUI for interactive experience.  (b) 3D object with a cutting plane.
(c) Cut polygons after ray casting & plane intersections.  (d) Orbiting view of final cut polygonal mesh.

Blob Field Rendering


Electromagnetic fields of atoms interfere with each other roughly with this model. Jim Blinn of NASA, invented Blobs modeling. They are also called as Metaballs. Blobs have come a long way since then. Blobs are widely used in modeling organic objects, clay-like objects.

Basic idea revolves around computing field effect of each blob. The scene consists of blobs. Each blob is a "sphere". (this is a 2D example, but easily extended in 3D). Blob attributes are center, radius, field strength. At any given point in space, the net resultant field is integration of "contribution" of all blobs in that space. Simple.

Technically, each blob contributes strength*(1-d2/r2)2 to the field. Where r is radius of the blob and d is the distance of the concerned point from blob's center. It is an "additive" effect - blobs nearby develop "soft" joints - as if the water droplets nearby merge together.

Source code for this application is available upon request. Blob Binaries are available for download. This application is built with Turbo C/C++ 3.0 in DOS. So it has only 16 color support. I wish I could port it to Windows/Linux high-color version. But time since then has become a rare resource!

Motion Capture


This was one of quite interesting things I worked on during my sophomore years in engineering. My father and I worked on this concept to capture motion using easy-to-manufacture system. As motion capture finds several applications in movies, cartoon shows, animations, advertisements, and games - we were experimenting with its use in learning systems. We went onto build on some useful models after motion capture.

The system design is pretty straight forward to understand:
  • The idea was to use the ping-pong balls covered with a shiny silver-coated paper to track motion.
  • These balls were stitched on costume of human actor.
  • As human actor performed various actions, the video camera recorded its movie.
  • Video was post processed to extract all frames (it was 15 fps).
  • During post-processing, frames were converted into grayscale.
  • Then another image processing round increased contrast for each frame.
  • User then could specify connectivity between various tracked points.
  • Using that connectivity information, vector generation module would construct a stick frame.
  • And when all of these stick frames were stitched together, the stick was dancing!
  • This motion then could be applied onto any the object. For example, see blue blob-human below.
  • From our old archive I found this :) guy.
  • He is made up of blobs and performs the dance similar to stick.
  • As of today it is ~8 years ago that I lost track of its application source and related documents (bad, I should use SCM @ home)
  • But promise. If I get anything related to this dancing young man - I will upload it right here.
Source code for this application is available upon request.

Click on poster below to play video. You will need MPEG player plugin for your browser to see this video. Alternatively you can download Motion Capture video and play in player application.

Video: Motion Capture