Skip to content

A simple compute shader fixed-function rasterizer with Hi-Z culling in OpenGL 4.6.

Notifications You must be signed in to change notification settings

PepcyCh/opengl-cs-rasterizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenGL Compute Shader Rasterizer

A simple compute shader fixed-function rasterizer with hierarchical z-buffer culling in OpenGL 4.6.

(Also project for Zhejiang University 2022-2023 Autumn-Winter Advanced Computer Graphics master course)

Usage:

cs-rasterizer <path-to-scene-file>

A scene file can be a .obj file or a .json scene file, see scenes folder for details.

Build

CMake is used to build this project.

C++20 is needed.

Used Thirdparty

Details

For simplicity, shade fragments with world space normal.

3 rasterizer shaders are implemented:

  1. Just loop in the bounding box of triangle. (basic_z.comp)
  2. Scanline from top to down while maintaining horizontal boundary. (scanline.comp)
  3. (Default) Push each triangle and corresponding horizontal boundary to per-line lists and dispatch another pass to draw. (line_tile_pre.comp and line_tile_draw.comp)

2 kinds of Hi-Z culling are implemented:

  1. Check each instance's bounding box. (simple_hiz)
  2. Do culling through scene octree. (octree_hiz)

About

A simple compute shader fixed-function rasterizer with Hi-Z culling in OpenGL 4.6.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published