The Next-3D implementation is meant to be used in C via z88dk, but since we are aiming for high performance, all its core functionalities (rendering, projects, etc) are implemented in Z80 assembler, fully documented and built to take advantage of the Next hardware as much as possible.
This means the core library is easily portable to any environment, and its parts (such as plot or triangle) can easily be used in any C, Boriel Basic or other languages inline.
For sake of simplicity, the engine requires Layer 2 set to a resolution of 256x192.
Henrique Olifiers reached out to me the beginning of August 2025 - he had started coding this as part of the KS3 offering, and had discovered a couple of rendering bugs in the filled triangle routine I'd written for BBC BASIC for Next. I was aware of one of them, and got back to him to say that I'd be happy for either of us to work on a solution, and I'd roll it back into BBC BASIC for Next.
Long story short, he asked me that, given my experience, would I like to take this on as a project.
The code is targetting:
- Folk who want to understand how to write a 3D engine from scratch
- Folk who want a springboard to develop their own 3D games on the Next
As ever, the code is designed for readability, with each block of the assembler code commented.
This software is a public BETA. Please do not submit any pull requests or issues at this point in time; they will be ignored.
Distilled examples of using the 3D engine along with precompiled nex files can be found in the demos subfolder
Requires the latest version of z88dk. Installation instructions can be found here.
Alternatively there is a ready-built Docker container with a number of useful Sinclair development tools pre-built, including z88dk, that can be found here. Thanks to Neil McPhail @mcphail for maintaining that.
There is a makefile in the root directory to build the Next3D object files, and a makefile for each demo folder.
maketo make the .nex filemake deployto make and deploy to the folderDev/next/devin your home foldermake cleanto clean the build directory
The Next3D object files must be built before the demos.
In addition, for Linux/Mac users, there is a bash script for building the 3D library code and all the demos
sh make_all.shto make all object files in root and the sub-folders in the demo foldersh make_all.sh deployto make and deploy all nex files to the folderDev/next/devin your home foldersh make_all.sh cleanto clean all the object files
This has been tested with CSpect and ZEsarUX. Please consult the documentation for the emulators on installation, configuration and usage.
Note that it
This code is compatible with all versions of the Spectrum Next running the latest firmware (24.11 or later).
Copy the .nex file(s) to a folder on the Spectrum Next and run from the browser.
To save removing the SD card every time, use NextSync to synchronise the folder /Dev/next/dev in your home folder with the Next over WiFi.
- Set up NextSync to synchronise the folder on your PC with the Spectrum Next
- Use
make deployorsh make_all.sh deployto make the .nex file(s) and copy them to the sync folderDev/next/dev - Use the dot command .sync on the Spectrum Next to synchronise that folder with the Next
Models can be imported from Blender via an intermediate step:
- Export from Blender as an Wavefront (.obj) file
- Convert to a C file using the script convert_model.py in the python directory
Models can contain colour information and must be scaled to fit within the 8-bit model space.
There are example models and converted files in the models directory:
- *.blend: The models in Blender format
- *.obj: The models exported from Blender in Wavefront (.obj) format
- *.h: The models as converted by convert_model.py
And there is a tutorial video here with guidance on preparing models for export.
Headline documentation is available here.