I've made 3D renderers in the past, but this version is as simple as it gets. tap p to toggle perspective
I made one in lua for pico-8 Here's the code: --copyleft 2024 function setup_matrix() --calclate sin and cos before --as not to repeat calculations sx=sin(rotx) cx=cos(rotx) sy=sin(roty) cy=cos(roty) sz=sin(rotz) cz=cos(rotz) --put those into a 3^3 matrix --you're not dumb, i don't und- --erstand it either m={} add(m,cy*cz) add(m,sx*sy*cz-cx*sz) add(m,cx*sy*cz+sx*sz) add(m,cy*sz) add(m,sx*sy*sz+cx*cz) add(m,cx*sy*sz-sx*cz) add(m,-1*sy) add(m,sx*cy) add(m,cx*cy) end function rotate(x,y,z) add(rx,x*m[1]+y*m[2]+z*m[3]) add(ry,x*m[4]+y*m[5]+z*m[6]) add(rz,x*m[7]+y*m[8]+z*m[9]) end function _draw() cls() rotx=rotx+rotc roty=roty+rotc rotz=rotz+rotc setup_matrix() --rotate points rx={} ry={} rz={} for i=1, 8, 1 do rotate(px[i],py[i],pz[i]) end --render points --*(camz/(camz-pz[la[i]])) for i=1, 12, 1 do line(64+rx[la[i]]*(camz/(camz-rz[la[i]]))*cubes,64+ry[la[i]]*(camz/(camz-rz[la[i]]))*cubes,64+rx[lb[i]]*(camz/(camz-rz[lb[i]]))*cubes,64+ry[lb[i]]*(camz/(camz-rz[lb[i]]))*cubes) end end function _init() --define some variables rotx=0 roty=0 rotz=0 --rotation change rotc=0.0025 --cubesize cubes=20 --camera z (perspective) camz=-3 --construct our cube --(try experimenting with this) ♥ px={-1,1,1,-1,-1,1,1,-1} py={1,1,-1,-1,1,1,-1,-1} pz={1,1,1,1,-1,-1,-1,-1} la={1,2,3,4,5,6,7,8,1,2,3,4} lb={2,3,4,1,6,7,8,5,5,6,7,8} --p = point, l = line (from p- --oint a to point b) end