99 lines
4.3 KiB
Text
99 lines
4.3 KiB
Text
---
|
|
title: The Graphics Pipeline --- Rasterization
|
|
date: "April 20 - 2025"
|
|
---
|
|
|
|
<script>
|
|
import Image from "../../Image.svelte"
|
|
import Note from "../../Note.svelte"
|
|
import Tip from "../../Tip.svelte"
|
|
</script>
|
|
|
|
## Rasterization
|
|
|
|
**Bounding Box**
|
|
|
|
**Winding order**
|
|
|
|
**P needs to be on the "RIGHT" side of a->b**
|
|
|
|
**Cross Product**
|
|
|
|
**Interpolation**
|
|
|
|
Remember the god forsaken **input assembler**? Let's expand our understanding of it
|
|
since-- for simplicity's sake, we skipped over the fact that **vertices** can hold much, much more data
|
|
than only positions.
|
|
|
|
**Barycentric Interpolation** NOTE NOT linear interpolation
|
|
|
|
**Some Optimizations**
|
|
|
|
<Note title="Software Rasterization">
|
|
|
|
What we've implemented is a simple toy rasterizer written to be run on the CPU for educational
|
|
purposes only. It is inefficient, has shit precision (integer precision) thus it is choppy when moving things around, and has many problems.
|
|
However, GPUs have dedicated hardwares that run incredibly optimized algorithms to do this
|
|
sort of thing; hence what we made is called a **software** rasterizer ---as opposed to the usual
|
|
**hardware** rasterizer.
|
|
|
|
It's nice to be aware of and appreciate the simplicity of triangles. If our polygons had variable
|
|
number of edges then it would be really difficult to come up with efficient algorithms for doing this.
|
|
|
|
</Note>
|
|
|
|
## Sources
|
|
|
|
<Note title="Reviewers", type="review">
|
|
|
|
MMZ ❤️
|
|
|
|
Grammarly
|
|
|
|
Some LLMs
|
|
|
|
</Note>
|
|
|
|
<Note title="Books", type="resource">
|
|
|
|
[Joey De Vriez --- LearnOpenGL](https://learnopengl.com/)
|
|
[Tomas Akenine Moller --- Real-Time Rendering (4th ed)](https://www.realtimerendering.com/intro.html)
|
|
[Gabriel Gambetta --- Computer Graphics from Scratch](https://gabrielgambetta.com/computer-graphics-from-scratch/)
|
|
</Note>
|
|
|
|
<Note title="Wikipedia", type="resource">
|
|
|
|
[Polygonal Modeling](https://en.wikipedia.org/wiki/Polygonal_modeling)
|
|
[Non-uniform Rational B-spline Surfaces](https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline)
|
|
[Computer Aided Design (CAD)](https://en.wikipedia.org/wiki/Computer-aided_design)
|
|
[Rasterization](https://en.wikipedia.org/wiki/Rasterisation)
|
|
[Euclidean geometry](https://en.wikipedia.org/wiki/Euclidean_geometry)
|
|
</Note>
|
|
|
|
<Note title="Youtube", type="resource">
|
|
|
|
[Miolith --- Quick Understanding of Homogeneous Coordinates for Computer Graphics](https://www.youtube.com/watch?v=o-xwmTODTUI)
|
|
[Leios Labs --- What are affine transformations?](https://www.youtube.com/watch?v=E3Phj6J287o)
|
|
[3Blue1Brown --- Essence of linear algebra (highly recommended playlist)](https://www.youtube.com/watch?v=fNk_zzaMoSs&list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab)
|
|
[3Blue1Brown --- Quaternions and 3d rotation, explained interactively](https://www.youtube.com/watch?v=zjMuIxRvygQ)
|
|
[pikuma --- Math for Game Developers (playlist)](https://www.youtube.com/watch?v=Do_vEjd6gF0&list=PLYnrabpSIM-93QtJmGnQcJRdiqMBEwZ7_)
|
|
[pikuma --- 3D Graphics (playlist)](https://www.youtube.com/watch?v=Do_vEjd6gF0&list=PLYnrabpSIM-97qGEeOWnxZBqvR_zwjWoo)
|
|
[Cem Yuksel --- Introduction to Computer Graphics (playlist)](https://www.youtube.com/watch?v=vLSphLtKQ0o&list=PLplnkTzzqsZTfYh4UbhLGpI5kGd5oW_Hh)
|
|
[Cem Yuksel --- Interactive Computer Graphics (playlist)](https://www.youtube.com/watch?v=UVCuWQV_-Es&list=PLplnkTzzqsZS3R5DjmCQsqupu43oS9CFN&pp=0gcJCV8EOCosWNin)
|
|
[javidx9 --- Essential Mathematics For Aspiring Game Developers](https://www.youtube.com/watch?v=DPfxjQ6sqrc)
|
|
</Note>
|
|
|
|
<Note title="Articles", type="resource">
|
|
|
|
[Stackoverflow --- Why do 3D engines primarily use triangles to draw surfaces?](https://stackoverflow.com/questions/6100528/why-do-3d-engines-primarily-use-triangles-to-draw-surfaces)
|
|
[The ryg blog --- The barycentric conspiracy](https://fgiesen.wordpress.com/2013/02/06/the-barycentric-conspirac/)
|
|
[Juan Pineda --- A Parallel Algorithm for Polygon Rasterization](https://www.cs.drexel.edu/~deb39/Classes/Papers/comp175-06-pineda.pdf)
|
|
[Kristoffer Dyrkorn --- A fast and precise triangle rasterizer](https://kristoffer-dyrkorn.github.io/triangle-rasterizer/)
|
|
[Microsoft --- Rasterization Rules](https://learn.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-rasterizer-stage-rules)
|
|
</Note>
|
|
|
|
<Note title="Documentations", type="resource">
|
|
|
|
[Vulkan Docs --- Drawing](https://docs.vulkan.org/spec/latest/chapters/drawing.html)
|
|
[Vulkan Docs --- Pipeline Diagram](https://docs.vulkan.org/spec/latest/_images/pipelinemesh.svg)
|
|
</Note>
|