This demo shows two methods of basic 3D line rendering with Silverlight. First, basic 3D objects are created composed of triangles. Face edges are then analyzed and a list of lines are created. During rendering the lines are transformed from 3D space to 2D space and rendered using either Silverlight Line objects or a software rendering engine.
Method 1: Silverlight has the ability to render two-dimensional line objects. An array of Silverlight Line objects are initialized and then dynamically repositioned every time a frame is rendered.
Method 2: This method uses an image with a WriteableBitmap source and then processes pixels to render lines. The lines are rendered using Bresenham's line algorithm. Unlike the native Silverlight lines, these lines don't have anti-aliasing (edge smoothing) and have a bit of a "rougher" look.
© 2010 Evan Olds