A basic software rasterizer written in C that renders simple 2D graphics and exports a raw pixel buffer to a .data file. This file can be viewed using tools like GIMP or ImageMagick by interpreting it as raw image data.
The primary objectives of this project are to:
-
Implement Core Rendering Algorithms: Develop and optimize key 2D graphics algorithms, such as line drawing, circle drawing, and polygon filling, which are fundamental to rendering in computer graphics.
-
Explore Efficient Rendering Techniques: Optimize and implement algorithms for better performance and visual quality, including anti-aliasing and handling different line thicknesses.
-
Learn Computer Graphics Theory: Gain a deeper understanding of geometric transformations, coordinate systems, clipping algorithms, and rasterization techniques.
-
Generate Visual Outputs: Produce visual outputs that can be viewed in image editors (GIMP, ImageMagick) by exporting raw pixel data.
-
Expand the Algorithm Library: Gradually add more graphics algorithms, such as texture mapping, shading models, and 3D object rendering, to create a comprehensive library of algorithms.
- Line drawing
- Mathematical Equation
- Incremental Line Algorithm
- DDA Algorithm
- Midpoint Line Algorithm
- Bresenham Algorithm
- Different Thickness
- Antialiasing (Xiaolin Wu)
- Circle drawing & filling
- Mathematical Equations
- Midpoint Circle Algorithm
- Bresenham Approach
- Circle Filling
- Polygon drawing & filling
- Connecting Vertices
- Scan Line
- Flood Fill
- Text rendering
- Naive Rendering
- Pre-Converting
- Line and Polygon Clipping
- Cohen-Sutherland Algorithm
- Cyrus-Beck-Liang-Barsky Algorithm
More coming soon
- A C compiler (e.g.,
gcc
,clang
,MSVC
) - CMake
- GIMP, ImageMagick, or any image viewer that supports loading
.ppm
mkdir build
cd build
cmake ../
make
./renderer
This will generate a file called pixmap.data in the current directory.
- Open Gimp.
- Go to File > Open.
- Choose pixmap.oom.
- Open file.
This project is licensed under the MIT License. Feel free to use, modify, and distribute it as you wish.