Skip to content

mikoim/software-rasterization-toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Software Rasterization Toolkit

Software rasterizer written in C.

Features

  • File
    • Bitmap reader / writer
    • STL reader / writer
  • 3DCG
    • Perspective camera
    • Light source
      • Point light
      • Directional light
    • Rendering
      • Z-buffer (depth buffer)
      • Shading
        • Solid shading
        • Flat shading
        • Gouraud shading
        • Phong shading
      • Reflection model
        • Phong reflection model
        • Blinn phong reflection model
    • CSG
      • Primitives
        • Triangle
        • Plane
        • Cube
        • Cylinder
        • Triangular
        • Ball
      • Operations
        • Union
        • Difference (NOT IMPLEMENTED, NEED HELP)
        • Intersection (NOT IMPLEMENTED, NEED HELP)
  • Matrix
    • Transpose
    • Determinant
    • Inverse
    • Addition
    • Subtraction
    • Multiplication
    • Scalar addition
    • Scalar subtraction
    • Scalar multiplication
    • Scalar division
  • Vector
    • Addition
    • Subtraction
    • Scalar addition
    • Scalar subtraction
    • Scalar multiplication
    • Scalar division
    • Cross product
    • Dot product
    • Euclidean norm
    • Euclidean distance
    • L2 normalization
    • Triangle: Check if vector is inside triangle?
    • Triangle: Normal vector
    • Triangle: Center of gravity
    • Barycentric coordinate

Building all examples

git clone --recursive https://github.com/mikoim/software-rasterization-toolkit.git
cd software-rasterization-toolkit
cmake -DCMAKE_BUILD_TYPE=Release .
make

Tips

Export model from Blender

  • File format: STL (binary)
  • Forward: X Forward
  • Up: Y Up

Known issues

  • clang may break PolygonCalculateVertexNormals. (tested on 9.0.0)
  • Sometimes, small gaps appear on polygons if the camera is right in front.

Examples

Video

Rendering polygon wire-frames

here

Comparing shading methods

here

Rendering world

here here

3D models

External dependencies

References

About

(unoptimized) Software rasterizer written in C

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published