Charles Petzold on writing books, reading books, and exercising the internal UTM

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

I Have Cracked the 3D Pedagogical Nut!

February 4, 2014
New York, N.Y.

There is nothing quite so immediately gratifying as graphics programming. Specify a few coordinates in a program, and you can draw a line right on the screen. From there you can build it up, add curves, enclose and fill areas, and experiment with different types of brushes. Start animating the coordinates and colors, and you're off.

But 3D graphics programming is not quite so simple. The programmer needs to master several difficult concepts just to get a little something on the screen, and a tiny miscalculation — a camera not quite pointed in the right direction, for example — can result in the scene being entirely invisible.

As someone who teaches programming concepts, I have found this situation very frustrating. I remain convinced that there is an untapped future of 3D graphics programming involving touch-based user interfaces, but I do not have sufficient vision and imagination to realize these myself. All I can do is try to teach programmers the intricacies of 3D programming with the hope that one of my readers will be able to carry the concepts into actual applications.

Yet, the current dominant Windows-based 3D programming interface is Direct3D, and DirectX is hard enough even without the difficulties of Direct3D.

To me, this situation has been a pedagogical problem that I desired to solve — a very hard nut I wanted to crack. To crack this nut I needed to find a way to introduce 3D concepts gradually and progressively without requiring a whole slew of programming techniques to be assimilated just to get a little 3D figure on the screen.

Some six months ago, I began making progress. I noticed that several programming features normally associated with 3D programming were actually available to Direct2D programmers. Within the confines of Direct2D I discovered that it is possible to define and manipulate 3D coordinates and matrices, to apply camera transforms, and to use vertex shaders and pixel shaders. Moreover, each of these topics could be approached incrementally, steadily building a tetrahedron of knowledge and skills that could later be applied to real 3D programming.

Over the next several months, my DirectX Factor column will present these techniques. The first installment is now available in the February issue, entitled "A 2D Portal into a 3D World". Using geometries generated from character outlines, I show how to create a spinning animated image that looks like this (click to see the full-screen version):

What you're seeing here is composed entirely of 2D geometries with a little manipulation and analysis of coordinates to suggest 3D space and hide the background image behind the foreground.

The performance is terrible, but that only suggests there are better ways to do it. Stay tuned.


"The performance is terrible, but that only suggests there are better ways to do it."

This is a great quote! :)

— John Gardner, Tue, 4 Feb 2014 18:08:43 -0500

Hi Charles,

Never mind the performance (at least for now), the optimizations are made later in the project, when doing 3D programming.

For the beginning, it must look good, and it seems that it does in your case. I'm waiting for the next iteration...

Robert, Wed, 19 Mar 2014 06:49:12 -0400

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

(c) Copyright Charles Petzold