# Soft-Renderer **Repository Path**: townboy123/Soft-Renderer ## Basic Information - **Project Name**: Soft-Renderer - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-11 - **Last Updated**: 2022-01-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
A tiny soft-renderer built from scratch using C++ 11
View Demo
Report Bug
### Built With
This project was totally refactored based on previous naive version I built 2 years ago. Now, I utilize the following third-party libraries to build this renderer. Please note that SDL2 is just for displaying the rendered results as well as handling mouse and key events.
* [SDL2](https://www.libsdl.org/)
* [GLM](https://github.com/g-truc/glm)
* [stb_image](https://github.com/nothings/stb)
* [assimp](https://github.com/assimp/assimp)
* [oneTBB](https://github.com/oneapi-src/oneTBB/releases/tag/v2021.1.1)
## Getting Started
### Prerequisites
I build this project on Windows platform. Please make sure your system is equipped with the following softwares.
- [cmake](https://cmake.org/):at least version 3.5
* Microsoft visual studio 2017 or 2019
### Installation
Please compile the project for **x64 platform**.
1. Clone the repo
```sh
git clone https://github.com/ZeusYang/TinySoftRenderer.git
```
2. Use cmake to build the project:
```
cd build
cmake ..
make
```
or using cmake-gui is ok.
Please note that copy **external/dlls/*.dll** (for example: SDL2.dll) to the corresponding example binary directory for execution (like `build/Release`). Release mode is much more efficient than debug mode.
## Usage
Please check out `examples/` for more details.
```C++
int main(int argc, char* args[])
{
constexpr int width = 666;
constexpr int height = 500;
TRWindowsApp::ptr winApp = TRWindowsApp::getInstance(width, height, "TinySoftRenderer-By yangwc");
if (winApp == nullptr)
{
return -1;
}
bool generatedMipmap = true;
TRRenderer::ptr renderer = std::make_shared
- Mipmap texture mapping, and trilinear sampling. Refs: [link1](http://www.aclockworkberry.com/shader-derivative-functions/#footnote_3_1104), [link2](https://en.wikipedia.org/wiki/Mipmap)
- Tangent space normal mapping.
- Reinhard tone mapping (from HDR -> LDR).
- Multi sampling anti-aliasing (MSAA 4X, and MSAA 8X)
- Alpha blending, and alpha to coverage algorithm based on MSAA (order independent transparency).
- Multi-thread parallelization using [tbb](https://github.com/oneapi-src/oneTBB) as backend. The cpu usage could reach to 100%.
## License
Distributed under the MIT License. See `LICENSE` for more information.
## Contact
yangwc3@mail2.sysu.edu.cn