Git Product home page Git Product logo

sw-rendering-pipeline's Introduction

Software Rendering Pipeline

Graphics rendering pipeline without any external graphical dependencies running fully on CPU.

Controls

  • W/S - camera movement.
  • Z/C - model up/down movement.
  • E/Q - model yaw rotation.
  • R/F - model pitch rotation.
  • 4/5/6/8 - light movement.
  • 9/7 - light movement closer/further.

Screenshots

Features

  • You can move around.
  • You can rotate a model and move a point light.
  • You can load and render obj file including materials.
  • Phong reflection model.
  • Phong shading.
  • Texture mapping.
  • Normal mapping.
  • Z-buffering.
  • Render to texture.
  • Rendering process emulating standard GPU pipeline.

Process

There are several stages mimicking standard pipeline.

Input assembler

The stage itself does nothing (yet) but let you set up the vertex and index buffers.

Vertex shader

Vertex shader move vertices from model space to clip (projection) space. My renderer is right handed in model space, world space and view space and left handed in clip space.

Primitive assembly

From the vertices, the triangles are built in here. It is important for input obj mesh to be in CCW orientation. Culling and clipping happens here too. In a classical pipeline, the culling is more like preliminary using flags but in mine the triangle is removed if it fails normal test.

Rasterizer

Transformation to NDC and screen space, barycentric interpolation, depth test and pixel shader invocation for all related fragments. In classical pipeline, the depth test in rasterizer is in a form of early one which can be disabled based on following pixel shader procesing or via configuration. In my pipeline, the depth test here is final without any more checks later.

This part is parallelized via std::for_each with std::execution::par_unseq.

Pixel shader

Every pixel is processed here. Texture is applied including normal map and lit according to Phong model. The material information can be supplemented via mlt file.

Output merger

Final stage where pixel is written to an output buffer.

Additional information

The project is built on tPixelGameEngine for basic window handling.

sw-rendering-pipeline's People

Contributors

tucna avatar

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.