<p>I'm making a triangle rasterizer for my 3d engine because I forgot to make a depth buffer and I was wondering what is the fastest way to rasterize a triangle,</p>
<p>I was thinking bresenham combined with another algorithm I found in this video (skip to 6:47) <a href="https://www.youtube.com/watch?v=PahbNFypubE&amp;t=437s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=PahbNFypubE&amp;t=437s</a> for horizontal slopes</p>
<p>or I could use bresenham but clear out the useless points to make it easier to draw pixels with lines for every y coordinate</p>
<p>let me know if you have better ideas and even better, benchmarked them</p>

CC BY-SA 4.0
2024-04-27T19:48:53.567Z
What do you mean by “I forgot to make a depth buffer”? How do you handle overlapping triangles?
lhf
CC BY-SA 4.0
2024-04-27T23:16:49.577Z
I made a camera and mesh loader and stuff but and instead of using a depth buffer i just sorted the triangles by distance and forgot that some triangle can go through eachother
samone123
<rendering><interpolation><rasterizer>
What is the fastest way to rasterize a triangle?
samone123
# What is the fastest way to rasterize a triangle?

(Asked by: username_0 on 2024-04-26)

I'm making a triangle rasterizer for my 3d engine because I forgot to make a depth buffer and I was wondering what is the fastest way to rasterize a triangle,

I was thinking bresenham combined with another algorithm I found in this video (skip to 6:47) <https://www.youtube.com/watch?v=PahbNFypubE&t=437s> for horizontal slopes

or I could use bresenham but clear out the useless points to make it easier to draw pixels with lines for every y coordinate

let me know if you have better ideas and even better, benchmarked them

**Tags:** rendering, interpolation, rasterizer

> **Comments:**
> **username_1**: What do you mean by “I forgot to make a depth buffer”? How do you handle overlapping triangles?  
> **username_0**: I made a camera and mesh loader and stuff but and instead of using a depth buffer i just sorted the triangles by distance and forgot that some triangle can go through eachother  

---

## 0 answers

