Tuesday, December 14, 2010

N6610 LCD 3D Demo Part II

Instead of drawing only the edges of a polyhedron, this time we draw the faces and 'fill' it with corresponding colors. This demo now uses a dsPIC (16-bit and 40MIPS core) for "faster" and "smoother" graphics in the N6610/N6100 LCD (w/ pcf8833 controller). See "lcd6610.h" for the used pinouts.

There are several ways of "hidden surface removal". The easiest way, and most appropriate for drawing convex polyhedron is the use of Backface culling. "Backface" will determine whether a surface (e.g. triangular face) is need to be drawn or not.
Draw3D routine:

triangle color-fill routine:

(*another version of using dsPIC hardware multiplier/divider is included in the download)

detect whether a triangle is facing backward.

Complete MPLAB+C30 project (dsPIC33FJ16GS504):

No comments:

Post a Comment