]> git.za3k.com Git - blog.git/commitdiff
Hack-a-voxel
authorZachary Vance <za3k@za3k.com>
Fri, 14 Nov 2025 21:35:32 +0000 (16:35 -0500)
committerZachary Vance <za3k@za3k.com>
Fri, 14 Nov 2025 21:35:32 +0000 (16:35 -0500)
images/voxel-mc-render.png [new file with mode: 0644]
images/voxel-mc.png [new file with mode: 0644]
images/voxel-paper-2d.jpg [new file with mode: 0644]
images/voxel-paper-2dlabels.jpg [new file with mode: 0644]
images/voxel-paper-3d.jpg [new file with mode: 0644]
images/voxel-simple.png [new file with mode: 0644]
posts/hack2025-03-voxel.md [new file with mode: 0644]

diff --git a/images/voxel-mc-render.png b/images/voxel-mc-render.png
new file mode 100644 (file)
index 0000000..83ab0c6
Binary files /dev/null and b/images/voxel-mc-render.png differ
diff --git a/images/voxel-mc.png b/images/voxel-mc.png
new file mode 100644 (file)
index 0000000..a65255c
Binary files /dev/null and b/images/voxel-mc.png differ
diff --git a/images/voxel-paper-2d.jpg b/images/voxel-paper-2d.jpg
new file mode 100644 (file)
index 0000000..7bb4217
Binary files /dev/null and b/images/voxel-paper-2d.jpg differ
diff --git a/images/voxel-paper-2dlabels.jpg b/images/voxel-paper-2dlabels.jpg
new file mode 100644 (file)
index 0000000..b71789f
Binary files /dev/null and b/images/voxel-paper-2dlabels.jpg differ
diff --git a/images/voxel-paper-3d.jpg b/images/voxel-paper-3d.jpg
new file mode 100644 (file)
index 0000000..4a52417
Binary files /dev/null and b/images/voxel-paper-3d.jpg differ
diff --git a/images/voxel-simple.png b/images/voxel-simple.png
new file mode 100644 (file)
index 0000000..30c1aee
Binary files /dev/null and b/images/voxel-simple.png differ
diff --git a/posts/hack2025-03-voxel.md b/posts/hack2025-03-voxel.md
new file mode 100644 (file)
index 0000000..27e8656
--- /dev/null
@@ -0,0 +1,49 @@
+---
+author: admin
+categories:
+- Technical
+date: 2025-11-03
+tags:
+- programming
+- voxel
+slug: hack-voxel
+title: "Hack-A-Day, Day 03: Voxel Rendering"
+---
+
+[Hack-a-Day](https://za3k.com/hackaday) is my self-imposed challenge to do one project a day, for all of November.
+
+How do you render 3D graphics? Here's a picture of a cube:
+
+![caption: a 3D cube](voxel-paper-3d.jpg)
+
+But when you draw it on paper or a screen, it's flattened. All you see are these three faces. 
+
+![caption: a 2D cube](voxel-paper-2d.jpg)
+
+In fact, if you turn off your brain, it's just three weird polygons. And we can figure out the corners of the polygon. For example, I figured out these with a ruler, measuring they they are on the paper in centimeters.
+
+![caption: some polygons](voxel-paper-2dlabels.jpg)
+
+So to draw a cube, we just need to draw polygons. That's the essence of today's project.
+
+---
+
+Here's a minecraft world.
+
+![caption: my minecraft base](voxel-mc.png)
+
+Here's the same thing in my voxel engine. If you squint, you might be able to recognize they're the same thing. Ignore the stripe at the top.
+
+![caption: my "minecraft" base](voxel-mc-render.png)
+
+Here's a much simpler scene. If you click, you can [explore it online](https://za3k.github.io/hackvoxel/)
+
+[![caption: some 3d stuff](voxel-simple.png)](https://za3k.github.io/hackvoxel/)
+
+The source code is [on github](https://github.com/za3k/hackvoxel).
+
+---
+
+This hack wasn't perfect. There's some significant problems, and I worked on it 3 different days. Oh well, live and learn! I had fun.
+
+Thanks to Claude for the code to extract minecraft data -- that was not the exciting part of this project.