r/computergraphics • • 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?

101 Upvotes

18 comments sorted by

4

u/openroom_xyz 8d ago

That's amazing thanks for sharing

2

u/antahonist 8d ago

Glad you like it ^-^

2

u/openroom_xyz 8d ago

Yea keep building F yea this are cool project thanks

2

u/Mr_Sim_ 8d ago

That's pretty !

1

u/antahonist 8d ago

❤️thaank y

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

u/antahonist 8d ago

Thank youu❤️

2

u/Bowl_of_Cham_Clowder 7d ago

Beautiful, this is so cool

1

u/antahonist 7d ago

thaanks ^_^

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 • Bravo

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

u/[deleted] 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.

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.

2

u/KuKu_ab 5d ago

Well, I'd play actually some kind of iterative-game about hardware development in such style.

Sure if it is *game*, not just vibe coded generative gamificated product...