Skip to content

raduCh04/SoftwareRenderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Software Renderer in C/C++

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.

🎯 Project Goals

The primary objectives of this project are to:

  1. 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.

  2. Explore Efficient Rendering Techniques: Optimize and implement algorithms for better performance and visual quality, including anti-aliasing and handling different line thicknesses.

  3. Learn Computer Graphics Theory: Gain a deeper understanding of geometric transformations, coordinate systems, clipping algorithms, and rasterization techniques.

  4. Generate Visual Outputs: Produce visual outputs that can be viewed in image editors (GIMP, ImageMagick) by exporting raw pixel data.

  5. 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.

📚 Topics

  • 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

Usage

✅ Prerequisites

  • A C compiler (e.g., gcc , clang, MSVC)
  • CMake
  • GIMP, ImageMagick, or any image viewer that supports loading.ppm

Build & Run

mkdir build
cd build
cmake ../
make
./renderer

This will generate a file called pixmap.data in the current directory.

🖼️ Viewing the output (e.g. GIMP)

  1. Open Gimp.
  2. Go to File > Open.
  3. Choose pixmap.oom.
  4. Open file.

License

This project is licensed under the MIT License. Feel free to use, modify, and distribute it as you wish. License: MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published