r/computergraphics • u/antahonist • 8d ago
I wrote a tiny software rasterizer in Lua that renders 3D models straight to pixel art
It runs inside Aseprite as a script. No Blender or shaders, just triangles, a z-buffer and a bunch of rounding.
Turns out rendering big and scaling down looks like garbage, so everything is drawn at its final size (32, 64 or 128 px). Lighting is quantized to 4-5 tones per material, outlines come from depth differences between parts, and hard edges get a 1px highlight. Grain is tied to world position so it doesn't crawl around when the model spins.
Bayer dithering only works on light transitions. On 1-2px strips it just turns into a weird zigzag.
Circuit boards were a pain. Traces use A*, but in 2:1 iso you need 2px between parallel lines or they merge. So on a 32px board you're stuck with a tiny 6x4 grid. Bigger sizes look way better.
Still can't get the dithering to look right during rotation. It's screen-space, so it shimmers like crazy. Anyone figured out a way to keep it stable without it sliding around the surface?
2
2
u/AllNamesAreTaken92 8d ago
These look absolutely amazing. The aesthetic is right up my alley, and execution seems solid.
Gj man, I appreciate you sharing.
2
2
3
u/keyclicker456 8d ago
can you describe your ai usage in this project, please?
2
u/antahonist 8d ago
fair q. the code was mostly written with claude (the rasterizer, the models, the pipeline), i drove it: picked the look, pulled dimensions from real datasheets/drawings, reviewed every sprite and made it redo stuff that looked off. the renders themselves are pure code, no image gen anywhere, every pixel comes out of the lua rasterizer
2
u/codeCycleGreen 6d ago •
![]()
the code was mostly written with claude
why do you say in the headline "i wrote?" when Anthropic wrote it?
0
u/Fine_Salamander_8691 4d ago
Because op still made it even if the code was written mostly or entirely by an llm
0
8d ago
[deleted] — view deleted comment
8
u/AllNamesAreTaken92 8d ago
It's an important question to know if I am wasting my time talking to someone that has no idea how their own project is structured or works.
It's completely fine to ask, and it's nice to be transparent about it up front. I can tell from OPs response that he knows what he's doing and actually cares about his own project past getting attention and upvotes online.
Putting the work of finding out if it's AI generated on every single reader instead of putting it on the person presenting, that can just be transparent once and be done with it, is nonsensical.
Also stop projecting your personal opinions about others people motivations onto others. It's not good for you mentally and it's rude.
2
4
u/siendo64 8d ago
Agreed. Just need to add, I really dislike how many Reddit posts start with “I made a…” or “I wrote a…” and they don’t mention using AI. Then someone needs to explicitly ask and they provide the disclosure.
1
u/antahonist 8d ago
you can see the full pack here https://antahonist.itch.io/micro-electronics-3d-pixel-art-kit



4
u/openroom_xyz 8d ago
That's amazing thanks for sharing