Drawing 3D Solids

POLYSTART
POLYEND
POLYVIEW
SETLIGHT
LIGHT

3D Solids in FMSLogo uses all the standard 3D commands and a few additional commands to help FMSLogo understand what you're drawing. In order to do hidden line removal or hidden surface removal, you must define surfaces, not just vectors. Surfaces are simply filled polygons. You just need to tell FMSLogo when you're starting a surface and when you're done. If you used only vectors to draw a box, FMSLogo would not know if it's a 6-sided closed box (solid cube) or a 4-sided box with an open top and bottom. Vectors alone are ambiguous with respect to surfaces.

Logo programmers are used to dealing with filled polygons, you do it all the time so it should not be a strange new concept. But FMSLogo in 3D mode fills that polygon with respect to the color you should see based on your eye view, light source, obstructions, and the color of the surface.

Here are the new commands:

CommandDescription
POLYSTARTStart a new polygon (a surface of PENCOLOR)
POLYENDEnd the definition of the polygon and display it.
POLYVIEWShade and view all polygons that have been defined.
SETTURTLE -3Use this turtle to position light source.
SETLIGHTUse to set how objects should be illuminated.

The PEN color when drawing 3D surfaces is the color of the surface. If you drew a box in 3D (6 Polygons) that all were drawn the same color, all you'd see is a FILLed octagon looking thing. Color is affected by the angle of the surface between your eye (turtle -1) and the light source (turtle -3).

The 3D lighting model in FMSLogo uses some modern techniques, but is primarily designed for performance. It does not draw shadows, reflections, etc. You may see pixel errors sometimes. This is an expected artifact of the algorithm I chose.


SourceForge.net Logo