# Do we ever consider the size of the pixel to calculate the color in Ray Tracing?

From what I'm reading, it looks like a ray tracer views a pixel as one color and computes that color using the ray starting in the center of that pixel. Yet a pixel has a width and a height.

Do we ever use the actual square (now a day pixels are considered squares) that the pixel represents to calculate it true color from all possible source within that entire square?

I am thinking that this is how we come up with colors on edges of shapes in scanline rendering and was wondering whether the same could be applied to ray tracing.

There is a picture which I hope better represents what I am trying to ask here. Should we only consider the pixels to be single points? Or are we to consider pixels as large areas?

• This article "A pixel is not a square"(alvyray.com/Memos/CG/Microsoft/6_pixel.pdf) would be helpful to your understanding of a pixel. – TheBusyTypist Apr 20 '18 at 18:42
• @TheBusyTypist fun reading but quite misleading. I do love how it starts with "This is not a religious issue" and then pretty much makes it into one. – Olivier Apr 20 '18 at 20:49
• afaik, pixels are considered as areas, that is why we have the concept of multiple samples per pixel and it's a way of implementing anti aliasing. – gallickgunner Apr 21 '18 at 2:38
• @TheBusyTypist Interesting read, but when you calculate an image you want to make it perfect. He's mixing the display of the result with the result and he's complaining about the positioning (pixel center), which does make some algorithms easier to handle. As the wandering warrior says, it's useful to consider a pixel as being a small square to mix partial pixels together and get _perfect_anti-aliasing. Here, though, I'm wondering about the potential effect in Ray Tracing. Maybe what I need to do is generate a bigger image and then scale it down to make sure I get the right colors... – Alexis Wilke Apr 21 '18 at 5:40
• @wandering-warrior No a pixel is a sample its no more a square than a sound samples are lines. Though, considering it a square is not a bad model, just not the best one. Evaluating the sample over better sampling is better. In fact if pixel is a area it should consider stuff outside of a square area. Because the perfect representation of a pixel is not square. – joojaa Apr 21 '18 at 12:49

Another area where the pixel size matters is in texture sampling. If you want to get nice texturing, you don't just take a point sample of the texture, you set some filter width according to the area of the texture the sample relates to. This doesn't just make your sampling more efficient by using the right mipmap level: it is required for correct sampling to avoid sampling artefacts. In a GPU fragment shader, you might use the dFdx and dFdy functions to do this. In a ray-tracer, you might have use a cone-tracing style of carrying the filter width with the ray, initially based on the level of supersampling at the camera, but updated whenever a child ray is spawned.