The FDF (Fil de Fer) project at 42 is a graphics programming task where you create a program in C to display a 3D wireframe map from a set of 2D coordinates.
The input is a file containing a grid of elevation points, and the program visualizes the map using isometric projection.
Key features of the project include:
- Parsing the map file: Read and interpret a grid of elevation values from a text file.
- Rendering: Convert the 2D grid data into a 3D representation with lines connecting the points to form a mesh.
- Isometric projection: Display the 3D map in a 2D isometric perspective to provide depth and structure.
- Controls: Implement interactivity for zooming, rotating, and translating the view, allowing dynamic exploration of the map.
- Graphics library: Typically, the project uses the MiniLibX library to handle window management and drawing. The project emphasizes skills in graphics programming, data manipulation, and mastering low-level rendering concepts.
✅ 125/125 (with bonus)
1. Clone the repo:
git clone https://github.com/dmitrijslasko/fdf42.git2. Go into the folder:
cd fdf423. Build the program:
make4. Launch the program with the selected map:
./fdf ./maps/42.fdfOther maps are stored in the ./maps/ folder.
- Welcome screen (not allowed by the project's subject, but using it via a workaround in the Makefile)
- Mouse / keyboard rotation and zoom
- Map height & color information parser
- Height scaling
- Relative height color output (with easily customizable color schemes)
- Control panel overlay
- Control panel language switch (English, German)
- 2 projections: Isometric / parallel
- Rotation angle information panel
- Special visual admin mode
- Show / hide nodes (not shown in the GIF above)
- Zoom: Scroll or [+] / [-]
- Move: Hold left mouse button or Arrows
- Flatten / raise height: [[] / []]
- Rotate: Hold right mouse button & Move
- Enable autorotation: [K]
- Toggle autorotation mode: [M]
- X-Axis - [Q] / [W]
- Y-Axis - [A] / [S]
- Z-Axis - [Z] / [W]
- Switch projections: ISO: [I], Top-view: [P]
- Show / hide nodes: [N]
- Reset view: [R]
- Map colors: [1][2][3][4]
- Switch language: [L]
- Secret admin mode: [/]
- macOS not working out of the box (the project was written on Linux Ubuntu 22/24)
- Due to the limitation of the MLX library, the control panel text is output to the window, not the image.
This sometimes results in blinking (because of the constant rerendering).
However, it perfectly shows why we should use the image pre-render for the main part of the program.
It's best to reimplement this functionality with an XPM image.
- Getting started with the minilibx https://aurelienbrabant.fr/blog/getting-started-with-the-minilibx
- Awesome project with implemented spherical projection https://github.com/ailopez-o/42Barcelona-FdF
- A simple fdf implementation that works on MacOS (was a great starting point for me; helped to implement mouse rotations) https://github.com/VBrazhnik/FdF
- This article mentions using an XPM image for the control panel https://medium.com/@amehri_tarik/fdf-42-a-detailed-walkthrough-7184cca317fc
Feel free to contact me:
Slack: @dmlasko
E-mail: dmitrijs.lasko@gmail.com
Telegram: @lalamoose

