<p>I'm rendering a scene using scanline method. In order to get rid of aliasing we need to render a scene with higher resolution (2x, for example). I'm trying to figure out how to calculate the color of a sample when it is not taken from the center of the subpixel. For example, we have 4 subpixels per 1 pixel, where the blue circle is the center of the subpixel, and the red circle is the sample position.</p>

<p><a href="https://i.sstatic.net/2XIXR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2XIXR.png" alt="enter image description here"></a></p>

<p>I tried to find information about sample calculation, but got nothing. I assume that I need to calculate sample color using 4 neighboring subpixels and apply bilinear interpolation to them to find the color.</p>

<p><a href="https://i.sstatic.net/XRwq5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XRwq5.png" alt="enter image description here"></a></p>

<p>Is my guess true, or does it have to somehow calculate the color of the sample in a different way?</p>

CC BY-SA 4.0
2018-09-20T19:39:44.557Z
What are the samples and subpixels in this context? Are you ray-tracing, sampling a texture, or something else entirely?
Dan Hulme
CC BY-SA 4.0
2018-09-20T20:02:00.570Z
@DanHulme I'm rendering a scene using scanline method. In order to get rid of aliasing we need to render a scene with higher resolution (2x, for example). After that we have 4 subpixels per 1 pixel. As I know, the easiest way to downsample a frame is to calculate the average color of all subpixels (regular grid algorithm?). But I can't figure out how to calculate the color of a sample which is not positioned in the center of subpixel. I think that it's calculated using 4 neighbouring subpixels,but I'm not sure.
Paviel Kraskoŭski
CC BY-SA 4.0
2018-09-23T23:29:59.837Z
@PaviełKraskoŭski i need any tutorial to understand this problem
information
CC BY-SA 4.0
2018-09-25T09:27:29.410Z
@x-rw [Here](https://mynameismjp.wordpress.com/2012/10/24/msaa-overview/) you can read about supersampling at the beginning of the article before "SUPERSAMPLING EVOLVES INTO MSAA". [Wikipedia](https://en.wikipedia.org/wiki/Supersampling). [Link](https://www.everything2.com/index.pl?node_id=1028947) on the Wikipedia page to the reference article.
Paviel Kraskoŭski
<antialiasing><subpixel-rendering><supersampling>
Sample color calculation in rotated grid supersampling
Paviel Kraskoŭski
# Sample color calculation in rotated grid supersampling

(Asked by: username_0 on 2018-09-20)

I'm rendering a scene using scanline method. In order to get rid of aliasing we need to render a scene with higher resolution (2x, for example). I'm trying to figure out how to calculate the color of a sample when it is not taken from the center of the subpixel. For example, we have 4 subpixels per 1 pixel, where the blue circle is the center of the subpixel, and the red circle is the sample position.

[![enter image description here](https://i.sstatic.net/2XIXR.png)](https://i.sstatic.net/2XIXR.png)

I tried to find username_2 about sample calculation, but got nothing. I assume that I need to calculate sample color using 4 neighboring subpixels and apply bilinear interpolation to them to find the color.

[![enter image description here](https://i.sstatic.net/XRwq5.png)](https://i.sstatic.net/XRwq5.png)

Is my guess true, or does it have to somehow calculate the color of the sample in a different way?

**Tags:** antialiasing, subpixel-rendering, supersampling

> **Comments:**
> **username_1**: What are the samples and subpixels in this context? Are you ray-tracing, sampling a texture, or something else entirely?  
> **username_0**: @username_1 I'm rendering a scene using scanline method. In order to get rid of aliasing we need to render a scene with higher resolution (2x, for example). After that we have 4 subpixels per 1 pixel. As I know, the easiest way to downsample a frame is to calculate the average color of all subpixels (regular grid algorithm?). But I can't figure out how to calculate the color of a sample which is not positioned in the center of subpixel. I think that it's calculated using 4 neighbouring subpixels,but I'm not sure.  
> **username_2**: @PaviełKraskoŭski i need any tutorial to understand this problem  
> **username_0**: @x-rw [Here](https://mynameismjp.wordpress.com/2012/10/24/msaa-overview/) you can read about supersampling at the beginning of the article before "SUPERSAMPLING EVOLVES INTO MSAA". [Wikipedia](https://en.wikipedia.org/wiki/Supersampling). [Link](https://www.everything2.com/index.pl?node_id=1028947) on the Wikipedia page to the reference article.  

---

## 0 answers

