Skip to content

Zielon/CPURasterizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPURasterizer

Efficient CPU based rasterizer

CPU implementation of a very efficient rasterizer which utilizes AVX2 instructions and lock-free multi-threading programming. Using tiled rendering the program consumes 8 pixels at the same time, which together with std::execution threading library makes it very fast and robust. The viewer of the project is a very simple OpenGL applicatoin which renders a texture to a quad. The texture is generated by the CPU Renderer.h class. The pipeline contains most of the modern GPU rasterizers stages.

issues closed release windwos linux

Current development is available under project. Discussion about the project is available here.

Implemented stages include:

- Vertex Shader
- Clipping (Sutherland–Hodgman algorithm)
- Rasterization (Larrabee paper)
- Perspective Corrected Interpolation
- Fragment Shader
- Depth Testing

Except rasterization pipeline the project contains serveral additional features. (More features will be developed soon)

  • Tiled rendering using AVX2 (2x4 pixels tile)
  • Texture sampling
  • OpenGL viewer (only texture rendering)
  • C++17 (std::execution etc.)

Performance

All tests were done on CPU Intel i4790k with 4 cores. 60 fps is the maximum for GLFW window.

Scene Triangles Resolution Shader Filter FPS
Boy 85k 1280x720 Phong Nearest 35.2
Bedroom 1490k 1280x720 Phong Nearest 10.1
Panther 2004k 1280x720 Phong Nearest 6.3

How to run

All dependencies needed for the project can be downloaded using windows_install.bat for Windows or linux_install.sh for Linux. The project has Visual Studio 2019 solution and CMake project.

git-lfs must be installed in order to fetch scenes repository.

Assets

The scene description and assets are adapted from GLSL-PathTracer project [4]. The scenes repository will be automatically cloned during the installation process.

Rasterizer/Assets/PBRScenes/
    bedroom/
    coffee_cart/
    HDR/
    bedroom.scene
    coffee_cart.scene
    ...

References/Credits

[0] Optimizing the basic rasterizer
[1] Rasterization on larrabee
[2] Rasterization practical implementation
[3] EDXRaster