
A low poly sphere rendered with Software3D.
Software3D
Overview
Hobby project
Software3D (working title) is a simplistic work-in-progress 3D engine implemented in Game Editor.
Game Editor is a game creation software designed for creating 2D games and thus has no 3D graphics engine. Software3D is programmed based on a tutorial written by David Rousset. The required vector and matrix libraries needed to be implemented manually as Game Editor doesn't include such and also doesn't allow including 3rd party libraries, most likely for security reasons. When programming the math library I used several different vector and matrix math libraries implementations as reference.
At its current stage, the engine can read triangulated 3D models exported in the .obj file format. Because coloring the triangles pixel by pixel is not feasible with Game Editor I had to come up with an alternative solution for coloring them.
In the data folder of the project are 46 images, each of which contains a right triangle in 180 different angles, that is, rotated 360 degrees in 2 degree steps. The first image features a triangle with its first angle the size of 1 degree. The next image has a triangle with its first angle the size of 3 degrees and so on all the way to 89 degrees in 2 degree steps.
The engine can use these pre-rendered triangles to color a triangle of any shape and size with any color. The steps required are as follows:
- Split the triangle to 2 right triangles
- Pick the 2 pre-rendered triangle sprites that best match the 2 right triangles
- Colorize the selected triangles by adjusting the r, g and b values of the game objects
- Use Game Editor's built-in
draw_from
function to draw the selected triangles to the correct position on the "screen" canvas, scaled to the correct size
(Game Editor only supports scaling via the draw_from
function and there's no support for rotation. That's why it needs to be pre-rendered to the triangle sprite sheet.)
Below is a short preview video of a grey low poly sphere rendered by Software3D.