Today I spent an hour on preliminary setup for clipping planes. The idea here is to not render triangles outside the camera view and to clip triangles which extend outside the view. To do that, I need planes defining the bounds of the camera view and a way to check whether points are inside the…
Author: Jacob
Learning C, Day 22 (First Person Camera)
Today I worked on a first person camera for the 3D renderer. Right now it uses WASD to move forwards/backwards and turn left/right. Once I add clipping I’ll change it to use the mouse to look and WASD to move. I can’t wait to use this render to make 3D games and memes. It’s going…
Worley Noise in C
Today I made Worley noise in C! I was watching this video and when it got to Worley noise I was like, “Wait, isn’t that a Voronoi texture?” I looked it up and it basically is. I’ve been using Voronoi textures in Blender for years and I was surprised to see something I thought was…
Learning C, Day 21 (“Look At” Camera)
Today I spent about two and a half hours implementing a “look at” camera. It’s pretty cool: instead of moving the camera, I move the world by the opposite amount the camera would have moved. And it’s the same for rotation. I also added delta time so that the movement and rotation each fame are…
Procedural Stars in Blender
Earlier today I was working on a photoshop commission for a friend and I needed stars, but couldn’t find an image I liked. Enter procedural stars. They’re great because you can get exactly the stars and sky you want. The shader I made today isn’t photo realistic, but it could definitely be expanded. Here’s an…
Learning C, Day 20 (Z-Buffer)
Z-buffer! It was really quick to add (1 hour). I already had per-pixel Z values from the texture perspective correction code. It looks really cool if I intentionally display the pixels backwards: Tomorrow I should be implementing a better camera!
Learning C, Day 19 (Loading UV Coordinates)
Today is the day. Behold the crab. (Best viewed while listening to Crab Rave.) So today I got UV coordinates from OBJ files in the usual two hours! Now I can load any OBJ file with a texture and render it. I also finally replaced my file loading code and sort of fixed a segmentation…
Learning C, Day 18 (PNG Textures)
A really short day today: I just spent half an hour to get the renderer loading PNG textures.See you tomorrow!
Keyboard Gradients, Part 2
I got the gradient generator working! Sort of. It’s super fragile, has basically no error checking, and probably won’t work with your specific setup. That said, here it is: Dependencies: Python 3.6+, Pillow, and Beautiful Soup 4 Usage Open ICUE and create a new profile Add a static lighting layer and set it to just…
Keyboard Gradients
Static gradients on RGB keyboards look cool. They’re colorful, but not too distracting. The problems is that ICUE, the software for Corsair keyboards, doesn’t have the option to create a static gradient. I made a gradient by manually by adding lighting layers for each column of keys and it took forever. So I wondered if…
Learning C, Day 17 (Texture Mapping 3)
Today I fixed the cube texture warping: The perspective correction uses interpolated Z values to do a sort of perspective divide in the texture space. I don’t entirely understand how it works yet, so I’ll add a note here if this is all wrong.Here’s what I have so far: The problem is that the texture…
Learning C, Day 16 (Texture Mapping 2)
Barycentric coordinates: they’re great for squishing squares into triangles. Here’s a wobbly textured cube: An overview of how it works The goal is to draw a triangle on the screen with pixels from a texture. I have three vertices and a texture in memory. The vertices describe two triangles: a triangle in the screen with…
Learning C, Day 15 (Texture Mapping 1)
Today I worked on adding texture mapping to the renderer so that it can display textured objects, which took about two and a half hours. It isn’t done yet, though, so here’s the classic missing texture color using the new code: Right now the code loops through each pixel of each screen space triangle and…
Learning C, Day 14 (Perspective Matrix)
Today I spent about two and a half hours implementing the perspective matrix and better flat shading. Now the renderer supports different aspect ratios and fields of view: At one point I messed up the color shading code and this happened (warning, flashing colors): Also, the site now has an icon and dark mode! I…
Learning C, Day 13 (More Matrix Math)
More matrix math today. I spent about an hour and a half implementing matrix rotation and scaling: Perspective matrix is up next, I’ll see you tomorrow!
Learning C, Day 12 (Matrix Math)
Matrix math. I added types and functions for matrix scaling and translation, which took about two hours. I’m thinking I might not use matrices in the PICO-8 port because they seem to add a bunch of overhead. I guess I’ll see. An update on Vim: sometimes I find myself pressing “j” to go down in…
Learning C, Day 11 (Triangle Fill)
Today I got triangle fill and basic z-depth order working! It took about four hours (o.O), but it looks really cool: I also fixed a bug with key inputs being delayed. I needed to get all the SDL events each frame instead of just the first one. It’s really nice to not have to wait…
Learning C, Day 10 (Back-Face Culling)
I spent about two and a half hours today on the course (more vector math) and I got back-face culling working! The next part of the course is filling the triangles, which is something I’ve been wondering how to do for a while. I can’t wait to see what I can make with the engine…