Getting started Optional set up items 3D graphics Camera Trap Remote Control by smart phone Object tracking BrickPi robot

Programming 3D graphics from scratch

On reflection, this is not a good Raspberry Pi activity. Everything works, but the Raspberry Pi is too slow at the central computations, and it makes the exercise a little painful. This activity is still worthwhile, but much better done on a laptop or desktop machine.

This page gives details on how to create 3D graphics in Python. This is not a topic I teach, nor a research area of mine. I chose 3D graphics as an accessible (and hopefully fun) task that can be tackled without much prior knowledge. The approach taken is 'from scratch', i.e. building images pixel by pixel. Although this task may seem 'old hat' or simplistic, the need to make these computations efficient on a massive scale has had a big impact on hardware design for a number of years.

The eventual aim is to create code that can run on a Raspberry Pi to generate a selection of 3D models which can be remotely chosen and rotated from a smartphone app. The images should appear in 3D on a 3D capable TV, or in red/cyan anaglyph on a normal screen, for which you will need a pair of tinted 3D glasses. There are some other suggested Raspberry Pi projects at the bottom of the page.

Notes on the programming:

First program: drawing a triangle (right click to download).

Second program: drawing a cube (right click to download).
Third program: drawing a more complex image (right click to download).

Fourth program: adding remote control (right click to download).

Final program: putting it together (right click to download).

Further tasks.

Completely different projects.

Raspberry Pi is a trademark of the Raspberry Pi Foundation