/projects/fdf/image1.png

FDF

Published @ 27-06-2023

#graphics #c #codam #bresenham

Wireframe renderer made in C

The goal of this project was to make a wireframe renderer written in C. The program has to parse the input files, extract its data (which are points and their corresponding color info), and finally, draw and display them as a isometric projection.

Since this a Codam project I had to use the mandatory MLX42 library instead of raylib or some other more popular library. As with most projects from the curriculum you are allowed to add as many extra features on top of the required ones as you like.

Process

I started out by drawing the points and the lines between them, for this I used the bresenham line algorithm.

After finishing the mandatory part of the project I was pretty hooked, so I added a few more things.
I started out by adding rotation using rotation matrices, I was lucky to come across 3Blue1Brown video’s, giving a very good visual explanation behind the math.
Then I added the color gradient based on the line height using linear interpolation.
After all that, I added the sidebar with some stats, and a view system allowing you to save your current display settings, and cycle through them.

You can find the finished project here.


Action shots

img img

© 2024 Joppe Boeve. All rights reserved.