Update README

This commit is contained in:
Krzosa Karol
2022-07-27 09:38:18 +02:00
parent 3deb94aad6
commit fbd37e4714
2 changed files with 17 additions and 79 deletions

View File

@@ -4,6 +4,23 @@
![screenshot1](assets/Screenshot1.png)
![screenshot2](assets/Screenshot2.png)
## Rasterization
Algorithm used is from the article "A Parallel Algorithm for Polygon Rasterization" by Juan Pineda. First a bounding box of a triangle is calculated. Every pixel of that triangle is checked using the edge function from the paper to figure out if it belongs to the triangle. Other then that during rasterization also these things happen:
* Clipping
* Texture mapping
* Depth buffer, near objects occlude far objects
* Transparency using premultiplied alpha
* Gamma correct interpolation of colors
## SIMD
The inner loop of the rasterization is fully vectorized using AVX, AVX2 and FMA intrinsics. The general simd strategy is that 8 pixels are processed at the time. On every iteration, bitmap format is converted to the format for simd computation. SIMD format groups every color channel into separate registers. Then for example all compuation is done on a vector of 8 reds.
## Multithreading
Rendered image is split to tiles, each thread gets one tile to render. To synchronize work between threads a simple work queue is implemented. It only uses atomic operations and semaphores to distribute work. Work queue is implemented in one producer, multiple consumers architecture.
## Clipping

View File

@@ -1,82 +1,3 @@
/////////////////////////////////////////////////////////////////////////////////////
///
/// ### Things to do:
///
/// - [x] Drawing triangles
/// - [x] Drawing cubes and lines for testing
/// - [x] Y up coordinate system, left handed
/// - [x] Drawing a cube with perspective
/// - [x] Culling triangles facing away from camera
/// - [x] Texture mapping
/// - [x] Basic linear transformations - rotation, translation, scaling
/// - [x] Bilinear filtering of textures
/// - [x] Nearest filtering
/// - [x] Fix the gaps between triangles (it also improved look of triangle edges)
/// - [ ] Perspective matrix vs simple perspective
/// - [x] Perspective correct interpolation
/// - [x] Depth buffer
/// - [x] Gamma correct blending - converting to almost linear space
/// - [x] Alpha blending
/// - [x] Premultiplied alpha
/// - [x] Merge with base
/// - [ ] Fill convention
/// - [ ] Antialiasing (seems like performance gets really bad with this)
/// - [x] LookAt Camera
/// - [x] FPS Camera
/// - [ ] Quarternions for rotations
/// - [x] Reading OBJ models
/// - [x] Dumping raw obj files
/// - [x] Loading raw obj files, big startup speedup!
/// - [ ] Reading more OBJ formats
/// - [x] Reading OBJ .mtl files
/// - [x] Loading materials
/// - [x] Rendering textures obj models
/// - [x] Reading complex obj models (sponza)
/// - [x] Fix sponza uv coordinates - the issue was uv > 1 and uv < 0
/// - [x] Clipping
/// - [x] Triagnle rectangle bound clipping
/// - [x] A way of culling Z out triangles
/// - [x] Simple test z clipping
/// - [x] Maybe should clip a triangle on znear zfar plane?
/// - [x] Maybe should clip out triangles that are fully z out before draw_triangle
/// - [ ] Effects!!!
/// - [ ] Outlines
/// - [ ] Lightning
/// - [ ] Proper normal interpolation
/// * `https://hero.handmade.network/episode/code/day101/#105
/// - [ ] Phong
/// - [x] diffuse
/// - [x] ambient
/// - [ ] specular
/// * reflecting vectors
/// - [ ] Use all materials from OBJ
/// - [ ] Point light
/// - [ ] Reading PMX files
/// - [ ] Rendering multiple objects, queue renderer
/// - [x] Simple function to render a mesh
/// - [x] Simple profiling tooling
/// - [x] Statistics based on profiler data
/// - [x] Find cool profilers - ExtraSleepy, Vtune
/// - [ ] Optimizations
/// - [x] Inline edge function
/// - [x] Expand edge functions to more optimized version
/// - [ ] Test 4x2 bitmap layout?
/// - [ ] Edge function to integer
/// - [ ] Use integer bit operations to figure out if plus. (edge0|edge1|edge2)>=0
/// - [x] SIMD
/// - [ ] Multithreading
///
/// - [x] Text rendering
/// - [ ] UI
/// - [x] Labels
/// - [x] Settings variables
/// - [x] Signals
/// - [ ] Sliders
/// - [ ] Groups
/// - [x] Gamma correct alpha blending for rectangles and bitmaps
/// - [ ] Plotting of profile data
/// - [x] Simple scatter plot
/// - [x] Asset processor as second program
#include "obj_dump.cpp"
// #include "multimedia.cpp"