Code Monkey home page Code Monkey logo

rasterizerhowto's Introduction

RasterizerHowTo

A handwritten rasterizer with clean and well-annotated C++ implementation for systematic learning toward Computer Graphics.

Supported Features

  • Model, view, projection and viewport transformations.
  • Wireframe rasterization.
  • Mesh rasterization.
  • Z-buffering algorithm.
  • MSAA super-sampling anti-aliasing.
  • Barycentric coordinates interpolation.
  • Normal, Blinn-Phong, texture, bump and displacement mappings.

Get Started

  • From source
# more build details see `Development`
git clone https://github.com/dadadadawjb/RasterizerHowTo.git
cd RasterizerHowTo
mkdir build
cd build
cmake ..
make

# normal mapping
./RasterizerHowTo normal
# Blinn-Phong mapping
./RasterizerHowTo phong
# texture mapping
./RasterizerHowTo texture
# bump mapping
./RasterizerHowTo bump
# displacement mapping
./RasterizerHowTo displacement
  • From release binary
# download from https://github.com/dadadadawjb/RasterizerHowTo/releases as `RasterizerHowTo`

# normal mapping
./RasterizerHowTo normal
# Blinn-Phong mapping
./RasterizerHowTo phong
# texture mapping
./RasterizerHowTo texture
# bump mapping
./RasterizerHowTo bump
# displacement mapping
./RasterizerHowTo displacement

Results

  • Wireframe Demo Rasterization

WireframeDemoRasterization

  • Mesh Demo Rasterization

MeshDemoRasterization

  • Normal Mapping

NormalMapping

  • Blinn-Phong Mapping

BlinnPhongMapping

  • Texture Mapping

TextureMapping

  • Bump Mapping

BumpMapping

  • Displacement Mapping

DisplacementMapping

  • Wireframe Rasterization

WireframeRasterization

Development

At present, the use of RasterizerHowTo is somehow awkward. The configurations are all set in global.hpp. Specifically, DEMO determines whether to rasterize demo triangles or OBJ models, OUTSIDE determines whether to rasterize wireframe or not, INSIDE determines whether to rasterize area inside triangles or not, MSAA determines whether to use MSAA super-sampling anti-aliasing, BILINEAR determines whether to use bilinear interpolation to help shader. Every time you changed, you should compile it again.

Another thing needed to notice is that, you need to set your path to Eigen inside CMakeLists.txt. Also for easier experience, I do not ignore .vscode which provides C/C++ intellisense and build configuration, you need to set your path to Eigen and OpenCV.

Note

The skeleton is taken from GAMES101 by Lingqi Yan.

rasterizerhowto's People

Contributors

dadadadawjb avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sharavsambuu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.