Skip to content

3D model viewer made for the ATmega328 and Sainsmart 1.8" TFT screen (ST7735)

Notifications You must be signed in to change notification settings

mrt-prodz/ATmega328-Tiny-3D-Engine

Repository files navigation

ATmega328 Tiny 3D Engine (Arduino UNO)

3D model viewer made for the ATmega328 and Sainsmart 1.8" TFT screen (ST7735)

This is a tiny 3D engine made for the ATMEGA328 and a Sainsmart 1.8" TFT screen (ST7735). It uses the amazingly fast Adafruit GFX library fork by XarkLabs: github.com/XarkLabs

You can use the python script stl2h.py to convert STL models into header files and automatically import your meshes, just include the file and comment other mesh headers.

See stl2h.py help (./stl2h -h) for usage description.

Usage: ./stl2h.py -i <inputfile> -o <outputfile>
Convert a 3D mesh saved as STL format (ASCII) to header for Tiny 3D Engine.

  -i, --inputfile       3D mesh in STL file format
  -o, --outputfile      output filename of converted data
  -s, --scale           scale ratio (default 1.0)
  -n, --normals         save face normals
  -y, --yes             answer yes to all requests
  -v, --verbose         verbose output

Developed and tested with an Arduino UNO and a Sainsmart 1.8" TFT screen.

Features:

  • matrices for mesh transformations
  • fixed point to avoid using floats
  • 90 degrees fixed point look up table for sin/cos
  • backface culling using shoelace algorithm
  • flat colors (-unfinished/experimental/not fast enough-)
  • rotate the mesh with a 3 axis accelerometer (ADXL335)
  • rotate the mesh with a joystick thumb
  • push button on digital PIN 2 to change the render type.

This is a project for the ATmega328 and ST7735, source will certainly need some tweaking to run on other components.

Not implemented:

  • clipping
  • view/projection matrices (projection is done on world matrix directly)
  • hidden surface removal

Dependencies:

Video:

Preview of Tiny 3D Engine on YouTube

Screenshot:

Screenshot

References:

Wiring

Game Loop

Peter Collingridge 3D graphics tutorial

J-Snake Fixed Point Arithmetic

Math Open References

World, View and Projection Transformation Matrices

About

3D model viewer made for the ATmega328 and Sainsmart 1.8" TFT screen (ST7735)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages