Skip to content

A simple software rasterizer written for learning purposes

Notifications You must be signed in to change notification settings

sourencho/rogue_rasterizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rogue_rasterizer

A simple software rasterizer written for learning purposes using the tutorial Scratchapixel: Rasterization Practical Implementation.

Rasterization is the task of taking an image described in a vector graphics format (shapes) and converting it into a raster image (a series of pixels, dots or lines, which, when displayed together, create the image which was represented via shapes).

In this case we are taking as input a shape defined by triangles in 3D cooridnates (.geo file) and camera coordinates/orientation and then outputting the 2D projection of the camera's perspective as an image (.ppm file) or text (stdout).

Authors: @hwacha and @sourenp

Note that this code was not written to be particularly optimal or clean since this was mostly an exercise to learn graphics concepts.

Run

Usage

# Usage: ./main <geo_file_path> image/text

Compile

c++  -o main src/main.cpp -std=c++11 -O3 

Image output

./main "data/cow.geo" image
open output.ppm

cow output

Text output

./main "data/cow.geo" text

cow output

Todo

  • Perspective correct vertex attribute interpolation (color)
  • Import color from model instead of assigning random colors
  • Set output size, camera position/orientation and text character via command line options
  • Clean up and optimize code

Resources

About

A simple software rasterizer written for learning purposes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published