Coder Social home page Coder Social logo

rasterizer's Introduction

Rasterizer

General Information

This project was done for the ISART Digital school by Rémi Serra and Alexandre Perché.
The end goal of the project was to create a program that renders objects in 3D, computes lighting, and has a camera from which the scene is viewed. This is all done on one CPU thread, so the performance isn't ideal, although the code is somewhat optimised.


Preview


Features

Objects:

  • Rasterization of triangles in 3D space.
  • Drawing functions for:
    • Quads
    • Cubes
    • Subdivided cubes
    • Spheres
  • Object depth buffer.
  • Alpha-blending between objects.
  • Back-face culling.
  • Object manager to edit the scene's objects in the engine.

3D mathematics:

  • Translation, rotation and scaling using matrices.
  • Transformation of vertices through local, world, view, clip, ndc and screen spaces.

Colors and textures:

  • Interpolation of vertex colors.
  • Loading textures from .bmp files.
  • Perspective-correct application of textures onto objects (nearest-neighboor).
  • Applying vertex hues to textures.

Lights:

  • Phong and Blinn-Phong lighting models.
  • Materials that dictate how lighting is applied to objects.
  • Light manager to edit the scene's lights in the engine.

Camera:

  • Perspective camera.
  • 1st and 3rd person view modes.
  • Unlit, lit, wireframe and z-buffer rendering modes.
  • Controls:
    • Press right click to take control.
    • In 1st person:
      • use WASD+shift/space to move and mouse to look around.
    • In 3rd person (2 options):
      • use mouse to rotate around the taget point and mouse wheel to change the camera distance.
      • use WASD+shift/space to rotate around the target point and change the camera distance.

Shortcomings

The following features were not added because of lack of time, or bad compatibility with the current state of the codebase.

  • Meshes.
  • Anti-aliasing.
  • Clipping.

How to build

Linux

  • Execute the make command in the project root.
  • Launch the Rasterizer executable file.

Windows

  • You need to have clang installed (run clang -v to check).
  • Execute build.bat to build the project using clang compiler.
  • Or execute the make command in Cygwin.
  • Launch the Rasterizer.exe file.

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.