Skip to content

About

Who knew drawing colored pixels in a terminal buffer could be this fun?

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

92 Commits

Folders and files

Repository files navigation

terrible-renderer.cpp

couldn't bother myself finding a better name

It is recommended to go through src/renderer.cpp and include/renderer.h before building the examples, as there are parameters you can set to render the examples according to your style.

Table of Contents

Installation

First, you have to generate the build files using CMake

  https://github.com/Muhammed-Rajab/terrible-renderer.cpp.git
  cd terrible-renderer.cpp
  mkdir build
  cd build/
  cmake ..

Usage

The main source code consists of include/renderer.h and src/renderer.cpp. You can copy them and include them in your project if you want to render custom graphics using them.

My main purpose with this project was to explore the possibilities with terminal rendering and most importantly, have fun. So, as you might have guessed, the code quality might not be the best.

Examples

sphere

I used basic parametric equations, fake normals maps and Phong reflection lighting model to render a sphere.

sphere

donut

I used basic trigonometry, perspective project and some other cool but simple math tools to render a 'rotating donut'. Heavily inspired by donut.c by a1k0n

donut

game

My personal favorite. It renders a custom tilemap from a tileset to the terminal, which you can navigate using WSAD keys. Additionally you can change the speed of movement to each direction. Nothing fancy here, but I learned a lot working on this example.

game

shader

My attempt to replicate the fragment shader in terminal. The visuals are almost identical to An introduction to Shader Art Coding by kishimisu

shader

raymarching

My attempt to simulate a simple raymarching scene in terminal. I followed An introduction to Raymarching by kishimisu, to understand the concepts behind raymarching and successfully implemented my own in the process, but using my own renderer.

raymarching

app

Just a test code for the renderer which fills the canvas with a bunch of circles each frame :) app

License

MIT

About

Who knew drawing colored pixels in a terminal buffer could be this fun?

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages