| ▲ | Kiro 3 hours ago | ||||||||||||||||
I think their explanation is great. The shader is run on all the pixels within the quad and your shader code needs to figure out if the pixel is within the shape you want to draw or not. Compared to just drawing it pixel by pixel if you do it by pen or on the CPU. For a red line between A and B: CPU/pen: for each pixel between A and B: draw red GPU/shader: for all pixels: draw red if it's on the intersection between A and B | |||||||||||||||||
| ▲ | dahart 3 hours ago | parent [-] | ||||||||||||||||
Figuring out if a pixel is within a shape, or is on the A-B intersection line, is part of the rasterizing step, not the shading. At least in the parent’s analogy. There are quite a few different ways to draw a red line between two points. Also using CPU and GPU here isn’t correct. There is no difference in the way CPUs and GPUs draw things unless you choose different drawing algorithms. | |||||||||||||||||
| |||||||||||||||||