S a t y a m  V a g h a n i
< Home >   # About Me #   [ My Resume ]   { Work }
% Photos, etc. %  < Contact Me >
~ Source code, apps, pointers, etc ~

 

Computer Graphics at Stanford

Its a tough class, they say. But hey, its fun. Being a networks guy, I am used to having my programs running undercover and not providing me with any visual feedback. With graphics, the feedback is vivid and instantaneous. Thats what impressed me the most. You can literally see your programs 'taking shape'.

A souped up paint program

I am too lazy to do a write-up for the program, so here are excerpts from the README that went with this program:

The program is portable across different UNIXes, it needs a XWindow system though. The GUI consists of 5 canvases - 4 drawboards and a control canvas. One of the drawboards is used for the actual painting, the other shows brush visualization and is used to interactively manipulate the brush shape; the third is used to show a real-time magnified view of the brush footprint as it travels across the painting canvas; and finally, the fourth is used to display an interactive color palette with constant H, constant S and constant V planes.

The original image on the left is made to look colder (saturation-only tinting, the glass is desaturated, background is saturated on the same stroke). On the extreme right is an example of image enhancement using value-only tinting to bring the otherwise invisible bottom half of the straw into view.

Functionality implemented

Basic overpainting mode: The user can choose a brush color by either manipulating the H, S, V sliders, or the R, G , B sliders or by clicking on a color in the color palette. Brush size is variable.

User created mask: The user can draw a mask on the brush visualization canvas and this mask is used for painting in this mode. The 4X magnification part of the brush visualization canvas essentially becomes a drawing board for the brush (with proper gridlines to guide the user and preserve accuracy)

Consine Tinting (HSV interpolation): A consine function is used to determine tinting in this mode. There is another parameter, the tint factor, which can be used to depress or raise the entire brush fall-off by a certain factor. H only, S only, and V only tinting is supported

RGB Tinting: This is a simple implementation of tinting using interpolation in RGB space. The weighted mask is the same as Gaussian tinting, a consine function with variable tint factor

Flood Fill: I have implemented a span-based flood fill algorithm using an explicit stack. The span based algorithm is discussed as an alternative to recursive floodfill in FvD. The advantage is clear: my implementation can fill up large areas of the painting without causing a stack overflow or segmentation fault.

Smudging (Rect Filter Kernel): This is a filter painting implementation which uses weighted colors from neighboring pixels to change the color of a given pixel. I have used a box filter which produces smudging effects

Magnification: The program supports real-time magnification of the area under the brush in the painting. While the brush is inside the painting, the brush footprint is magnified 4X and presented in another canvas. The magnified view is updated constantly as the brush moves or paints.

Interactive manipulation of brush size, shape and falloff: As described earlier, the user can design a brush by actually 'painting' it on the brush visualization canvas. The brush visualization uses the actual colors and tinting functions which would be used on the painting

Const. H, const. S, const V surface visualizations: One of the canvases is a color palette which shows the const H, const S and const V planes for the selected H, S, V. The user can also use this canvas as a palette to choose colors. This canvas is synchronized with the H, S, V, R, G, B sliders.

The application is stable and does not crash :)

Source code for my paint program (runs on XWindows) is available on request.

Download the Linux executable
Download the Solaris executable

Polygon Scan Converter and Keyframe Animator


Heres my Fred Flintstone polygon frame. I used 10 polygons

This is what he looks like after my scan converter rasterizes the polygons. For this example, I've used 25 supersamples with a 2D rect convolution filter.

Source code for my scan converter (runs on XWindows or Windows) is available on request.

Download the Windows executable
Download the Linux executable

Finally, heres what I can do with 10 polygons, each having less than 100 vertices. Its Fred Flintsone scan converted and animated over 8 keyframes, using my program. The result is beautiful. 10 polygons. Thats all it takes. You'll need Quicktime or Xanim to view the .flc file. I recommend Xanim.

Functionality Implemented

Polygon scan conversion.

Full polygon clipping

Spatial supersampling with Box and Bartlett filters

Weighted Motion blurring

Interactive scaling and rotation of polygons

Insertion and deletion of vertices

Ability to input polygons with smooth/curved boundaries

FRED FLINTSTONE in 10 polygons!!