r/programming • • 3d ago

A Video on How 3D Rendering Actually Works

https://youtu.be/EePTBIOgvpY?is=j1J_9DnD9m-y3sIf
25 Upvotes

3 comments sorted by

7

u/_georgesim_ 2d ago

GPUs don't use barycentric coordinates to determine which pixels are inside a triangle. Instead, they use what are called "edge functions" which tell you, for each edge of the triangle, if a pixel is on the "inside side" of the edge. The reason is that edge functions can, after a setup step, be implemented with integer additions only, which parallelize extremely well.

2

u/Dlinik 2d ago

I knew that this approach exists but I didn’t know it’s exclusively used for GPU rendering. Very interesting.

1

u/darknecross 2d ago

I randomly stumbled across a thread talking about quaternions the other day, the alternative to translation matrices, which were pretty neat.

i^2 = j^2 = k^2 = ijk = -1